Recherche avancée

Médias (91)

Autres articles (61)

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

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (13640)

  • Build FFmpeg for All Android architecture correctly

    22 octobre 2017, par fthopkins

    I built ffmpeg libraries for all android architecture. But some details are confusing my mind. First of all let me explain step by step how i built.

    • I downloaded latest version of libx264 from
      https://www.videolan.org/developers/x264.html
    • Created and run build_all.sh script (in x264 folder) for creating libs for (almost) all android platforms. Then i got android folder in x264 folder. e.g android/arm android/arm64 android/x86 android/x86_64 in x264 folder.
    • I download the ffmpeg3.3.4 from https://ffmpeg.org/download.html
    • I created 4 copies of ffmpeg3.3.4 folder. Named them with android architectures names.
      Like ffmpeg3.3.4-arm64 ffmpeg3.3.4-arm ffmpeg3.3.4-x86 ffmpeg3.3.4-x86_64
    • Created build_(architecture-name).sh for each platforms of android. Than move each one of 'named'.sh files to the named ffmpeg folders according to their architecture names.
      E.g build_android_x86.sh => ffmpeg3.3.4-x86

    build_android_arm64.sh example

    #!/bin/bash
    #Change NDK to your Android NDK location
    NDK=$HOME/Android/Sdk/ndk-bundle
    PLATFORM=$NDK/platforms/android-21/arch-arm64/
    PREBUILT=$NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64

    GENERAL="\
    --enable-small \
    --enable-cross-compile \
    --extra-libs="-lgcc" \
    --arch=aarch64 \
    --cc=$PREBUILT/bin/aarch64-linux-android-gcc \
    --cross-prefix=$PREBUILT/bin/aarch64-linux-android- \
    --nm=$PREBUILT/bin/aarch64-linux-android-nm \
    --extra-cflags="-I../x264/android/arm64/include" \
    --extra-ldflags="-L../x264/android/arm64/lib" "

    MODULES="\
    --enable-gpl \
    --enable-libx264"



    function build_arm64
    {
     ./configure \
     --logfile=conflog.txt \
     --target-os=linux \
     --prefix=./android/arm64-v8a \
     ${GENERAL} \
     --sysroot=$PLATFORM \
     --extra-cflags="" \
     --extra-ldflags="-lx264 -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \
     --enable-shared \
     --disable-static \
     --disable-doc \
     --enable-zlib \
     ${MODULES}

     make clean
     make
     make install
    }

    build_arm64


    echo Android ARM64 builds finished
    • Moved all ffmpeg3.3.4-arm64 ffmpeg3.3.4-arm ffmpeg3.3.4-x86 ffmpeg3.3.4-x86_64 folders to the NDK_PATH (C:\Users\MyName\AppData\Local\Android\sdk\ndk-bundle)
    • Put x264 folder at same level of hierarchy with ffmpeg folders
      in (C:\Users\MyName\AppData\Local\Android\sdk\ndk-bundle)
    • Run each of build_android_x86.sh, build_android_x86_64.sh.. scripts one by one in their own ffmpeg folder. Then i got android folders in ffmpeg folders. (created android folders have library folders)
      e.g ffmpeg3.3.4-x86/android/x86/(bin,inlude,lib,share)
    • Created Android.mk files for all created android folders and moved each one of them to android/armName folder. e.g Android.mk => ffmpeg3.3.4-x86/android/x86/

      LOCAL_PATH:= $(call my-dir)

      include $(CLEAR_VARS)
      LOCAL_MODULE:= libavcodec
      LOCAL_SRC_FILES:= lib/libavcodec-57.so
      LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
      include $(PREBUILT_SHARED_LIBRARY)

      include $(CLEAR_VARS)
      LOCAL_MODULE:= libavformat
      LOCAL_SRC_FILES:= lib/libavformat-57.so
      LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
      include $(PREBUILT_SHARED_LIBRARY)

      include $(CLEAR_VARS)
      LOCAL_MODULE:= libswscale
      LOCAL_SRC_FILES:= lib/libswscale-4.so
      LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
      include $(PREBUILT_SHARED_LIBRARY)

      include $(CLEAR_VARS)
      LOCAL_MODULE:= libavutil
      LOCAL_SRC_FILES:= lib/libavutil-55.so
      LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
      include $(PREBUILT_SHARED_LIBRARY)

      include $(CLEAR_VARS)
      LOCAL_MODULE:= libavfilter
      LOCAL_SRC_FILES:= lib/libavfilter-6.so
      LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
      include $(PREBUILT_SHARED_LIBRARY)

      include $(CLEAR_VARS)
      LOCAL_MODULE:= libswresample
      LOCAL_SRC_FILES:= lib/libswresample-2.so
      LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
      include $(PREBUILT_SHARED_LIBRARY)

      include $(CLEAR_VARS)
      LOCAL_MODULE := postproc
      LOCAL_SRC_FILES := lib/libpostproc-54.so
      LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
      include $(PREBUILT_SHARED_LIBRARY)

      include $(CLEAR_VARS)
      LOCAL_MODULE := avdevice
      LOCAL_SRC_FILES := lib/libavdevice-57.so
      LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
      include $(PREBUILT_SHARED_LIBRARY)
    • Create "arm named" folders e.g x86 x86_4 arm64 arm7 in jni folder of my project (myproject/app/jni/x86, myproject/app/jni/x86_64).

    • Go to ndk path open named ffmpeg folders one by one and copy ffmpeg.c ffmpeg_filter.c ffmpeg_opt.c cmdutils.c files from ffmpeg folders to the "arm named" folders. e.g ffmpeg.c => myproject/app/jni/x86

    • Created Android.mk file in my project.

      LOCAL_PATH := $(call my-dir)
      #$(warning $(LOCAL_PATH))

      include $(CLEAR_VARS)
      LOCAL_MODULE    := videoEdit
      LOCAL_LDLIBS := -llog -ljnigraphics -lz -landroid
      LOCAL_CFLAGS := -Wdeprecated-declarations
      ANDROID_LIB := -landroid

      $(info $(TARGET_ARCH_ABI))

      ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
         LOCAL_C_INCLUDES:=/Users/MyName/AppData/Local/Android/sdk/ndk-bundle/sources/ffmpeg-3.3.4-armeabi
         LOCAL_SRC_FILES :=  videoEdit.c arm7/ffmpeg.c arm7/ffmpeg_filter.c arm7/ffmpeg_opt.c arm7/cmdutils.c
         LOCAL_CFLAGS += -lx264 -Wl,--no-merge-exidx-entries
      else

         ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
                 LOCAL_C_INCLUDES:=/Users/MyName/AppData/Local/Android/sdk/ndk-bundle/sources/ffmpeg-3.3.4-arm64-v8a
                 LOCAL_SRC_FILES :=  videoEdit.c arm64/ffmpeg.c arm64/ffmpeg_filter.c arm64/ffmpeg_opt.c arm64/cmdutils.c
                 LOCAL_CFLAGS += -funwind-tables -Wl,--no-merge-exidx-entries
         else

             ifeq ($(TARGET_ARCH_ABI),x86_64)
                    LOCAL_C_INCLUDES:=/Users/MyName/AppData/Local/Android/sdk/ndk-bundle/sources/ffmpeg3.3.4-x86_64
                    LOCAL_SRC_FILES :=  videoEdit.c x86_64/ffmpeg.c x86_64/ffmpeg_filter.c x86_64/ffmpeg_opt.c x86_64/cmdutils.c
             else
                     LOCAL_C_INCLUDES:=/Users/MyName/AppData/Local/Android/sdk/ndk-bundle/sources/ffmpeg3.3.4-x86
                     LOCAL_SRC_FILES :=  videoEdit.c x86/ffmpeg.c x86/ffmpeg_filter.c x86/ffmpeg_opt.c x86/cmdutils.c
             endif

         endif

      endif

      LOCAL_SHARED_LIBRARIES := libavformat libavcodec libswscale libavutil libswresample libavfilter libavdevice libpostproc

      include $(BUILD_SHARED_LIBRARY)

      ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)

         $(call import-module,ffmpeg-3.3.4-armeabi/android/armeabi-v7a)

      else

         ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
                 $(call import-module,ffmpeg-3.3.4-arm64-v8a/android/arm64-v8a)
         else

             ifeq ($(TARGET_ARCH_ABI),x86_64)
                    $(call import-module,ffmpeg3.3.4-x86_64/android/x86_64)
             else
                 $(call import-module,ffmpeg3.3.4-x86/android/i686-diasm)
             endif

         endif

      endif
    • Created Application.mk file in my project.

      APP_ABI := armeabi-v7a, arm64-v8a, x86_64, x86
      APP_PLATFORM := android-14
    • Created videoEdit.c than run ndk-build build command.

    Built with no error. I can run ffmpeg commands but it takes too much time i think. E.g when i try to run hflip it flips the video with 15 seconds.

    Code example :

    JNIEXPORT jint JNICALL Java_com_name_app_library_VideoEditer_natives_VideoEditer_flipHorizontally
    (JNIEnv *env, jclass someclass, jstring inputFile, jstring outFile) {

       int numberOfArgs = 14;

       char** arguments = calloc(numberOfArgs, sizeof(char*));
       const char *in, *out;

       in = (*env)->GetStringUTFChars(env, inputFile, 0);
       out = (*env)->GetStringUTFChars(env, outFile, 0);

       arguments[0] = "ffmpeg";
       arguments[1] = "-i";
       arguments[2] = in;
       arguments[3] = "-c:v";
       arguments[4] = "libx264";
       arguments[5] = "-preset";
       arguments[6] = "ultrafast";
       arguments[7] = "-threads";
       arguments[8] = "5";
       arguments[9] = "-c:a";
       arguments[10] = "copy";
       arguments[11] = "-vf";
       arguments[12] = "hflip";
       arguments[13] = out;

       int i;
       for (i = 0; i < numberOfArgs; i++) {
           log_message(arguments[i]);
       }
       log_message("Printed all");

       main(numberOfArgs, arguments);
       free(arguments);
       (*env)->ReleaseStringUTFChars(env, inputFile, in);
       (*env)->ReleaseStringUTFChars(env, outFile, out);

       return 0;
    }

    Also another thing to confusing my mind is output of ./configure command.
    When i open the (e.g) ffmpeg-3.3.4-arm64-v8a folder and run ./configure command in terminal. Output says ARCH   x86 (generic). For all platform output is the same ARCH   x86 (generic). Commands run on emaulator very fast but very slow on real device.

    Output of ./configure command in ffmpeg-3.3.4-arm64-v8a folder

    install prefix            /usr/local
    source path               .
    C compiler                gcc
    C library                 glibc
    ARCH                      x86 (generic)
    big-endian                no
    runtime cpu detection     yes
    yasm                      yes
    MMX enabled               yes
    MMXEXT enabled            yes
    3DNow! enabled            yes
    3DNow! extended enabled   yes
    SSE enabled               yes
    SSSE3 enabled             yes
    AESNI enabled             yes
    AVX enabled               yes
    XOP enabled               yes
    FMA3 enabled              yes
    FMA4 enabled              yes
    i686 features enabled     yes
    CMOV is fast              yes
    EBX available             yes
    EBP available             yes
    debug symbols             yes
    strip symbols             yes
    optimize for size         no
    optimizations             yes
    static                    yes
    shared                    no
    postprocessing support    no
    network support           yes
    threading support         pthreads
    safe bitstream reader     yes
    texi2html enabled         no
    perl enabled              yes
    pod2man enabled           yes
    makeinfo enabled          no
    makeinfo supports HTML    no

    External libraries:
    iconv            xlib

    EDIT all of these steps made on ubuntu then moved all folders to the windows. So dont be confuse about paths.

    With all of these steps i want to ask is, is there anything wrong on my steps. Should i follow any other way or not ? Why the ffmpeg is running slower on real device. I guess building ffmpeg for android is bit messy and making wrong things is very easy. If you look my steps, questions and give me an advice, i will be much appreciated.

  • Python add audio to video opencv

    21 avril, par olokelo

    I use python cv2 module to join jpg frames into video, but I can't add audio to it. Is it possible to add audio to video in python without ffmpeg ?
