Newest 'libx264' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Apple HLS h.264 encoding

    24 novembre 2016, par user3753682

    I know thta this is a legal question, but since this involves ffmpeg and libx264 i am going here

    For using Apple's HLS or Mpeg Dash video streaming technology, should we pay any royalties to MPEGLA?

    We use ffmpeg with libx264 to generate the content. ffmpeg and libx264 are free softwares but h.264 and Dash are patented technologies

  • Streamplayers can't play stream when ffmpeg using x264 codec

    12 novembre 2016, par iCheater Retaehci

    When i start process ffmpeg and use -c:v libx264 and -x264opts users, who open my stream can't play it, but after i restart ffmpeg - they can see stream. When i turn off -c:v libx264 and -x264opts users can see stream without any problems.

    sudo ffmpeg \
        -f video4linux2 \
        -i /dev/video0 \
        -filter:v "crop=250:480:195:0" \
        -intra-refresh 1 \
        -pix_fmt yuv420p \
        -framerate 30  \
        -c:v libx264 \
        -preset ultrafast \
        -threads 8 \
        -tune zerolatency  \
        -analyzeduration 0 \
        -an \
        -s 640x480 \
        -probesize 32 \
        -x264opts crf=20:vbv-maxrate=12000:vbv-bufsize=100:intra-refresh=1:slice-max-size=1500:keyint=30:ref=1 \
        -f flv rtmp://xx.xx.xx.xx/webcam
    

    log

    cheater@cheater-vm:~$ sh webcam.sh 
    ffmpeg version 3.0.2-1ubuntu3 Copyright (c) 2000-2016 the FFmpeg developers
      built with gcc 6.1.1 (Ubuntu 6.1.1-11ubuntu12) 20160805
      configuration: --prefix=/usr --extra-version=1ubuntu3 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-chromaprint --enable-libx264
      libavutil      55. 17.103 / 55. 17.103
      libavcodec     57. 24.102 / 57. 24.102
      libavformat    57. 25.100 / 57. 25.100
      libavdevice    57.  0.101 / 57.  0.101
      libavfilter     6. 31.100 /  6. 31.100
      libavresample   3.  0.  0 /  3.  0.  0
      libswscale      4.  0.100 /  4.  0.100
      libswresample   2.  0.101 /  2.  0.101
      libpostproc    54.  0.100 / 54.  0.100
    Input #0, video4linux2,v4l2, from '/dev/video0':
      Duration: N/A, start: 12237.477963, bitrate: 184320 kb/s
        Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 800x600, 184320 kb/s, 24 fps, 24 tbr, 1000k tbn, 1000k tbc
    [libx264 @ 0x55f9d286a280] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
    [libx264 @ 0x55f9d286a280] VBV buffer size cannot be smaller than one 
    frame, using 500 kbit
    [libx264 @ 0x55f9d286a280] profile Constrained Baseline, level 3.1
    [libx264 @ 0x55f9d286a280] 264 - core 148 r2699 a5e06b9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=8 lookahead_threads=8 sliced_threads=1 slices=8 slice_max_size=1500 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=30 keyint_min=3 scenecut=0 intra_refresh=1 rc_lookahead=0 rc=crf mbtree=0 crf=20.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=12000 vbv_bufsize=500 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=0
    Output #0, flv, to 'rtmp://xx.xx.xx.xx/webcam':
      Metadata:
        encoder         : Lavf57.25.100
        Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 800x600, q=-1--1, 24 fps, 1k tbn, 24 tbc
        Metadata:
          encoder         : Lavc57.24.102 libx264
        Side data:
          unknown side data type 10 (24 bytes)
    Stream mapping:
      Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    [swscaler @ 0x55f9d28972a0] Warning: data is not aligned! This can lead to a speedloss
    
    frame=   22 fps=0.0 q=19.0 size=     339kB time=00:00:00.91 bitrate=3032.9kbits/
    frame=   30 fps= 30 q=19.0 size=     463kB time=00:00:01.41 bitrate=2674.7kbits/
    frame=   38 fps= 25 q=20.0 size=     577kB time=00:00:01.91 bitrate=2465.8kbits/
    frame=   45 fps= 22 q=21.0 size=     700kB time=00:00:02.41 bitrate=2372.3kbits/
    frame=   53 fps= 21 q=21.0 size=     835kB time=00:00:02.91 bitrate=2344.7kbits/
    frame=   60 fps= 20 q=20.0 size=     945kB time=00:00:03.41 bitrate=2266.3kbits/
    frame=   68 fps= 19 q=21.0 size=    1118kB time=00:00:03.91 bitrate=2339.4kbits/
    frame=   76 fps= 19 q=20.0 size=    1270kB time=00:00:04.45 bitrate=2332.5kbits/
    frame=   83 fps= 18 q=20.0 size=    1385kB time=00:00:04.91 bitrate=2308.2kbits/
    frame=   91 fps= 18 q=20.0 size=    1509kB time=00:00:05.45 bitrate=2263.9kbits/
    frame=   98 fps= 18 q=19.0 size=    1611kB time=00:00:05.91 bitrate=2230.5kbits/
    frame=  106 fps= 17 q=19.0 size=    1735kB time=00:00:06.45 bitrate=2200.1kbits/
    frame=  113 fps= 17 q=20.0 size=    1829kB time=00:00:06.91 bitrate=2165.9kbits/
    frame=  121 fps= 17 q=20.0 size=    1940kB time=00:00:07.45 bitrate=2131.0kbits/
    frame=  129 fps= 17 q=21.0 size=    2087kB time=00:00:08.00 bitrate=2137.4kbits/
    frame=  136 fps= 17 q=21.0 size=    2213kB time=00:00:08.45 bitrate=2143.6kbits/
    frame=  144 fps= 17 q=21.0 size=    2360kB time=00:00:09.00 bitrate=2148.0kbits/
    frame=  151 fps= 17 q=20.0 size=    2487kB time=00:00:09.45 bitrate=2153.8kbits/
    frame=  159 fps= 17 q=21.0 size=    2639kB time=00:00:10.00 bitrate=2161.5kbits/
    frame=  166 fps= 16 q=21.0 size=    2755kB time=00:00:10.45 bitrate=2158.2kbits/
    frame=  174 fps= 16 q=21.0 size=    2898kB time=00:00:11.00 bitrate=2158.1kbits/
    frame=  181 fps= 16 q=21.0 size=    3027kB time=00:00:11.45 bitrate=2164.2kbits/
    frame=  189 fps= 16 q=21.0 size=    3161kB time=00:00:12.00 bitrate=2157.8kbits/
    frame=  197 fps= 16 q=22.0 size=    3313kB time=00:00:12.54 bitrate=2164.4kbits/
    frame=  204 fps= 16 q=21.0 size=    3453kB time=00:00:13.00 bitrate=2175.7kbits/
    frame=  212 fps= 16 q=20.0 size=    3586kB time=00:00:13.54 bitrate=2169.6kbits/
    frame=  219 fps= 16 q=19.0 size=    3699kB time=00:00:14.00 bitrate=2164.2kbits/
    frame=  227 fps= 16 q=20.0 size=    3819kB time=00:00:14.54 bitrate=2151.6kbits/
    frame=  234 fps= 16 q=20.0 size=    3919kB time=00:00:15.00 bitrate=2140.3kbits/
    
    [flv @ 0x55f9d2869000] Failed to update header with correct duration.
    [flv @ 0x55f9d2869000] Failed to update header with correct filesize.
    
    frame=  236 fps= 16 q=20.0 Lsize=    3947kB time=00:00:15.12 bitrate=2137.7kbits/s speed=1.02x    
    video:3938kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.208510%
    [libx264 @ 0x55f9d286a280] frame I:1     Avg QP:19.08  size: 45311
    [libx264 @ 0x55f9d286a280] frame P:235   Avg QP:20.24  size: 16965
    [libx264 @ 0x55f9d286a280] mb I  I16..4: 100.0%  0.0%  0.0%
    [libx264 @ 0x55f9d286a280] mb P  I16..4: 20.3%  0.0%  0.0%  P16..4: 59.4%  0.0%  0.0%  0.0% 0.0%    skip:20.3%
    [libx264 @ 0x55f9d286a280] coded y,uvDC,uvAC intra: 29.8% 61.6% 29.4% inter: 38.0% 56.2% 13.1%
    [libx264 @ 0x55f9d286a280] i16 v,h,dc,p: 16% 51% 23% 10%
    [libx264 @ 0x55f9d286a280] i8c dc,h,v,p: 56% 30%  9%  4%
    [libx264 @ 0x55f9d286a280] kb/s:3280.43
    Exiting normally, received signal 2.
    
  • Build latest version of FFMPEG with libx264 Android

    12 novembre 2016, par Biraj Zalavadia

    I was able to Build FFMPEG with libx264 Android successfully and was working well before 2 months.

    I uses halfninja for building.

    Today I take latest source of ffmpeg and libX264 from here.

    git clone git://git.videolan.org/x264.git
    
    git clone git://git.videolan.org/ffmpeg.git
    

    And try to rebuild whole project. But now it throws following errors.

     ffmpeg.c:2406: error: undefined reference to 'hwaccels'
     ffmpeg.c:3390: error: undefined reference to 'qp_hist'
     ffmpeg.c:3390: error: undefined reference to 'do_hex_dump'
     ffmpeg.c:3390: error: undefined reference to 'do_pkt_dump'
     ffmpeg.c:576: error: undefined reference to 'do_benchmark_all'
     ffmpeg.c:657: error: undefined reference to 'audio_sync_method'
     ffmpeg.c:1222: error: undefined reference to 'vstats_filename'
     ffmpeg.c:972: error: undefined reference to 'frame_drop_threshold'
     ffmpeg.c:1181: error: undefined reference to 'debug_ts'
     ffmpeg.c:2742: error: undefined reference to 'copy_tb'
     ffmpeg.c:2846: error: undefined reference to 'audio_volume'
     ffmpeg.c:2862: error: undefined reference to 'init_simple_filtergraph'
     ffmpeg.c:2863: error: undefined reference to 'configure_filtergraph'
     ffmpeg.c:2923: error: undefined reference to 'video_sync_method'
     ffmpeg.c:2538: error: undefined reference to 'frame_bits_per_raw_sample'
     ffmpeg.c:3258: error: undefined reference to 'sdp_filename'
     ffmpeg.c:2087: error: undefined reference to 'ist_in_filtergraph'
     ffmpeg.c:4069: error: undefined reference to 'ffmpeg_parse_options'
     ffmpeg.c:4074: error: undefined reference to 'show_usage'
     ffmpeg.c:3303: error: undefined reference to 'options'
     ffmpeg.c:3303: error: undefined reference to 'stdin_interaction'
     ffmpeg.c:2553: error: undefined reference to 'exit_on_error'
     ffmpeg.c:2553: error: undefined reference to 'do_pkt_dump'
     ffmpeg.c:2553: error: undefined reference to 'do_hex_dump'
     ffmpeg.c:3727: error: undefined reference to 'copy_ts'
     ffmpeg.c:3727: error: undefined reference to 'dts_delta_threshold'
     ffmpeg.c:268: error: undefined reference to 'dts_error_threshold'
     ffmpeg.c:3976: error: undefined reference to 'print_stats'
     ffmpeg.c:1694: error: undefined reference to 'do_benchmark'
     ffmpeg.c:1694: error: undefined reference to 'max_error_rate'
    

    Please help me out to resolve this.

    Please look at my script.

    build_android.sh

    #!/bin/bash
    #
    # build_android.sh
    # Copyright (c) 2012 Jacek Marchwicki
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #     http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    
    export NDK=/home/tasol/DEVELOPMENT/IJOOMER_DEVELOPMENT/NDK/android-ndk-r10d
    
    if [ "$NDK" = "" ]; then
        echo NDK variable not set, exiting
        echo "Use: export NDK=/your/path/to/android-ndk"
        exit 1
    fi
    
    OS=`uname -s | tr '[A-Z]' '[a-z]'`
    function build_x264
    {
        PLATFORM=$NDK/platforms/$PLATFORM_VERSION/arch-$ARCH/
        export PATH=${PATH}:$PREBUILT/bin/
        CROSS_COMPILE=$PREBUILT/bin/$EABIARCH-
        CFLAGS=$OPTIMIZE_CFLAGS
    #CFLAGS=" -I$ARM_INC -fpic -DANDROID -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__  -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID  -Wa,--noexecstack -MMD -MP "
        export CPPFLAGS="$CFLAGS"
        export CFLAGS="$CFLAGS"
        export CXXFLAGS="$CFLAGS"
        export CXX="${CROSS_COMPILE}g++ --sysroot=$PLATFORM"
        export AS="${CROSS_COMPILE}gcc --sysroot=$PLATFORM"
        export CC="${CROSS_COMPILE}gcc --sysroot=$PLATFORM"
        export NM="${CROSS_COMPILE}nm"
        export STRIP="${CROSS_COMPILE}strip"
        export RANLIB="${CROSS_COMPILE}ranlib"
        export AR="${CROSS_COMPILE}ar"
        #export LDFLAGS="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog"
    
        cd x264
        ./configure --disable-asm --prefix=$(pwd)/$PREFIX --host=$ARCH-linux --enable-static $ADDITIONAL_CONFIGURE_FLAG || exit 1
    
        make clean || exit 1
        make -j4 install || exit 1
        cd ..
    }
    
    function build_ffmpeg
    {
        PLATFORM=$NDK/platforms/$PLATFORM_VERSION/arch-$ARCH/
        CC=$PREBUILT/bin/$EABIARCH-gcc
        CROSS_PREFIX=$PREBUILT/bin/$EABIARCH-
        PKG_CONFIG=${CROSS_PREFIX}pkg-config
        if [ ! -f $PKG_CONFIG ];
        then
            cat > $PKG_CONFIG << EOF
    #!/bin/bash
    pkg-config \$*
    EOF
            chmod u+x $PKG_CONFIG
        fi
        NM=$PREBUILT/bin/$EABIARCH-nm
        cd ffmpeg
        export PKG_CONFIG_LIBDIR=$(pwd)/$PREFIX/lib/pkgconfig/
        export PKG_CONFIG_PATH=$(pwd)/$PREFIX/lib/pkgconfig/
        ./configure --target-os=linux \
            --prefix=$PREFIX \
            --enable-cross-compile \
            --extra-libs="-lgcc" \
            --arch=$ARCH \
            --cc=$CC \
            --cross-prefix=$CROSS_PREFIX \
            --nm=$NM \
            --sysroot=$PLATFORM \
            --extra-cflags=" -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums  -fno-strict-aliasing -finline-limit=300 $OPTIMIZE_CFLAGS " \
            --disable-shared \
            --disable-stripping \
            --enable-static \
            --enable-runtime-cpudetect \
            --extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib  -nostdlib -lc -lm -ldl -llog -L$PREFIX/lib" \
            --extra-cflags="-I$PREFIX/include" \
                --enable-gpl \
            --enable-encoder=libx264 \
            --enable-libx264 \
            --enable-parser=mjpeg \
            --enable-demuxer=image2 \
            --enable-hwaccel=h264_vaapi \
            --enable-hwaccel=h264_vaapi \
            --enable-hwaccel=h264_dxva2 \
            --enable-hwaccel=mpeg4_vaapi \
            --enable-demuxer=mov \
            --enable-demuxer=h264 \
            --enable-demuxer=mpegvideo \
            --enable-demuxer=h263 \
            --enable-demuxer=mpegps \
            --enable-demuxer=mjpeg \
            --enable-demuxer=rtsp \
            --enable-demuxer=rtp \
            --enable-demuxer=hls \
            --enable-demuxer=matroska \
            --enable-muxer=rtsp \
            --enable-muxer=mp4 \
            --enable-muxer=mov \
            --enable-muxer=mjpeg \
            --enable-muxer=matroska \
            --enable-protocol=crypto \
            --enable-protocol=jni \
            --enable-protocol=file \
            --disable-network \
                --enable-filter=buffer \
            --enable-filter=buffersink \
            --enable-filter=scale \
            --enable-protocol=rtp \
            --enable-protocol=tcp \
            --enable-protocol=udp \
            --enable-protocol=applehttp \
            --enable-protocol=hls \
            --enable-protocol=http \
            --enable-decoder=xsub \
            --enable-decoder=jacosub \
            --enable-decoder=dvdsub \
            --enable-decoder=dvbsub \
            --enable-decoder=subviewer \
            --enable-decoder=rawvideo \
            --enable-encoder=rawvideo \
            --enable-decoder=mjpeg \
            --enable-encoder=mjpeg \
            --enable-decoder=h263 \
            --enable-decoder=mpeg4 \
            --enable-encoder=mpeg4 \
            --enable-decoder=h264 \
            --enable-encoder=h264 \
            --enable-decoder=aac \
            --enable-encoder=aac \
            --enable-parser=h264 \
            --enable-encoder=mp2 \
            --enable-decoder=mp2 \
            --enable-encoder=libvo_amrwbenc \
            --enable-decoder=amrwb \
            --enable-muxer=mp2 \
            --enable-bsfs \
            --enable-decoders \
            --enable-encoders \
            --enable-parsers \
            --enable-hwaccels \
            --enable-muxers \
            --enable-avformat \
            --enable-avcodec \
            --disable-demuxer=v4l \
            --disable-demuxer=v4l2 \
            --disable-indev=v4l \
            --disable-indev=v4l2 \
            --disable-ffplay \
            --disable-ffmpeg \
            --disable-ffplay \
            --disable-ffprobe \
            --disable-ffserver \
            --enable-nonfree \
            --enable-version3 \
            --enable-memalign-hack \
            --disable-asm \
            $ADDITIONAL_CONFIGURE_FLAG \
            || exit 1
        make clean || exit 1
        make -j4 install || exit 1
    
        cd ..
    }
    
    function build_one {
        cd ffmpeg
        cd ..
    }
    
    #arm v5
    EABIARCH=arm-linux-androideabi
    ARCH=arm
    CPU=armv5
    OPTIMIZE_CFLAGS="-marm -march=$CPU"
    PREFIX=../ffmpeg-build/armeabi
    OUT_LIBRARY=$PREFIX/libffmpeg.so
    ADDITIONAL_CONFIGURE_FLAG=
    SONAME=libffmpeg.so
    PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/$OS-x86_64
    #PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/$OS-x86
    PLATFORM_VERSION=android-5
    build_x264
    build_ffmpeg
    build_one
    
    
    #arm v7vfpv3
    #EABIARCH=arm-linux-androideabi
    #ARCH=arm
    #CPU=armv7-a
    #OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU "
    #PREFIX=../ffmpeg-build/armeabi-v7a
    #OUT_LIBRARY=$PREFIX/libffmpeg.so
    #ADDITIONAL_CONFIGURE_FLAG=
    #SONAME=libffmpeg.so
    #PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/$OS-x86_64
    #PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/$OS-x86
    #PLATFORM_VERSION=android-5
    #build_x264
    #build_ffmpeg
    #build_one
    
    #arm v7 + neon (neon also include vfpv3-32)
    EABIARCH=arm-linux-androideabi
    ARCH=arm
    CPU=armv7-a
    OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=neon -marm -march=$CPU -mtune=cortex-a8 -mthumb -D__thumb__ "
    PREFIX=../ffmpeg-build/armeabi-v7a
    #PREFIX=../ffmpeg-build/armeabi-v7a-neon
    OUT_LIBRARY=../ffmpeg-build/armeabi-v7a/libffmpeg-neon.so
    ADDITIONAL_CONFIGURE_FLAG=--enable-neon
    SONAME=libffmpeg-neon.so
    PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/$OS-x86_64
    #PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/$OS-x86
    PLATFORM_VERSION=android-9
    build_x264
    build_ffmpeg
    build_one
    
    #x86
    EABIARCH=i686-linux-android
    ARCH=x86
    OPTIMIZE_CFLAGS="-m32"
    PREFIX=../ffmpeg-build/x86
    OUT_LIBRARY=$PREFIX/libffmpeg.so
    ADDITIONAL_CONFIGURE_FLAG=--disable-asm
    SONAME=libffmpeg.so
    PREBUILT=$NDK/toolchains/x86-4.8/prebuilt/$OS-x86_64
    #PREBUILT=$NDK/toolchains/x86-4.6/prebuilt/$OS-x86
    PLATFORM_VERSION=android-9
    build_x264
    build_ffmpeg
    build_one
    
    #mips
    EABIARCH=mipsel-linux-android
    ARCH=mips
    OPTIMIZE_CFLAGS="-EL -march=mips32 -mips32 -mhard-float"
    PREFIX=../ffmpeg-build/mips
    OUT_LIBRARY=$PREFIX/libffmpeg.so
    ADDITIONAL_CONFIGURE_FLAG=""
    SONAME=libffmpeg.so
    PREBUILT=$NDK/toolchains/mipsel-linux-android-4.8/prebuilt/$OS-x86_64
    #PREBUILT=$NDK/toolchains/mipsel-linux-android-4.6/prebuilt/$OS-x86
    PLATFORM_VERSION=android-9
    build_x264
    build_ffmpeg
    build_one
    

    build_all.sh

    #!/bin/bash
    #
    # build_all.sh
    
    export NDK=/home/tasol/DEVELOPMENT/IJOOMER_DEVELOPMENT/NDK/android-ndk-r10d
    sudo ./build_android.sh
    $NDK/ndk-build
    
    echo "Done Dona Done!!!"
    

    Android.mk

    LOCAL_PATH := $(call my-dir)
    
    include $(CLEAR_VARS)
    LOCAL_MODULE  := videokit
    # These need to be in the right order
    FFMPEG_LIBS := $(addprefix ffmpeg-build/$(TARGET_ARCH_ABI)/lib/, \
     libavdevice.a \
     libavformat.a \
     libavfilter.a \
     libavcodec.a \
     libswscale.a \
     libavutil.a \
     libswresample.a \
     libpostproc.a )
    # ffmpeg uses its own deprecated functions liberally, so turn off that annoying noise
    LOCAL_CFLAGS += -g -Iffmpeg -Ivideokit -Wno-deprecated-declarations 
    LOCAL_LDLIBS += -llog -lz $(FFMPEG_LIBS) ffmpeg-build/$(TARGET_ARCH_ABI)/lib/libx264.a
    LOCAL_SRC_FILES := videokit/uk_co_halfninja_videokit_Videokit.c videokit/ffmpeg.c videokit/cmdutils.c
    include $(BUILD_SHARED_LIBRARY)
    
    
    include $(CLEAR_VARS)
    LOCAL_MODULE  := ffmpeg
    FFMPEG_LIBS := $(addprefix ffmpeg-build/$(TARGET_ARCH_ABI)/lib/, \
     libavdevice.a \
     libavformat.a \
     libavfilter.a \
     libavcodec.a \
     libswscale.a \
     libavutil.a \
     libswresample.a \
     libpostproc.a )
    LOCAL_CFLAGS += -g -Iffmpeg -Ivideokit -Wno-deprecated-declarations 
    LOCAL_LDLIBS += -llog -lz $(FFMPEG_LIBS) ffmpeg-build/$(TARGET_ARCH_ABI)/lib/libx264.a
    LOCAL_SRC_FILES := ffmpeg/ffmpeg.c ffmpeg/cmdutils.c
    include $(BUILD_EXECUTABLE)
    

    Application.mk

    APP_ABI := armeabi,armeabi-v7a,x86,mips
    APP_PLATFORM := android-10
    APP_STL := gnustl_static
    

    UPDATE

    Finally Got success

  • Build latest version of FFMPEG with libx264 Android

    12 novembre 2016, par Biraj Zalavadia

    I was able to Build FFMPEG with libx264 Android successfully and was working well before 2 months.

    I uses halfninja for building.

    Today I take latest source of ffmpeg and libX264 from here.

    git clone git://git.videolan.org/x264.git
    
    git clone git://git.videolan.org/ffmpeg.git
    

    And try to rebuild whole project. But now it throws following errors.

     ffmpeg.c:2406: error: undefined reference to 'hwaccels'
     ffmpeg.c:3390: error: undefined reference to 'qp_hist'
     ffmpeg.c:3390: error: undefined reference to 'do_hex_dump'
     ffmpeg.c:3390: error: undefined reference to 'do_pkt_dump'
     ffmpeg.c:576: error: undefined reference to 'do_benchmark_all'
     ffmpeg.c:657: error: undefined reference to 'audio_sync_method'
     ffmpeg.c:1222: error: undefined reference to 'vstats_filename'
     ffmpeg.c:972: error: undefined reference to 'frame_drop_threshold'
     ffmpeg.c:1181: error: undefined reference to 'debug_ts'
     ffmpeg.c:2742: error: undefined reference to 'copy_tb'
     ffmpeg.c:2846: error: undefined reference to 'audio_volume'
     ffmpeg.c:2862: error: undefined reference to 'init_simple_filtergraph'
     ffmpeg.c:2863: error: undefined reference to 'configure_filtergraph'
     ffmpeg.c:2923: error: undefined reference to 'video_sync_method'
     ffmpeg.c:2538: error: undefined reference to 'frame_bits_per_raw_sample'
     ffmpeg.c:3258: error: undefined reference to 'sdp_filename'
     ffmpeg.c:2087: error: undefined reference to 'ist_in_filtergraph'
     ffmpeg.c:4069: error: undefined reference to 'ffmpeg_parse_options'
     ffmpeg.c:4074: error: undefined reference to 'show_usage'
     ffmpeg.c:3303: error: undefined reference to 'options'
     ffmpeg.c:3303: error: undefined reference to 'stdin_interaction'
     ffmpeg.c:2553: error: undefined reference to 'exit_on_error'
     ffmpeg.c:2553: error: undefined reference to 'do_pkt_dump'
     ffmpeg.c:2553: error: undefined reference to 'do_hex_dump'
     ffmpeg.c:3727: error: undefined reference to 'copy_ts'
     ffmpeg.c:3727: error: undefined reference to 'dts_delta_threshold'
     ffmpeg.c:268: error: undefined reference to 'dts_error_threshold'
     ffmpeg.c:3976: error: undefined reference to 'print_stats'
     ffmpeg.c:1694: error: undefined reference to 'do_benchmark'
     ffmpeg.c:1694: error: undefined reference to 'max_error_rate'
    

    Please help me out to resolve this.

    Please look at my script.

    build_android.sh

    #!/bin/bash
    #
    # build_android.sh
    # Copyright (c) 2012 Jacek Marchwicki
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #     http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    
    export NDK=/home/tasol/DEVELOPMENT/IJOOMER_DEVELOPMENT/NDK/android-ndk-r10d
    
    if [ "$NDK" = "" ]; then
        echo NDK variable not set, exiting
        echo "Use: export NDK=/your/path/to/android-ndk"
        exit 1
    fi
    
    OS=`uname -s | tr '[A-Z]' '[a-z]'`
    function build_x264
    {
        PLATFORM=$NDK/platforms/$PLATFORM_VERSION/arch-$ARCH/
        export PATH=${PATH}:$PREBUILT/bin/
        CROSS_COMPILE=$PREBUILT/bin/$EABIARCH-
        CFLAGS=$OPTIMIZE_CFLAGS
    #CFLAGS=" -I$ARM_INC -fpic -DANDROID -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__  -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID  -Wa,--noexecstack -MMD -MP "
        export CPPFLAGS="$CFLAGS"
        export CFLAGS="$CFLAGS"
        export CXXFLAGS="$CFLAGS"
        export CXX="${CROSS_COMPILE}g++ --sysroot=$PLATFORM"
        export AS="${CROSS_COMPILE}gcc --sysroot=$PLATFORM"
        export CC="${CROSS_COMPILE}gcc --sysroot=$PLATFORM"
        export NM="${CROSS_COMPILE}nm"
        export STRIP="${CROSS_COMPILE}strip"
        export RANLIB="${CROSS_COMPILE}ranlib"
        export AR="${CROSS_COMPILE}ar"
        #export LDFLAGS="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog"
    
        cd x264
        ./configure --disable-asm --prefix=$(pwd)/$PREFIX --host=$ARCH-linux --enable-static $ADDITIONAL_CONFIGURE_FLAG || exit 1
    
        make clean || exit 1
        make -j4 install || exit 1
        cd ..
    }
    
    function build_ffmpeg
    {
        PLATFORM=$NDK/platforms/$PLATFORM_VERSION/arch-$ARCH/
        CC=$PREBUILT/bin/$EABIARCH-gcc
        CROSS_PREFIX=$PREBUILT/bin/$EABIARCH-
        PKG_CONFIG=${CROSS_PREFIX}pkg-config
        if [ ! -f $PKG_CONFIG ];
        then
            cat > $PKG_CONFIG << EOF
    #!/bin/bash
    pkg-config \$*
    EOF
            chmod u+x $PKG_CONFIG
        fi
        NM=$PREBUILT/bin/$EABIARCH-nm
        cd ffmpeg
        export PKG_CONFIG_LIBDIR=$(pwd)/$PREFIX/lib/pkgconfig/
        export PKG_CONFIG_PATH=$(pwd)/$PREFIX/lib/pkgconfig/
        ./configure --target-os=linux \
            --prefix=$PREFIX \
            --enable-cross-compile \
            --extra-libs="-lgcc" \
            --arch=$ARCH \
            --cc=$CC \
            --cross-prefix=$CROSS_PREFIX \
            --nm=$NM \
            --sysroot=$PLATFORM \
            --extra-cflags=" -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums  -fno-strict-aliasing -finline-limit=300 $OPTIMIZE_CFLAGS " \
            --disable-shared \
            --disable-stripping \
            --enable-static \
            --enable-runtime-cpudetect \
            --extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib  -nostdlib -lc -lm -ldl -llog -L$PREFIX/lib" \
            --extra-cflags="-I$PREFIX/include" \
                --enable-gpl \
            --enable-encoder=libx264 \
            --enable-libx264 \
            --enable-parser=mjpeg \
            --enable-demuxer=image2 \
            --enable-hwaccel=h264_vaapi \
            --enable-hwaccel=h264_vaapi \
            --enable-hwaccel=h264_dxva2 \
            --enable-hwaccel=mpeg4_vaapi \
            --enable-demuxer=mov \
            --enable-demuxer=h264 \
            --enable-demuxer=mpegvideo \
            --enable-demuxer=h263 \
            --enable-demuxer=mpegps \
            --enable-demuxer=mjpeg \
            --enable-demuxer=rtsp \
            --enable-demuxer=rtp \
            --enable-demuxer=hls \
            --enable-demuxer=matroska \
            --enable-muxer=rtsp \
            --enable-muxer=mp4 \
            --enable-muxer=mov \
            --enable-muxer=mjpeg \
            --enable-muxer=matroska \
            --enable-protocol=crypto \
            --enable-protocol=jni \
            --enable-protocol=file \
            --disable-network \
                --enable-filter=buffer \
            --enable-filter=buffersink \
            --enable-filter=scale \
            --enable-protocol=rtp \
            --enable-protocol=tcp \
            --enable-protocol=udp \
            --enable-protocol=applehttp \
            --enable-protocol=hls \
            --enable-protocol=http \
            --enable-decoder=xsub \
            --enable-decoder=jacosub \
            --enable-decoder=dvdsub \
            --enable-decoder=dvbsub \
            --enable-decoder=subviewer \
            --enable-decoder=rawvideo \
            --enable-encoder=rawvideo \
            --enable-decoder=mjpeg \
            --enable-encoder=mjpeg \
            --enable-decoder=h263 \
            --enable-decoder=mpeg4 \
            --enable-encoder=mpeg4 \
            --enable-decoder=h264 \
            --enable-encoder=h264 \
            --enable-decoder=aac \
            --enable-encoder=aac \
            --enable-parser=h264 \
            --enable-encoder=mp2 \
            --enable-decoder=mp2 \
            --enable-encoder=libvo_amrwbenc \
            --enable-decoder=amrwb \
            --enable-muxer=mp2 \
            --enable-bsfs \
            --enable-decoders \
            --enable-encoders \
            --enable-parsers \
            --enable-hwaccels \
            --enable-muxers \
            --enable-avformat \
            --enable-avcodec \
            --disable-demuxer=v4l \
            --disable-demuxer=v4l2 \
            --disable-indev=v4l \
            --disable-indev=v4l2 \
            --disable-ffplay \
            --disable-ffmpeg \
            --disable-ffplay \
            --disable-ffprobe \
            --disable-ffserver \
            --enable-nonfree \
            --enable-version3 \
            --enable-memalign-hack \
            --disable-asm \
            $ADDITIONAL_CONFIGURE_FLAG \
            || exit 1
        make clean || exit 1
        make -j4 install || exit 1
    
        cd ..
    }
    
    function build_one {
        cd ffmpeg
        cd ..
    }
    
    #arm v5
    EABIARCH=arm-linux-androideabi
    ARCH=arm
    CPU=armv5
    OPTIMIZE_CFLAGS="-marm -march=$CPU"
    PREFIX=../ffmpeg-build/armeabi
    OUT_LIBRARY=$PREFIX/libffmpeg.so
    ADDITIONAL_CONFIGURE_FLAG=
    SONAME=libffmpeg.so
    PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/$OS-x86_64
    #PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/$OS-x86
    PLATFORM_VERSION=android-5
    build_x264
    build_ffmpeg
    build_one
    
    
    #arm v7vfpv3
    #EABIARCH=arm-linux-androideabi
    #ARCH=arm
    #CPU=armv7-a
    #OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU "
    #PREFIX=../ffmpeg-build/armeabi-v7a
    #OUT_LIBRARY=$PREFIX/libffmpeg.so
    #ADDITIONAL_CONFIGURE_FLAG=
    #SONAME=libffmpeg.so
    #PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/$OS-x86_64
    #PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/$OS-x86
    #PLATFORM_VERSION=android-5
    #build_x264
    #build_ffmpeg
    #build_one
    
    #arm v7 + neon (neon also include vfpv3-32)
    EABIARCH=arm-linux-androideabi
    ARCH=arm
    CPU=armv7-a
    OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=neon -marm -march=$CPU -mtune=cortex-a8 -mthumb -D__thumb__ "
    PREFIX=../ffmpeg-build/armeabi-v7a
    #PREFIX=../ffmpeg-build/armeabi-v7a-neon
    OUT_LIBRARY=../ffmpeg-build/armeabi-v7a/libffmpeg-neon.so
    ADDITIONAL_CONFIGURE_FLAG=--enable-neon
    SONAME=libffmpeg-neon.so
    PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/$OS-x86_64
    #PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/$OS-x86
    PLATFORM_VERSION=android-9
    build_x264
    build_ffmpeg
    build_one
    
    #x86
    EABIARCH=i686-linux-android
    ARCH=x86
    OPTIMIZE_CFLAGS="-m32"
    PREFIX=../ffmpeg-build/x86
    OUT_LIBRARY=$PREFIX/libffmpeg.so
    ADDITIONAL_CONFIGURE_FLAG=--disable-asm
    SONAME=libffmpeg.so
    PREBUILT=$NDK/toolchains/x86-4.8/prebuilt/$OS-x86_64
    #PREBUILT=$NDK/toolchains/x86-4.6/prebuilt/$OS-x86
    PLATFORM_VERSION=android-9
    build_x264
    build_ffmpeg
    build_one
    
    #mips
    EABIARCH=mipsel-linux-android
    ARCH=mips
    OPTIMIZE_CFLAGS="-EL -march=mips32 -mips32 -mhard-float"
    PREFIX=../ffmpeg-build/mips
    OUT_LIBRARY=$PREFIX/libffmpeg.so
    ADDITIONAL_CONFIGURE_FLAG=""
    SONAME=libffmpeg.so
    PREBUILT=$NDK/toolchains/mipsel-linux-android-4.8/prebuilt/$OS-x86_64
    #PREBUILT=$NDK/toolchains/mipsel-linux-android-4.6/prebuilt/$OS-x86
    PLATFORM_VERSION=android-9
    build_x264
    build_ffmpeg
    build_one
    

    build_all.sh

    #!/bin/bash
    #
    # build_all.sh
    
    export NDK=/home/tasol/DEVELOPMENT/IJOOMER_DEVELOPMENT/NDK/android-ndk-r10d
    sudo ./build_android.sh
    $NDK/ndk-build
    
    echo "Done Dona Done!!!"
    

    Android.mk

    LOCAL_PATH := $(call my-dir)
    
    include $(CLEAR_VARS)
    LOCAL_MODULE  := videokit
    # These need to be in the right order
    FFMPEG_LIBS := $(addprefix ffmpeg-build/$(TARGET_ARCH_ABI)/lib/, \
     libavdevice.a \
     libavformat.a \
     libavfilter.a \
     libavcodec.a \
     libswscale.a \
     libavutil.a \
     libswresample.a \
     libpostproc.a )
    # ffmpeg uses its own deprecated functions liberally, so turn off that annoying noise
    LOCAL_CFLAGS += -g -Iffmpeg -Ivideokit -Wno-deprecated-declarations 
    LOCAL_LDLIBS += -llog -lz $(FFMPEG_LIBS) ffmpeg-build/$(TARGET_ARCH_ABI)/lib/libx264.a
    LOCAL_SRC_FILES := videokit/uk_co_halfninja_videokit_Videokit.c videokit/ffmpeg.c videokit/cmdutils.c
    include $(BUILD_SHARED_LIBRARY)
    
    
    include $(CLEAR_VARS)
    LOCAL_MODULE  := ffmpeg
    FFMPEG_LIBS := $(addprefix ffmpeg-build/$(TARGET_ARCH_ABI)/lib/, \
     libavdevice.a \
     libavformat.a \
     libavfilter.a \
     libavcodec.a \
     libswscale.a \
     libavutil.a \
     libswresample.a \
     libpostproc.a )
    LOCAL_CFLAGS += -g -Iffmpeg -Ivideokit -Wno-deprecated-declarations 
    LOCAL_LDLIBS += -llog -lz $(FFMPEG_LIBS) ffmpeg-build/$(TARGET_ARCH_ABI)/lib/libx264.a
    LOCAL_SRC_FILES := ffmpeg/ffmpeg.c ffmpeg/cmdutils.c
    include $(BUILD_EXECUTABLE)
    

    Application.mk

    APP_ABI := armeabi,armeabi-v7a,x86,mips
    APP_PLATFORM := android-10
    APP_STL := gnustl_static
    

    UPDATE

    Finally Got success

  • Updating ffmpeg on Ubuntu 12.04 ; conflicts with old version from standard repository

    29 octobre 2016, par Frank van Wensveen

    I have never used ffmpeg on my Ubuntu Linux 12.04 (Precise Pangolin) box until now. Typing 'ffmpeg' at the command prompt revealed that ffmpeg 0.8.17 (listed as ffmpeg 0.8.17-4:0.8.17-0ubuntu0.12.04.2) was installed. Seeing as I need to convert h.265 to h.264, an update was obviously required.

    Following posted instructions, I installed a ream of packages:

    $ sudo apt-get install faad libmp4v2-dev libfaac0 libfaac-dev
    libxvidcore4 libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev libx264-dev
    libgsm-tools libogg-dev libtheora-bin libfaad-dev libvorbis-dev 
    libtheora-dev libdts-dev git-core yasm texi2html checkinstall
    

    followed by

    $ sudo apt-get purge ffmpeg
    

    in order to get rid of the old stuff from the original repo.

    Downloaded the latest ffmpeg, and a ."/configure; make; sudo make install" later, I should be in business.

    Except that typing 'ffmpeg' at the prompt still fired up the old version. A quick look revealed that the old ffmpeg binary was still sitting in /usr/bin with the new one being installed in /usr/local/bin. But ffmpeg is no longer listed as an installed package, and sudo apt-get remove ffmpeg tells me that "Package ffmpeg is not installed, so not removed".

    Running /usr/local/bin/ffmpeg directly works, however then fails in an Unknown encoder 'libx264' error. Which is puzzling because the package libx264-120 is installed and /usr/lib/i386-linux-gnu/libx264.so.120 (with the appropriate symlink to /usr/lib/i386-linux-gnu/libx264.so) does exist.

    Maybe I've been looking at this for too long, because I'm sure this is a simple issue but I just can't see it.

    Can someone please hand me the stupid had and point out why I deserve to wear it?

    Tnx!