Sometimes ffmpeg users could meet following error message when decoding something using ffmpeg with x264 codec...
ffmpeg: common/cpu.c:248: x264_cpu_detect: Assertion `!(cpu&(0x00000400x0000080))' failed.
ffmpeg: common/cpu.c:251: x264_cpu_detect: Assertion `!(cpu&(0x00000400x0000080))' failed.
This means that your CPU doesn't supports real hardware decoding, and could be slow during this process. Unfortunately bad developer guys decided to interrupt entire process if CPU doesn't support this feature. Even if you will re-compile ffmpeg from source - you will get this error message.
I spent few hours before understood how to fight and win this problem.
So, let's compile ffmpeg from scratch using Ubuntu (other distro could be different with package names, but process of compilation is the same):
1. Install required packages. apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev
libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev
libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev yasm
2. mkdir ~/ffmpeg_sources
3. cd ~/ffmpeg_sources
4. Compile x264 codec: wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
tar xjvf last_x264.tar.bz2
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static --disable-opencl
Now, and this is urgent, we must open .c file and make few bad things into code: vi common/cpu.c
We should find part of code similar to this:
if( model == 9 model == 13 model == 14 )
cpu &= ~(X264_CPU_SSE2X264_CPU_SSE3);
Usually it's about 251-th line. We should replace our CPU id to something else, or just comment this checking. For example replace line "if( model == 9 model == 13 model == 14 )" to "if( model == 900 model == 1300 model == 1400 )".
That's all. Then we must save file and continue compilation.
5. Compile ffmpeg: cd ~/ffmpeg_sources
tar xjvf ffmpeg-snapshot.tar.bz2
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure
If this manual will not work for you, please google for another, but please understand trick to make x264 working with your PC: edit file "common/cpu.c" and comment/remove from it CPU checking.
Hope I helped you. If so, please say thanks :))
|guest 09 апреля в 09:04||Ответить|