P.S. Sorry for my poor English

    


  • nginx RTMP to HLS : FFMPG error when trying multiple bitrate output [on hold]

    28 mai 2014, par user3685074

    I’m currently trying to convert my RTMP Livestream into a HLS with 3 quality-settings.

    I followed this guide

    I’ve compiled my own FFMPEG and it’s working if I just convert 1 file.
    It seems libx264 isn’t able to do multiple encodings at the same time ?

    I’m using these command :

           exec /usr/local/bin/ffmpeg -i rtmp://localhost/src/$name
           -c:a libfdk_aac -b:a 32k   -c:v libx264 -b:v 128K -f flv rtmp://localhost/hls/$name_low
           -c:a libfdk_aac -b:a 64k   -c:v libx264 -b:v 256K -f flv rtmp://localhost/hls/$name_mid
           -c:a libfdk_aac -b:a 128k  -c:v libx264 -b:v 512K -f flv rtmp://localhost/hls/$name_hi  2>>/tmp/ffmpeg.log;

    this is the output :

       ffmpeg version N-63519-g61917a1 Copyright (c) 2000-2014 the FFmpeg developers
         built on May 28 2014 18:06:42 with gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
         configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-x11grab --enable-libvpx --enable-libmp3lame --enable-librtmp --enable-libspeex --enable-libfdk_aac
         libavutil      52. 87.100 / 52. 87.100
         libavcodec     55. 65.100 / 55. 65.100
         libavformat    55. 41.100 / 55. 41.100
         libavdevice    55. 13.101 / 55. 13.101
         libavfilter     4.  5.100 /  4.  5.100
         libswscale      2.  6.100 /  2.  6.100
         libswresample   0. 19.100 /  0. 19.100
         libpostproc    52.  3.100 / 52.  3.100
       Metadata:
         Server                NGINX RTMP (github.com/arut/nginx-rtmp-module)
         width                 1280.00
         height                720.00
         displayWidth          1280.00
         displayHeight         720.00
         duration              0.00
         framerate             25.00
         fps                   25.00
         videodatarate         390.00
         videocodecid          0.00
         audiodatarate         27.00
         audiocodecid          11.00
       Input #0, flv, from 'rtmp://localhost/src/test':
         Metadata:
           Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)
           displayWidth    : 1280
           displayHeight   : 720
           fps             : 25
           profile         :
           level           :
         Duration: 00:00:00.00, start: 0.080000, bitrate: N/A
           Stream #0:0: Video: h264 (High), yuv420p, 1280x720, 399 kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc
           Stream #0:1: Audio: speex, 16000 Hz, mono, s16, 27 kb/s
       [libx264 @ 0x5260380] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
       [libx264 @ 0x5260380] profile High, level 3.1
       [libx264 @ 0x5260380] 264 - core 142 r2431 f23da7c - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - 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=24 lookahead_threads=4 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=abr mbtree=1 bitrate=128 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
       [libx264 @ 0x525a920] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
       Output #0, flv, to 'rtmp://localhost/hls/test_low':
         Metadata:
           Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)
           displayWidth    : 1280
           displayHeight   : 720
           fps             : 25
           profile         :
           level           :
           Stream #0:0: Video: h264 (libx264), yuv420p, 1280x720, q=-1--1, 128 kb/s, 25 fps, 90k tbn, 25 tbc
           Metadata:
             encoder         : Lavc55.65.100 libx264
           Stream #0:1: Audio: aac (libfdk_aac), 16000 Hz, mono, s16, 32 kb/s
           Metadata:
             encoder         : Lavc55.65.100 libfdk_aac
       Output #1, flv, to 'rtmp://localhost/hls/test_mid':
         Metadata:
           Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)
           displayWidth    : 1280
           displayHeight   : 720
           fps             : 25
           profile         :
           level           :
           Stream #1:0: Video: h264, yuv420p, 1280x720, q=-1--1, 256 kb/s, 25 fps, 90k tbn, 25 tbc
           Metadata:
             encoder         : Lavc55.65.100 libx264
           Stream #1:1: Audio: aac, 16000 Hz, mono, s16
           Metadata:
             encoder         : Lavc55.65.100 libfdk_aac
       Output #2, flv, to 'rtmp://localhost/hls/test_hi':
         Metadata:
           Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)
           displayWidth    : 1280
           displayHeight   : 720
           fps             : 25
           profile         :
           level           :
           Stream #2:0: Video: h264, yuv420p, 1280x720, q=-1--1, 25 fps, 90k tbn, 25 tbc
           Metadata:
             encoder         : Lavc55.65.100 libx264
           Stream #2:1: Audio: aac, 16000 Hz, mono, s16
           Metadata:
             encoder         : Lavc55.65.100 libfdk_aac
       Stream mapping:
         Stream #0:0 -> #0:0 (h264 -> libx264)
         Stream #0:1 -> #0:1 (libspeex -> libfdk_aac)
         Stream #0:0 -> #1:0 (h264 -> libx264)
         Stream #0:1 -> #1:1 (libspeex -> libfdk_aac)
         Stream #0:0 -> #2:0 (h264 -> libx264)
         Stream #0:1 -> #2:1 (libspeex -> libfdk_aac)
       Error while opening encoder for output stream #1:0 - maybe incorrect parameters such as bit_rate, rate, width or height

    I hope you can help me and sorry for my bad english.

    Greetz
    Kevin