Newest 'libx264' Questions - Stack Overflow
Les articles publiés sur le site
-
CPU spike when transitioning from a still image
21 avril 2016, par lagnatAfter streaming a still image (with x264) for a long period of time, the transition to live video makes the CPU spike to 100% for a period of time proportionally equal to how long the still image was streaming. More specifically, transitioning after a minute will result in a CPU spike lasting about 15 seconds. Transitioning after 30 minutes will result in that spike lasting closer to 3 minutes.
Does this symptom make any sense and is there anything I can do about it?
-
Why sliced thread affect so much on realtime encoding using ffmpeg x264 ?
13 avril 2016, par CurtisGuoI'm using ffmpeg libx264 to encode a 720p screen captured from x11 in realtime with a fps of 30. when I use -tune zerolatency paramenter, the average encode time per-frame can be as large as 12ms with profile baseline.
After a study of the ffmpeg x264 source code, I found that the key parameter leading to such long encode time is sliced-threads which enabled by -tune zerolatency. After disabled using -x264-params sliced-threads=0 the encode time can be as low as 2ms
And with sliced-threads disabled, the CPU usage will be 40%, while only 20% when enabled.
Can someone explain the details about this sliced-thread? Especially in realtime encoding(assume no frame is buffered to be encoded. only encode when a frame is captured).
-
How to encode H.264 video using FFmpeg C API and then open the output with a media player ?
4 avril 2016, par GummiBI'm trying to encode a H.264 video with the FFMPEG C API. I have successfully compiled and executed the decoding/encoding example provided by FFMPEG.
The problem I'm facing is that the .mpg file (encoded with AV_CODEC_ID_MPEG1VIDEO) the example creates works. Windows creates a thumbnail and everything. On the other hand the .h264 (encoded with AV_CODEC_ID_H264) file does not. When I try to play the file in VLC the play/pause button just flickers, no thumbnail in windows, no nothing.
During encoding libx264 reports the following:
[libx264 @ 004b81a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX [libx264 @ 004b81a0] profile High, level 1.3 [libx264 @ 004b81a0] frame I:3 Avg QP:26.79 size: 2116 [libx264 @ 004b81a0] frame P:12 Avg QP:26.60 size: 789 [libx264 @ 004b81a0] frame B:10 Avg QP:31.39 size: 499 [libx264 @ 004b81a0] consecutive B-frames: 20.0% 80.0% [libx264 @ 004b81a0] mb I I16..4: 78.3% 11.6% 10.1% [libx264 @ 004b81a0] mb P I16..4: 77.4% 0.6% 0.1% P16..4: 20.3% 0.7% 0.9% 0.0% 0.0% skip: 0.0% [libx264 @ 004b81a0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 9.4% 0.2% 0.0% direct:11.0% skip:79.4% L0:25.4% L1:35.4% BI:39.2% [libx264 @ 004b81a0] final ratefactor: 17.03 [libx264 @ 004b81a0] 8x8 transform intra:3.4% inter:31.3% [libx264 @ 004b81a0] direct mvs spatial:0.0% temporal:100.0% [libx264 @ 004b81a0] coded y,uvDC,uvAC intra: 4.4% 35.8% 1.6% inter: 1.3% 34.5% 9.5% [libx264 @ 004b81a0] i16 v,h,dc,p: 0% 0% 0% 100% [libx264 @ 004b81a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 7% 20% 17% 49% 0% 0% 0% 1% 6% [libx264 @ 004b81a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 7% 18% 45% 2% 7% 2% 3% 2% [libx264 @ 004b81a0] i8c dc,h,v,p: 2% 6% 4% 88% [libx264 @ 004b81a0] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 004b81a0] ref P L0: 95.6% 1.6% 2.2% 0.5% 0.2% [libx264 @ 004b81a0] ref B L0: 67.5% 28.5% 3.2% 0.8% [libx264 @ 004b81a0] kb/s:166.45
"ffprobe.exe test.h264 -show_streams" returns
[STREAM] index=0 codec_name=h264 codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 profile=High codec_type=video codec_time_base=1/50 codec_tag_string=[0][0][0][0] codec_tag=0x0000 width=352 height=288 has_b_frames=1 sample_aspect_ratio=0:1 display_aspect_ratio=0:1 pix_fmt=yuv420p level=13 timecode=N/A id=N/A r_frame_rate=50/2 avg_frame_rate=25/1 time_base=1/1200000 start_pts=N/A start_time=N/A duration_ts=N/A duration=N/A bit_rate=N/A nb_frames=N/A nb_read_frames=N/A nb_read_packets=N/A DISPOSITION:default=0 DISPOSITION:dub=0 DISPOSITION:original=0 DISPOSITION:comment=0 DISPOSITION:lyrics=0 DISPOSITION:karaoke=0 DISPOSITION:forced=0 DISPOSITION:hearing_impaired=0 DISPOSITION:visual_impaired=0 DISPOSITION:clean_effects=0 DISPOSITION:attached_pic=0 [/STREAM]
There you can see:
start_time=N/A duration_ts=N/A duration=N/A
I have tried countless changes to the AVCodecContext and multitude of parameters options to av_opt_set function. Still no luck getting a working H.264 video. I have even tried different builds of FFmpeg. No luck.
I'm using the "FFmpeg git-0fb64da 32-bit Dev" build from Zeranoe and MinGw 4.7.2
-
Q.For encoding error of ffmpeg
21 mars 2016, par 社畜根性I ran the following command.
ffmpeg -i test.mp4 -threads 2 -codec:v libx264 -s:v 1280x720 -aspect:v 16:9 -b:v 256k -map 0 -f segment -segment_format mpegts -segment_time 10 -segment_list stream.m3u8 streamfiles/stream%03d.ts
Execution result
ffmpeg version N-75926-gce0834b Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.6 (Debian 4.6.3-14+rpi1) configuration: --arch=armel --target-os=linux --enable-shared --enable-gpl --enable-libx264 --enable-nonfree libavutil 55. 3.100 / 55. 3.100 libavcodec 57. 5.100 / 57. 5.100 libavformat 57. 3.100 / 57. 3.100 libavdevice 57. 0.100 / 57. 0.100 libavfilter 6. 11.100 / 6. 11.100 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.100 / 2. 0.100 libpostproc 54. 0.100 / 54. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf56.40.100 Duration: 00:00:03.28, start: 0.000000, bitrate: 10159 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 10156 kb/s, 25 fps, 25 tbr, 1200k tbn, 2400k tbc (default) Metadata: handler_name : VideoHandler Illegal instruction
The result is that an error occurred. Someone told me that it's an error if you do not put the option to
./configure
oflibx264
. That option is the--extra-cflags='-march=armv6' --extra-ldflags='-march=armv6'
. Otherwise it would use the instruction of unsupported.So I ran
./configure
with the option, then I ran the make and now I'm getting an error message:common/arm/quant-a.S: Assembler messages: common/arm/quant-a.S:362: Error: selected processor does not support ARM mode `rbit r1,r1' common/arm/quant-a.S:363: Error: selected processor does not support ARM mode `rbit r1,r1' Makefile:217: recipe for target 'common/arm/quant-a.o' failed make: *** [common/arm/quant-a.o] Error 1
I do not know the meaning of this error. How should you deal me this error?
I use the machine is Raspberry PI B+ and my OS is Raspbian. I want to use
ffmpeg
andlibx264
.Any advice and suggestions will be greatly appreciated.
-
Compiling FFmpeg : libx264 not found
17 mars 2016, par SaidTagnitI hope some one helps me the solve this problems. I was trying to compile FFmpeg 2.2.3 library under ubuntu 12.04LTS for android using android ndk r10e by following this tutorials:
here is my build_android.sh file:
#!/bin/bash NDK=/home/rango/Desktop/android-ndk-r10e SYSROOT=$NDK/platforms/android-19/arch-arm/ TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86 #ADDI_LDFLAGS="-L /usr/local/lib" #ADDI_CFLAGS="-I /usr/include" function build_one { ./configure \ --prefix=$PREFIX \ --enable-shared \ --enable-static \ --disable-doc \ --disable-ffmpeg \ --disable-ffplay \ --disable-ffprobe \ --disable-ffserver \ --disable-doc \ --disable-symver \ --enable-protocol=concat \ --enable-protocol=file \ --enable-muxer=mp4 \ --enable-demuxer=mpegts \ --enable-memalign-hack \ --enable-gpl \ --enable-libx264 \ --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \ --target-os=linux \ --arch=arm \ --enable-cross-compile \ --sysroot=$SYSROOT \ --extra-cflags="-Os -fpic -marm $ADDI_CFLAGS" \ --extra-ldflags="$ADDI_LDFLAGS" \ make clean make -j4 make install } CPU=arm PREFIX=$(pwd)/android/$CPU build_one
when i execute buid_android.sh script without --enable-libx264 \ line everything is going well and i can get .a files on android/arm/ folder. but with this line it fails and show the following error in the console:
ERROR: libx264 not found
If you think configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to the ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net. Include the log file "config.log" produced by configure as this will help
it seems like it can't find where the libraries are, as i get a lot of the following errors in config.log file:
"LIBNAME".h: No such file or directory newlib.h: No such file or directory mingw.h: No such file or directory x264.h: No such file or directory
Here is the tail of config.log file:
check_mathfunc truncf 1 check_ld cc check_cc BEGIN /tmp/ffconf.zGKqGin6.c 1 #include 2 float foo(float f, float g) { return truncf(f); } 3 int main(void){ return (int) foo; } END /tmp/ffconf.zGKqGin6.c /home/rango/Desktop/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc --sysroot=/home/rango/Desktop/android-ndk-r10e/platforms/android-19/arch-arm/ -isysroot /home/rango/Desktop/android-ndk-r10e/platforms/android-19/arch-arm/ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Dstrtod=avpriv_strtod -DPIC -Os -fpic -marm -march=armv5te -std=c99 -fomit-frame-pointer -fPIC -marm -pthread -c -o /tmp/ffconf.8Q9ke3aO.o /tmp/ffconf.zGKqGin6.c /home/rango/Desktop/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc --sysroot=/home/rango/Desktop/android-ndk-r10e/platforms/android-19/arch-arm/ -isysroot /home/rango/Desktop/android-ndk-r10e/platforms/android-19/arch-arm/ -Wl,--as-needed -o /tmp/ffconf.3sjTkc5z /tmp/ffconf.8Q9ke3aO.o -lm -lz -pthread check_lib x264.h x264_encoder_encode -lx264 check_header x264.h check_cpp BEGIN /tmp/ffconf.zGKqGin6.c 1 #include 2 int x; END /tmp/ffconf.zGKqGin6.c /home/rango/Desktop/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc --sysroot=/home/rango/Desktop/android-ndk-r10e/platforms/android-19/arch-arm/ -isysroot /home/rango/Desktop/android-ndk-r10e/platforms/android-19/arch-arm/ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Dstrtod=avpriv_strtod -DPIC -Os -fpic -marm -march=armv5te -std=c99 -fomit-frame-pointer -fPIC -marm -pthread -E -o /tmp/ffconf.8Q9ke3aO.o /tmp/ffconf.zGKqGin6.c /tmp/ffconf.zGKqGin6.c:1:18: fatal error: x264.h: No such file or directory #include ^ compilation terminated. ERROR: libx264 not found