Newest 'libx264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • 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 ?

  • Why does FFMPEG insert frames in the beginning of a recoded video ?

    18 janvier 2016, par Filipe Costa

    I have a video with 300 frames. After type the following command, the resultant video has 302 frames.

    ffmpeg -y -i input.avi -vcodec libx264 -qscale 22 -qmin 22 -qmax 22 -an -g 13 output.avi

    The parameters of "input.avi" are: -vcodec libx264 -qscale 26 -qmin 26 -qmax 26 -an -g 8

    I did check the video and the first 3 frames are exactly the same.

    Why does it happen? Basically, I am trying to compare both videos "framewise" without any kind of temporal alignment.