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.

Advertisements

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).

Wireless bridge failure (after years of working)

I posted a few years back about a wireless bridge I set up to send camera signals across an area that could not be wired. It has been working fine since then, but then suddenly dropped off and stopped sending the camera video. I’ve been using Linksys WRT1200ac routers with no issues up to this point, 2.4GHz wireless “n” due to the antenna style.

I did the basic troubleshooting first at the remote end, testing the local POE switch that powers the cameras, pinging the cameras from the switch, pinging all of the above from the router, and all tested fine. Then I went to the receiving side and everything on that side all tested fine as well. The issue was the wireless portion was not talking. Neither router showed any sign of communication on the panel lights.

I checked the large dish antennas for physical damage (none), checked the cabling for rodent or lightning damage (none), checked the signal from the receiving end while standing at the remote building (strong signal). I set up the remote router temporarily as a standard router and tested the signal coming from it to the receiving building (strong). That told me that the antennas were fine, and each router was capable of sending a strong signal.

I set up the sending router as a wireless bridge again and took it to the same room as the receiving router, and tried them just a few feet apart. No communication, even though the sending router will not go into wireless bridge mode if it can’t find the receiving router. Very odd. That told me that one or both routers were having issues receiving.

Today I replaced the wireless bridge router in the remote building with a new one (same model, but v2). It showed a powerful signal from the receiving unit and went into wireless bridge mode. I was able to ping the receiving router and some cameras on that side. I thought all was resolved. But when I got back to my shop, the cameras were still not recording (meaning they were not visible from the receiving end). Crikey!

Tomorrow I’m going to try replacing the receiving router with a new one and see if that resolves this problem. I’m sure that some electronics can go wonky after a few years of use, but can’t yet confirm exactly what the issue is. I found that the old router from the remote building works fine on 5GHz, so am planning to use it for another camera route on that site based on the higher band. I’ll update as I figure things out.

UPDATE: It turned out that both of the version 1 routers had lost their ability to receive over the 2.4GHz bandwidth. They transmitted fine, but they weren’t receiving reliably. I replaced both with new version 2 routers and everything is working again. I found that the old v1 routers still worked fine on 5GHz ac, so I re-purposed them on a new wireless camera network using the standard antennas that come with the router, but on extender cables. Each antenna is in a small plastic box on the outside of their respective buildings, only about 40 feet from each other, line of sight. Works great so far.

UPDATE 2: We also bought the newer Linksys EA8300 (AC2200) as a backup. I found that it will not go into wireless bridge mode in the high range of 5GHz (5GH-2 on this router). It works fine in the lower range (5GH-1) and 2.4GHz. That seems odd to me, and not sure if one or both of them have an issue with broadcasting or receiving on the higher range. The high range works fine on the older router (WRT1200ac).

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!