FFMPEG using x265 vs x264

I just recompiled ffmpeg (see previous post for that bit of hell) and included h.265 encoding. I’m going to be processing 4K video soon, so wanted to get the hang of this codec. It works with any video, of course, but up until today I hadn’t used it.

The command line is very similar to x264, but includes a new parameter “crf” (constant rate factor). This can also be used for x264, but until now I never used it.
For x265 28 is the default rate in the range of 0-51.
For x264 23 is the default in the recommended range of 18-28.

Lower number = higher quality (lower compression) and larger file size.
Higher number = lower quality (greater compression) and smaller file size.

ffmpeg -i pam.m2ts -c:v libx265 -c:a libfdk_aac -crf 28 pam_265.mp4

The file size difference between raw, x264, and x265 is amazing!

My current HD video camera produces MTS high-def files.
Here are the file sizes for a 12 minute clip:
MTS: 830MB
x264: 439MB (not quite half the size of MTS)
x265: 122MB (about 1/7 the size of MTS!)

To my eyes, there was no discernible difference in quality, using the default settings. x265 seems like a great codec for file sharing and should save a ton of space when I’m uploading video clips for singers. That assumes they will be able to view the clips. Microsoft Windows does not by default play MP4 files (by choice, even though millions use this format). One has to install a 3rd party media player or codec package for Windows to play MP4. VLC is one common 3rd party media player.

FFMPEG “stack smashing detected”

I wanted to encode some new video I shot with h.265 and hadn’t included that in ffmpeg configuration previously. So I began removing ffmpeg sources from previous installs, and recompiling all the libraries and then the main program. After all was done, I tried encoding and got an error I hadn’t seen before (and apparently isn’t common or I would have found an answer by searching).  I saw:

*** stack smashing detected ***: terminated
Aborted (core dumped)

After much experimentation I found that it is somehow tied to ffmpeg trying to use any audio library. If I skip audio with -an or copy, then the file will be produced. Any attempt at using an audio library of any kind produces the stack smashing error.

I’m still plugging away at it trying to find a solution or find an error in compiling. No luck yet.

UPDATE:
I wiped and reloaded ffmpeg x264 x265 and reloaded according to the Ubuntu guide for installing ffmpeg, but I found I had to add a couple of things to get the static x264 to work (otherwise during make, x265 would complain about needing to be recompiled with fPIC)

Once I did the git clone for x264 as described on the guide, I did these steps
cd x264
./configure --enable-static --enable-pic
make
sudo make install
sudo ldconfig

“ldconfig creates the necessary links and cache (for use by the run-time linker, ld.so) to the most recent shared libraries found in the directories specified on the command line…” See the man page for full description.

With the enable-pic option during configure, the static build worked. I then tried ffmpeg again and all was well.

New PC time – 4K video editing – But then… Intel SGX

I’m buying a new Panasonic HC-WXF1 4K video camera for recording local jazz singers (one of my hobbies). But my 10-year-old PC isn’t going to handle that kind of processing. It already takes its sweet time doing regular HD video.

So I’m busy putting together the specs on my new system, with a hot new processor and 32GB of fast RAM. I’ve been looking at the ASRock X299 Taichi XE and the new Intel i9-7960 processor. That is, I was until a minute ago when I read that the latest greatest processor and the X299 chipset from Intel doesn’t support their own Intel SGX! SGX is yet another Digital Rights Management hoop that was added to the pile, and it is required for doing playback of 4K/UHD movies from BluRay, and may affect online streaming of 4K.

Ho-ly-shit. What were they thinking leaving that out of the chipset?! Additionally, the motherboard has to have SGX support built into the BIOS even of your processor (like the i7-7700K) supports it. Some boards apparently don’t have the available memory to store the SGX firmware, so consumers that bought these boards are out of luck. X299 used to support full playback, but then the manufacturers decided to add more DRM requirements, and that broke the ability of these motherboards to playback or view streaming 4K.

ASRock support says “Unfortunately, the Intel X299 CPU (Skylake-X + Kabylake-X) don’t support Intel SGX function.” (see review by Jeremy S.)

Yes, I can still edit my own video, as far as I know. But still, for Intel to be that out of touch with their own stuff is insane. Will SGX be required for receiving streaming 4K? Industry, MAKE IT EASIER ON CONSUMERS WHO PAY BIG BUCKS TO WATCH YOUR STUFF!

https://canicompare.com/en/processors/intel-core-i9-7960x-specification/compare-intel-core-i9-7960x-and-find-compatible-parts-pbvsCs.html

I’m happy to update if this information is not correct. It was shocking to read tonight on the Newegg review, and then other sites that confirmed it. I’m hoping it isn’t as nasty as it sounds right now. The flip side is that I’ve never bought a BluRay since my earlier experiences with DRM prevented me from viewing rented movies on a player that was a year old. Honestly, DRM is such a pain for consumers, and pirates get around it nearly as soon as a new kind is released. I wish the industry would quit punishing consumers with these hoops.

From other forums I saw this from an owner of :
“What it WONT play is:
4k Netflix streams
4k Amazon Prime video streams
4k BluRay disks.

What it will play:
Any 4k content with DRM removed. This is very simple.”

Monitors have to be HDCP 2.2 compliant (not just 2.0)

Apparently only Intel graphics chipsets are allowed to pass the signal due to Digital Rights Management. There is no intention or ability for motherboard makers to update the boards already sold that do not have SGX incorporated into the BIOS (and which were not designed with space to incorporate SGX).

To get 4k/60hz, you have to use a DisplayPort cable and have a monitor that accepts it, and a graphics card with that port. HDMI cable limits the output to 24Hz, at least on certain monitors (check specs).

Playonlinux error on start

When I was trying to run Playonlinux from an icon, nothing ever appeared. I started a terminal and ran it, and got the python error:

ImportError: cannot import name _remove_dead_weakref

I didn’t find much on this, but after a lot of searching found this site and the final answer that fixed it for me:

https://askubuntu.com/questions/903004/playonlinux-wont-start-ubuntu-16-04/903047#903047

Edit this file:

/usr/share/playonlinux/bash/find_python

And change the following from:

next_python "python"
next_python "python2.7"
next_python "python2.6"
next_python "python2"
next_python "none"

to:

next_python "/usr/bin/python" #This line was added
next_python "python"
next_python "python2.7"
next_python "python2.6"
next_python "python2"
next_python "none"

That fixed it for me!