Newest 'libx264' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/libx264

Les articles publiés sur le site

  • webm to mp4 conversion using ffmpeg

    2 décembre 2015, par Pavan K

    When I try to convert a webm file to mp4 the output is very very choppy and it appears as if many frames have been dropped by ffmpeg

    I used the following commands to convert

    ffmpeg -i movie.webm movie.mp4
    ffmpeg -i movie.webm -vcodec libx264 movie.mp4
    ffmpeg -i movie.webm -vcodec libx264 -qscale 0 movie.mp4
    

    All of them have the same problem. When I use ffprobe it seems to show the frames more or less properly.

    UPDATE:

     built on Jun 14 2013 14:31:50 with gcc 4.7 (Ubuntu/Linaro 4.7.2-2ubuntu1)
      configuration: --prefix=/home/user2/ffmpeg_build --extra-cflags=-I/home/user2/ffmpeg_build/include --extra-ldflags=-L/home/pavan4/ffmpeg_build/lib --bindir=/home/pavan4/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
      libavutil      52. 35.101 / 52. 35.101
      libavcodec     55. 16.100 / 55. 16.100
      libavformat    55.  8.102 / 55.  8.102
      libavdevice    55.  2.100 / 55.  2.100
      libavfilter     3. 77.101 /  3. 77.101
      libswscale      2.  3.100 /  2.  3.100
      libswresample   0. 17.102 /  0. 17.102
      libpostproc    52.  3.100 / 52.  3.100
    Hyper fast Audio and Video encoder
    usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
    
    Use -h to get full help or, even better, run 'man ffmpeg'
    
    Input #0, matroska,webm, from '1.webm':
      Duration: 00:00:10.64, start: 0.000000, bitrate: 5024 kb/s
        Stream #0:0(eng): Video: vp8, yuv420p, 1280x720, SAR 1:1 DAR 16:9, 1k fps, 1k tbr, 1k tbn, 1k tbc (default)
    [libx264 @ 0x1d966a0] using SAR=1/1
    [libx264 @ 0x1d966a0] MB rate (3600000) > level limit (2073600)
    [libx264 @ 0x1d966a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
    [libx264 @ 0x1d966a0] profile High, level 5.2
    [libx264 @ 0x1d966a0] 264 - core 133 r2 a3ac64b - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to '1_conv4.mp4':
      Metadata:
        encoder         : Lavf55.8.102
        Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 16k tbn, 1k tbc (default)
    Stream mapping:
    Stream #0:0 -> #0:0 (vp8 -> libx264)
    Press [q] to stop, [?] for help
    frame=  168 fps=0.0 q=33.0 size=      62kB time=00:00:00.11 bitrate=4606.0kbits/frame=  293 fps=230 q=33.0 size=     138kB time=00:00:00.23 bitrate=4809.7kbits/
    
    video:5620kB audio:0kB subtitle:0 global headers:0kB muxing overhead 2.212461%
    [libx264 @ 0x1d966a0] frame I:46    Avg QP:18.50  size: 39849
    [libx264 @ 0x1d966a0] frame P:2940  Avg QP:18.27  size:  1222
    [libx264 @ 0x1d966a0] frame B:7651  Avg QP:17.68  size:    43
    [libx264 @ 0x1d966a0] consecutive B-frames:  4.0%  0.2%  0.3% 95.5%
    [libx264 @ 0x1d966a0] mb I  I16..4: 19.9% 63.2% 16.9%
    [libx264 @ 0x1d966a0] mb P  I16..4:  0.2%  0.5%  0.1%  P16..4:  3.9%  1.1%  0.6%  0.0%  0.0%    skip:93.6%
    [libx264 @ 0x1d966a0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.2%  0.0%  0.0%  direct: 0.0%  skip:99.8%  L0:25.1% L1:74.9% BI: 0.0%
    [libx264 @ 0x1d966a0] 8x8 transform intra:63.6% inter:75.9%
    [libx264 @ 0x1d966a0] coded y,uvDC,uvAC intra: 61.5% 53.4% 24.4% inter: 0.5% 0.5% 0.0%
    [libx264 @ 0x1d966a0] i16 v,h,dc,p: 52% 19% 19% 11%
    [libx264 @ 0x1d966a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 17% 13%  4%  6%  9%  5%  8%  6%
    [libx264 @ 0x1d966a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 18% 14%  5%  8% 10%  6%  6%  3%
    [libx264 @ 0x1d966a0] i8c dc,h,v,p: 55% 17% 24%  4%
    [libx264 @ 0x1d966a0] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0x1d966a0] ref P L0: 82.5% 13.2%  4.0%  0.3%
    [libx264 @ 0x1d966a0] ref B L0: 60.2% 39.2%  0.6%
    [libx264 @ 0x1d966a0] ref B L1: 98.5%  1.5%
    [libx264 @ 0x1d966a0] kb/s:4327.77
    
  • Building x264 on a Mac for android “No working C compiler found”

    20 novembre 2015, par LostPuppy

    I am trying to build x264 and eventually use it to build ffmpeg the following is my script:

    #!/bin/bash
    
    NDK="/Users/account/Documents/FFmpeg/android-ndk-r10e"
    TOOL_DIR_ARM="/Users/account/Documents/FFmpeg/android-ndk-r10e/sources/ffmpeg-2.8.2/my-android-toolchain"
    SYSROOT=$NDK/platforms/platforms/android-21/arch-arm
    echo "removing tool chain directory if it exists"
    rm -r $TOOL_DIR_ARM
    
    $NDK/build/tools/make-standalone-toolchain.sh \
        --platform=android-21 \
        --arch=arm \
        --install-dir=$TOOL_DIR_ARM \
        --toolchain=arm-linux-androideabi-clang3.6\
        --llvm-version=3.6 \
        --system=darwin-x86_64
    
    if [ -d $SYSROOT ]; then
        echo "$SYSROOT is a valid directory"
    fi
    
    function build_x264
    {
    cd x264
    
    # another build for phone
    ./configure \
    --cross-prefix=arm-linux-androideabi- \
    --sysroot=$SYSROOT \
    --host=arm-linux \
    --enable-static \
    --enable-pic \
    --disable-cli 
    
    make -j4
    make install
    
    cd ../
    }
    
    
    function build_one
    {
    cd 
    
    # another build for phone
    ./configure \
    --sysroot=$SYSROOT \
    --target-os=linux \
    --arch=arm \
    --cross-prefix=$TOOL_DIR_ARM/bin/arm-linux-androideabi- \
    --cc=$TOOL_DIR_ARM/bin/clang \
    --enable-cross-compile \
    --enable-encoder=mpeg4 \
    --enable-pthreads \
    --enable-gpl \
    --enable-libx264 \
    --enable-pic \
    --extra-cflags='-I/usr/local/include' \
    --extra-ldflags='-L/usr/local/lib'
    
    make clean
    make -j4
    make install
    
    }
    echo "Building x_264 library"
    build_x264
    echo "Building FFmpeg"
    build_one
    

    I get an error saying

    No working C compiler found.
    Makefile:3: config.mak: No such file or directory
    

    The following is the output from the config.log file

    checking for -mdynamic-no-pic... yes
    checking for -arch x86_64... yes
    x264 configure script
    
    checking whether gcc works... yes
    checking whether gcc supports for( int i = 0; i < 9; i++ ); with -std=gnu99... yes
    checking for -mpreferred-stack-boundary=5... no
    Failed commandline was:
    --------------------------------------------------
    gcc conftest.c -m64 -Qunused-arguments -Wall -I. -I$(SRCPATH) -mdynamic-no-pic -arch x86_64 -std=gnu99  -mpreferred-stack-boundary=5  -m64  -lm -arch x86_64$
    clang: error: unknown argument: '-mpreferred-stack-boundary=5'
    --------------------------------------------------
    Failed program was:
    --------------------------------------------------
    int main (void) {  return 0; }
    --------------------------------------------------
    checking whether yasm supports vpmovzxwd ymm0, xmm0... yes
    

    Solutions that I tried:

    I made sure I have a working GCC

    I have the update to date version of clang

    I have the update to date version of LLVM

  • FFMPEG-jpg sequence to H.264 generate best result

    18 octobre 2015, par Ziki

    I have a jpg sequence which I need to convert to mp4, and I need to get the best result.

    As I understood, I need to supply the 'ffmpeg' cmdln the following: bitrate, minrate, maxrate and bufsize.

    The only thing that I found about calculating the above params, is if I have the final output file size. But considering I want the best quality, I don't know the final output file size, and I don't care what it will be.

    Of course I have the framerate and the total frames.

    Here's my ffmpeg cmdln:

    ffmpeg 
    -r 24 
    -start_number 0 
    -i "C:\pathToSequence\%06d.jpg" 
    -c copy 
    -vframes 792 
    -threads 16 
    -pix_fmt yuv420p 
    -c:v libx264 
    "C:\pathToOutput\result.mp4"
    

    The total size of the sequence is 128MB, 792 frames, 24 framerate, resolution 1280x720.

    Until now I used to add the following to the ffmpeg cmdln:

    -b:v 10000k -minrate 10000k -maxrate 10000k -bufsize 10000k
    

    And if it was 1080p:

    -b:v 20000k -minrate 20000k -maxrate 20000k -bufsize 20000k
    

    And I figured that if I put the max value that ffmpeg can handle (2147480) it will generate almost the same result as the above. But I think it's a bad approach(correct me if I'm wrong).

    So if I need to get the best result, how do I calculate it(or I can simply put the max value)?

    Also I would like if you have another helpful flags to add to make the best final result.

    --EDIT--

    Here's the updated command:

    O:\tools\ffmpeg -framerate 24 -start_number 0 -i "C:\share\localProcess\test\%05d.jpg" -vframes 54 -pix_fmt yuv420p -c:v libx264 -preset veryslow -qp 1 "C:\share\localProcess\result\result.mp4"
    

    And this is the ouptout:

    ffmpeg version N-72383-g7206b94 Copyright (c) 2000-2015 the FFmpeg developers
      built with gcc 4.9.2 (GCC)
      configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
      libavutil      54. 26.100 / 54. 26.100
      libavcodec     56. 41.100 / 56. 41.100
      libavformat    56. 33.101 / 56. 33.101
      libavdevice    56.  4.100 / 56.  4.100
      libavfilter     5. 16.101 /  5. 16.101
      libswscale      3.  1.101 /  3.  1.101
      libswresample   1.  1.100 /  1.  1.100
      libpostproc    53.  3.100 / 53.  3.100
    Input #0, image2, from 'C:\share\localProcess\test\%05d.jpg':
      Duration: 00:00:02.25, start: 0.000000, bitrate: N/A
        Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 72:72 DAR 16:9], 24 fps, 24 tbr, 24 tbn, 24 tbc
    [swscaler @ 0000000004d6bf60] deprecated pixel format used, make sure you did set range correctly
    [libx264 @ 0000000004d7a9e0] using SAR=1/1
    [libx264 @ 0000000004d7a9e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0000000004d7a9e0] profile High, level 5.0
    [libx264 @ 0000000004d7a9e0] 264 - core 146 r2538 121396c - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=16 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=9 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=8 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=1 ip_ratio=1.40 pb_ratio=1.30 aq=0
    Output #0, mp4, to 'C:\share\localProcess\result\result.mp4':
      Metadata:
        encoder         : Lavf56.33.101
        Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 24 fps, 12288 tbn, 24 tbc
        Metadata:
          encoder         : Lavc56.41.100 libx264
    Stream mapping:
      Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    frame=   54 fps= 38 q=-1.0 Lsize=     542kB time=00:00:02.16 bitrate=2050.0kbits/s
    video:541kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.251171%
    [libx264 @ 0000000004d7a9e0] frame I:1     Avg QP: 0.00  size: 23629
    [libx264 @ 0000000004d7a9e0] frame P:22    Avg QP: 1.00  size: 16146
    [libx264 @ 0000000004d7a9e0] frame B:31    Avg QP: 2.81  size:  5623
    [libx264 @ 0000000004d7a9e0] consecutive B-frames: 16.7% 29.6% 16.7%  0.0%  9.3%  0.0% 13.0% 14.8%  0.0%
    [libx264 @ 0000000004d7a9e0] mb I  I16..4: 74.9% 20.2%  4.9%
    [libx264 @ 0000000004d7a9e0] mb P  I16..4:  0.3%  0.1%  1.2%  P16..4:  2.7%  0.4%  0.8%  0.2%  0.1%    skip:94.2%
    [libx264 @ 0000000004d7a9e0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  3.0%  0.4%  0.5%  direct: 0.3%  skip:95.7%  L0:56.0% L1:40.5% BI: 3.5%
    [libx264 @ 0000000004d7a9e0] 8x8 transform intra:16.5% inter:18.4%
    [libx264 @ 0000000004d7a9e0] direct mvs  spatial:54.8% temporal:45.2%
    [libx264 @ 0000000004d7a9e0] coded y,uvDC,uvAC intra: 33.9% 49.8% 49.5% inter: 1.3% 2.9% 2.9%
    [libx264 @ 0000000004d7a9e0] i16 v,h,dc,p: 79% 13%  4%  4%
    [libx264 @ 0000000004d7a9e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 22% 48%  2%  4%  6%  3%  1%  2%
    [libx264 @ 0000000004d7a9e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 13% 43%  5%  6%  4%  5%  5%  6%
    [libx264 @ 0000000004d7a9e0] i8c dc,h,v,p: 78% 12%  7%  3%
    [libx264 @ 0000000004d7a9e0] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0000000004d7a9e0] ref P L0: 65.7%  2.4%  8.9%  4.5%  2.3%  3.0%  2.8%  3.9%  3.5%  0.8%  0.3%  0.5%  0.3%  0.5%  0.2%  0.3%
    [libx264 @ 0000000004d7a9e0] ref B L0: 76.9% 12.0%  3.4%  0.7%  3.6%  0.5%  2.1%  0.4%  0.1%  0.0%  0.1%  0.0%  0.1%  0.1%
    [libx264 @ 0000000004d7a9e0] ref B L1: 98.2%  1.8%
    [libx264 @ 0000000004d7a9e0] kb/s:1966.80
    

    Link to download JPG sequence.

    Link to download the result.

  • Is there any good documentation of **x264** internals ?

    18 octobre 2015, par firoozg

    I want a to study about x264 internals?

    Is there any good resource about the algorithms and code structure?

    Or at least a resource to study about the intra prediction algorithms used in x264.

  • What does ' wpredp' parameter do in x264 (or FFmpeg) ?

    9 octobre 2015, par Alexandr

    I don't understand what 'wpredp' do? I've tried to find the description of 'wpredp' parameter but without success. Can somebody explain what it do?