Newest 'libx264' Questions - Stack Overflow
Les articles publiés sur le site
-
Fast Video Compression on Android
7 avril 2017, par leap of faithI want to upload video files to server and compress before uploading. I'm using ffmpeg libx264. I have seen viber can upload 30 second video file of size 78MB within a minute [reduce it's down to 2.3MB]. I want to know how do they do it so fast?
What I have tried so far -
FFMPEG version : n2.4.2 Built with gcc 4.8 Build Configuraiton : --target-os=linux --cross-prefix=/home/sb/Source-Code/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/sb/Source-Code/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/sb/Source-Code/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/sb/Source-Code/ffmpeg-android/build/armeabi-v7a-neon --extra-cflags='-I/home/sb/Source-Code/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all -mfpu=neon' --extra-ldflags='-L/home/sb/Source-Code/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
Command:
ffmpeg -y -i /storage/emulated/0/main.mp4 -s 480x320 -r 20 -c:v libx264 -preset ultrafast -c:a copy -me_method zero -tune fastdecode -tune zerolatency -strict -2 -b:v 1000k -pix_fmt yuv420p /storage/emulated/0/output.mp4
The result so far is, a 30second 78MB file gets compressed to 4.3MB which takes around 1min 28seconds. Here is the console dump - http://pastebin.com/rn81acGx . I mainly want to reduce the time it takes to compress. How can I achieve this?
Thanks in advance.
-
DCT coefficients and MV extraction in ffmpeg Mpeg-4 encoding
7 avril 2017, par Giacomo CalvigioniI'm using ffmpeg and libx264 to encode a video and I want to extract the DCT coefficients and motion vector of each frame during the encoding process.
What is the best way to do this?
I read in the ffmpeg manual that is possible to use the debug mode with some flags to extract these values. I tried
ffmpeg -debug dct_coeff
to output the dct coefficients but this option doesn't work for me; is it deprecated or related to a specific ffmpeg version?Another option would be to modify and recompile ffmpeg source code but I don't know in which part of the code DCT and MV are calculated.
Any help with the debug mode or code modification suggestions would be appreciated.
-
How to achieve 2 pass encoding using x264 ?
6 avril 2017, par Kim Kardashianis there a parameter in the x264_param_t structure or do I have to send frames to x264 dll twice.. ? Because I just use encoder_encode function and that returns nal units . Im guessing it should be a combination of a parameter and using encoder_encode twice.
Here is how i initialize params and link to libx264
InitializeSettings(){ x264_param_default_preset(&m_pXParam, "medium", "zerolatency"); x264_param_apply_profile(&m_pXParam, "baseline"); m_pXParam.i_width = cx; m_pXParam.i_height = cy; m_pXParam.i_fps_num = fps; m_pXParam.i_fps_den = 1; // rate control m_pXParam.i_keyint_max = fps - 5; //m_pXParam.rc.f_rf_constant_max = fps + 5; // rate control m_pXParam.rc.i_qp_constant=18; m_pXParam.rc.i_qp_min=18; m_pXParam.rc.i_qp_max=18;} x264_picture_alloc(&m_xPicture, X264_CSP_I420 , m_pXParam.i_width, m_pXParam.i_height); m_xPicture.img = x264img; m_iframe_size = x264_encoder_encode(m_xEncoder, &m_xNals, &m_iNal, &m_xPicture, &m_xPictureOut);
@nobody555 Thanks! I had another question about x264_param_apply_fastfirstpass function:
/* x264_param_apply_fastfirstpass: * If first-pass mode is set (rc.b_stat_read == 0, rc.b_stat_write == 1), * modify the encoder settings to disable options generally not useful on * the first pass. */
what options are they talking about ?
-
How to achieve 2 pass encoding using x264 ?
6 avril 2017, par Kim Kardashianis there a parameter in the x264_param_t structure or do I have to send frames to x264 dll twice.. ? Because I just use encoder_encode function and that returns nal units . Im guessing it should be a combination of a parameter and using encoder_encode twice.
Here is how i initialize params and link to libx264
InitializeSettings(){ x264_param_default_preset(&m_pXParam, "medium", "zerolatency"); x264_param_apply_profile(&m_pXParam, "baseline"); m_pXParam.i_width = cx; m_pXParam.i_height = cy; m_pXParam.i_fps_num = fps; m_pXParam.i_fps_den = 1; // rate control m_pXParam.i_keyint_max = fps - 5; //m_pXParam.rc.f_rf_constant_max = fps + 5; // rate control m_pXParam.rc.i_qp_constant=18; m_pXParam.rc.i_qp_min=18; m_pXParam.rc.i_qp_max=18;} x264_picture_alloc(&m_xPicture, X264_CSP_I420 , m_pXParam.i_width, m_pXParam.i_height); m_xPicture.img = x264img; m_iframe_size = x264_encoder_encode(m_xEncoder, &m_xNals, &m_iNal, &m_xPicture, &m_xPictureOut);
@nobody555 Thanks! I had another question about x264_param_apply_fastfirstpass function:
/* x264_param_apply_fastfirstpass: * If first-pass mode is set (rc.b_stat_read == 0, rc.b_stat_write == 1), * modify the encoder settings to disable options generally not useful on * the first pass. */
what options are they talking about ?
-
GStreamer x264enc not found
5 avril 2017, par Dominik SchreiberI installed GStreamer-0.10 and all modules (base, good, bad, ugly, ffmpeg) according to these instructions (browse through by clicking prev/next): http://www.linuxfromscratch.org/blfs/view/svn/multimedia/gst-plugins-ugly.html
Everything seemed to have worked just fine but when I want to execute my pipeline I got this error:
glib.GError: no element "x264enc"
Apparently the module was not installed:
gst-inspect x264enc No such element or plugin 'x264enc'
After that I installed the codec by executing:
sudo apt-get install x264
This did not work either. So I installed the latest build manually: http://www.videolan.org/developers/x264.html
After a successful installation of x264 I ran ./configure on the gstreamer-0.10 ugly modules once again and found out about this:
configure: *** checking feature: x264 plug-in *** configure: *** for plug-ins: x264 *** checking for X264... no configure: No package 'x264' found configure: *** These plugins will not be built: x264 configure: creating ./config.status
A check if x264 is available seems to get fullfilled:
which x264 /usr/local/bin/x264
I'm using ubuntu server 12.04 LTS. Any ideas what I have to do to compile this module properly? Thanks!