Newest 'libx264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Compiling FFmpeg : libx264 not found

    17 mars 2016, par SaidTagnit

    I 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:

    Tutorial1

    Tutorial2

    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
    
  • How to resolve "ERROR : libx264 not found" ?

    16 mars 2016, par user3665376

    I needed to install ffmpeg with libx264 support for enabling H.264 encoding . I installed libx264 successfully using the below script with toolchains available in android-ndk-r9d .

     #!/bin/bash
     NDK=~/android-ndk-r9d
     SYSROOT=$NDK/platforms/android-8/arch-arm/
     TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64
     function build_one
     {
     ./configure \
     --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
     --sysroot="$SYSROOT" \
     --host=arm-linux \
     --enable-pic \
     --enable-shared \
     --disable-cli
     make clean
     make
     make install
     }
     build_one 
    

    Now I wanted to build ffmpeg with libx264 support . I used the below script with --enable-libx264 , --enable-nonfree , --enable-gpl options as in the below script .

    #!/bin/bash
    NDK=~/android-ndk-r9d
    SYSROOT=$NDK/platforms/android-8/arch-arm/
    TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64
    function build_one
    {
    ./configure \
    --prefix=$PREFIX \
    --enable-shared \
    --enable-nonfree \
    --enable-gpl \
    --enable-libx264 \
    --disable-doc \
    --disable-ffmpeg \
    --disable-ffplay \
    --disable-ffprobe \
    --disable-ffserver \
    --disable-avdevice \
    --disable-doc \
    --disable-symver \
    --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
    --target-os=linux \
    --arch=arm \
    --enable-cross-compile \
    --sysroot=$SYSROOT \
    --extra-cflags="-Os -fpic $ADDI_CFLAGS" \
    --extra-ldflags="$ADDI_LDFLAGS" \
    $ADDITIONAL_CONFIGURE_FLAG
    make clean
    make
    make install
    }
    CPU=arm
    PREFIX=$(pwd)/android/$CPU
    ADDI_CFLAGS="-marm"
    build_one
    

    But when I run the script I'm getting error "ERROR: libx264 not found" .

    I suppose ffmpeg is not able to figure out the installed location of libx264 . After libx264 installation I have libx264.so file in /usr/local/lib executable at /usr/local/bin and header files at /usr/local/include directories .

    What all changes do I need to make to the ffmpeg build script in-order to make it detect libx264?

    Note : I am using Ubuntu 12.04(64 bit) for cross compiling .

  • x264_encoder_encode() how to watch function body ?

    25 février 2016, par ULTRANj

    I'm working with VLC player source code (GitHub link) and I need to study how the function x264_encoder_encode() in codec h.264 works. This function is used in file x264.c but i couldn't find it's body and decloration. Where can I see it?

  • ffmpeg weird x264 encoding behavior

    1er février 2016, par JMor

    I have a captured a 720x480 video with a display aspect ratio of 16:9 which I want to crop, resize and pad, but just the x264 encoding command is giving me a headache.

    (Screenshot of input.m2v) Here is my command:

    ffmpeg -ss 1861 -i input.m2v -c:v libx264 -profile:v main -preset:v medium -level 3.1 -x264opts crf=21.228 -t 60 -y -f mp4 output.mp4
    

    And here is the ffmpeg output:

    (Screen shot of output.mp4)

    Input #0, mpegvideo, from 'input.m2v':
      Duration: N/A, bitrate: N/A
        Stream #0:0: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR 32:27 DAR 1
    6:9], max. 6605 kb/s, 31.02 fps, 59.94 tbr, 1200k tbn, 59.94 tbc
    [libx264 @ 02ba84c0] using SAR=32/27
    [libx264 @ 02ba84c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    [libx264 @ 02ba84c0] profile Main, level 3.1
    [libx264 @ 02ba84c0] 264 - core 144 r2525 40bb568 - H.264/MPEG-4 AVC codec - Cop
    yleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
    lock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
    e_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chro
    ma_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 scene
    cut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=21.2 qcomp=0.60 qpmin
    =0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'output.mp4':
      Metadata:
        encoder         : Lavf56.19.100
        Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x48
    0 [SAR 32:27 DAR 16:9], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc
        Metadata:
          encoder         : Lavc56.21.102 libx264
    Stream mapping:
      Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
    

    The output size is 720x480, displayed as 853x480, as expected. But it looks like the frame has been vertically scaled by a factor of 1.18 and then cropped to a height of 480, so that I am losing the top and bottom of the frame. In fact, the behavior is equivalent to:

    -vf "scale=720:569,crop=720:480:0:0"
    

    Although I assume the aspect ratio plays a part here (I think the 1.18 factor is really (16/9)/(720/480)) I am surprised that ffmpeg would do that out of the blue. May be someone more knowledgeable than me could explain it?

  • FFmpeg on android with libX264 and libfreetype

    1er février 2016, par LostPuppy

    I previously had a ffmpeg build with just the x264 library and now I have re-complied ffmpeg with x264 and libfreetype. I used the guardian project and used the following script

    #!/bin/bash
    
    . abi_settings.sh $1 $2 $3
    
    pushd ffmpeg
    
    case $1 in
      armeabi-v7a | armeabi-v7a-neon)
        CPU='cortex-a8'
      ;;
      x86)
        CPU='i686'
      ;;
    esac
    
    make clean
    
    ./configure \
    --target-os=linux \
    --arch=arm \
    --cross-prefix="$CROSS_PREFIX" \
    --cpu="$CPU" \
    --sysroot="$NDK_SYSROOT" \
    --enable-encoder=mpeg4 \
    --enable-pic \
    --enable-libx264 \
    --enable-libfreetype \
    --enable-pthreads \
    --enable-version3 \
    --enable-gpl \
    --disable-doc \
    --disable-shared \
    --enable-static \
    --pkg-config="${2}/ffmpeg-pkg-config" \
    --prefix="${2}/build/${1}" \
    --extra-cflags='-I/usr/local/include' \
    --extra-ldflags='-L/usr/local/lib'\
    
    make -j${NUMBER_OF_CORES} && make install || exit 1
    
    popd
    

    I am observing that the new build is taking almost double the time to process videos on android device when compared with previous versions.

    Any suggestions on speeding up the binary ?