Recherche avancée

Médias (91)

Autres articles (112)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

Sur d’autres sites (10155)

  • wMy media converter app crashes when handling file names with spaces

    8 janvier 2013, par suffa

    I wrote an app that uses ffmpeg to convert media files (.wav, .avi, .mp3, ... etc.). It works only with file names that have no spaces. When a file name with spaces is encountered, the app immediately closes. Can someone tell me if the string I'm using to call ffmpeg is correct, or need some characters escaped ? Below is a fragment of the code :

    ...
    ...
    ...

    #Select Media
    os.chdir("c:\\d-Converter\\ffmpeg\\bin")
    wrkdir = os.getcwd()
    filelist = os.listdir(wrkdir)
    self.formats1 = []

    for filename in filelist:
       (head, filename) = os.path.split(filename)
       if filename.endswith(".avi") or filename.endswith(".mp4") or filename.endswith(".flv") or filename.endswith(".mov") or filename.endswith(".mpeg4") or filename.endswith(".mpeg") or filename.endswith(".mpg2") or filename.endswith(".wav") or filename.endswith(".mp3"):
               self.formats1.append(filename)
       self.format_combo1=wx.ComboBox(panel, size=(140, -1),value='Select Media', choices=self.formats1, style=wx.CB_DROPDOWN, pos=(300,50))

       self.Bind(wx.EVT_COMBOBOX, self.fileFormats, self.format_combo1)


    ...
    ...
    ...


    def fileFormats(self, e):
       myFormats = {'audio': ('Select Format','.mp3', '.ogg', '.wav', '.wma'), 'video': ('Select Format','.flv','.mpg', '.mp4', '.mpeg')}
       bad_file = ['Media not supported']
       myFile = self.format_combo1.GetValue()
       f_exten = (x for x in myFormats['audio'] + myFormats['video'] if myFile.endswith(x))
       extension = f_exten.next()

       if extension in myFormats['audio']:
           self.format_combo2.SetItems(myFormats['audio'])

       elif extension in myFormats['video']:
           self.format_combo2.SetItems(myFormats['video'])
       else:
           self.format_combo2.SetItems(bad_file)
    ...
    ...
    ...


    def convertButton(self, e):

       unit1 = self.format_combo1.GetValue()
       if unit1:
           unit1 = self.repl_Wspace(unit1)

       #Media Formats
       unit2 = self.format_combo2.GetValue()
       unit3 = self.format_combo3.GetValue()
       unit4 = None
       unit5 = self.format_combo5.GetValue()
       bitRate = self.format_combo6.GetValue()
       unit6 = bitRate
       if unit3 == '-qmax':
           unit4 = self.format_combo4.GetValue()
       else:
           pass

       os.chdir("c:\\d-Converter\\ffmpeg\\bin")
       wrkdir = os.getcwd()

       newfile = unit1
       stripped = newfile.strip('mpeg3aviovfl4w2c.') #Strips the extension from the original file name


       progname='c:\\d-Converter\\ffmpeg\\bin\\ffmpeg.exe' + ' -i '

       preset1_a='-vn -ar 44100 -ac 2 -ab'
       preset1_b='-f mp3 '
       preset_mp3='.mp3'

       chck_unit1 = self.my_endswith(unit1)



       while True:    
           if unit5 == 'video to mp3':

               if unit6 == 'k/bs' or unit6 == '':
                   amsg = wx.MessageDialog(None, 'You must select a bit rate.', 'Media Converter', wx.ICON_INFORMATION)
                   amsg.ShowModal()
                   amsg.Destroy()
                   break

               elif unit5 == 'video to mp3' and unit6 != 'k/bs' or unit6 != '':
                   self.button.Disable()
                   self.button2.Enable()
                   self.format_combo1.Disable()
                   self.format_combo2.Disable()
                   self.format_combo3.Disable()
                   self.format_combo4.Disable()
                   self.format_combo5.Disable()
                   self.format_combo6.Disable()
                   startWorker(self.LongTaskDone, self.LongTask3, wargs=(progname, wrkdir, unit1, preset1_a, unit6, preset1_b, stripped, preset_mp3))
                   break
               elif unit1 != unit1.endswith(".mpg") or unit1.endswith(".mpeg") or unit1.endswith(".avi") or unit1.endswith(".mp4") or unit1.endswith(".flv"):
                   bmsg = wx.MessageDialog(None, 'You must select a valid format to convert to .mp3.', 'Media Converter', wx.ICON_INFORMATION)
                   bmsg.ShowModal()
                   bmsg.Destroy()
                   break

           else:
               pass



           if unit1 == 'Select Media' or unit1 == '':
               amsg = wx.MessageDialog(None, 'You must select a media file!', 'Media Converter', wx.ICON_INFORMATION)
               amsg.ShowModal()
               amsg.Destroy()
               break


           elif unit2 == 'Select Format' or unit2 == '' or unit2 == chck_unit1:
               amsg = wx.MessageDialog(None, 'You must select a valid format', 'Media Converter', wx.ICON_INFORMATION)
               amsg.ShowModal()
               amsg.Destroy()
               break


           elif unit3 == 'Select Quality' or unit3 == '':
               amsg = wx.MessageDialog(None, 'You must select quality', 'Media Converter', wx.ICON_INFORMATION)
               amsg.ShowModal()
               amsg.Destroy()
               break

           elif unit3 != 'Select Quality' or unit3 != '':
               self.format_combo5.Disable()

               if unit3 == '-qmax':
                   if unit4 == '0' or unit4 == '':
                       amsg = wx.MessageDialog(None, 'You must select number between 1-8.', 'Media Converter', wx.ICON_INFORMATION)
                       amsg.ShowModal()
                       amsg.Destroy()
                       break
                   else:
                       self.button.Disable()
                       self.button2.Enable()
                       self.format_combo1.Disable()
                       self.format_combo2.Disable()
                       self.format_combo3.Disable()
                       self.format_combo4.Disable()
                       self.format_combo5.Disable()
                       startWorker(self.LongTaskDone, self.LongTask2, wargs=(progname,wrkdir,unit1,unit3,unit4,stripped,unit2))
                       break
               elif unit3 == '-sameq':
                   self.button.Disable()
                   self.button2.Enable()
                   self.format_combo1.Disable()
                   self.format_combo2.Disable()
                   self.format_combo3.Disable()
                   self.format_combo4.Disable()
                   self.format_combo5.Disable()
                   startWorker(self.LongTaskDone, self.LongTask, wargs=(progname,wrkdir,unit1,unit3,stripped,unit2))
                   break  




    def LongTask(self, progname, wrkdir, unit1, unit3, stripped, unit2):
       convert_file1 = progname + wrkdir + '\\' + unit1 + ' ' + unit3 + ' ' + stripped + unit2
       self.statusbar.SetStatusText("Converting: " + unit1 + "...")
       os.system(convert_file1)
       print convert_file1


    def LongTask2(self, progname, wrkdir, unit1, unit3, unit4, stripped, unit2):
       convert_file2 = progname + wrkdir + '\\' + unit1 + ' ' + unit3 + ' ' + unit4 + ' ' + stripped + unit2
       self.statusbar.SetStatusText("Converting: " + unit1 + "...")
       os.system(convert_file2)

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