Recherche avancée

Médias (1)

Mot : - Tags -/copyleft

Autres articles (67)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (8537)

  • ffmpeg decoding on Android

    29 novembre 2013, par Kernald

    I'm currently trying to use ffmpeg on Android. I built ffmpeg using https://github.com/halfninja/android-ffmpeg-x264 (I adapted it to not use libx264 and build with ndk-r9b, using GCC 4.6). I try to trim an MP4 file. However, the input file fails to open :

    11-28 10:59:18.494 : INFO/com.rfc.video.VideoKit(4125) : ffmpeg
    11-28 10:59:18.494 : INFO/com.rfc.video.VideoKit(4125) : -i
    11-28 10:59:18.494 : INFO/com.rfc.video.VideoKit(4125) : /storage/emulated/0/DCIM/20131126_173903.mp4
    11-28 10:59:18.494 : INFO/com.rfc.video.VideoKit(4125) : -ss
    11-28 10:59:18.494 : INFO/com.rfc.video.VideoKit(4125) : 2
    11-28 10:59:18.494 : INFO/com.rfc.video.VideoKit(4125) : -t
    11-28 10:59:18.494 : INFO/com.rfc.video.VideoKit(4125) : 4
    11-28 10:59:18.494 : INFO/com.rfc.video.VideoKit(4125) : -vcodec
    11-28 10:59:18.494 : INFO/com.rfc.video.VideoKit(4125) : copy
    11-28 10:59:18.494 : INFO/com.rfc.video.VideoKit(4125) : -acodec
    11-28 10:59:18.494 : INFO/com.rfc.video.VideoKit(4125) : copy
    11-28 10:59:18.494 : INFO/com.rfc.video.VideoKit(4125) : /storage/emulated/0/DCIM/trimmed-000-20131126_173903.mp4
    11-28 10:59:18.494 : INFO/com.rfc.video.VideoKit(4125) : Running main
    11-28 10:59:18.494 : INFO/Videokit(4125) : Initializing AV codecs
    11-28 10:59:18.494 : INFO/Videokit(4125) : ffmpeg version 0.9.2, Copyright (c) 2000-2012 the FFmpeg developers
    11-28 10:59:18.494 : INFO/Videokit(4125) : built on Nov 27 2013 15:38:26 with gcc 4.6 20120106 (prerelease)
    11-28 10:59:18.494 : INFO/Videokit(4125) : configuration : —enable-cross-compile —arch=arm5te —enable-armv5te —target-os=linux —disable-stripping —prefix=../output —disable-neon —enable-version3 —ar=arm-linux-androideabi-ar —disable-shared —enable-static —enable-gpl —enable-memalign-hack —cc=arm-linux-androideabi-gcc —ld=arm-linux-androideabi-ld —extra-cflags='-fPIC -DANDROID -D__thumb__ -mthumb -Wno-deprecated' —disable-everything —enable-decoder=mjpeg —enable-demuxer=mjpeg —enable-parser=mjpeg —enable-demuxer=image2 —enable-muxer=mp4 —enable-decoder=rawvideo —enable-protocol=file —enable-hwaccels —disable-ffmpeg —disable-ffplay —disable-ffprobe —disable-ffserver —disable-network —enable-filter=buffer —enable-filter=buffersink —disable-demuxer=v4l —disable-demuxer=v4l2 —disable-indev=v4l —disable-indev=v4l2
    11-28 10:59:18.494 : INFO/Videokit(4125) : libavutil    51. 32. 0 / 51. 32. 0
    11-28 10:59:18.494 : INFO/Videokit(4125) : libavcodec   53. 42. 4 / 53. 42. 4
    11-28 10:59:18.494 : INFO/Videokit(4125) : libavformat  53. 24. 2 / 53. 24. 2
    11-28 10:59:18.494 : INFO/Videokit(4125) : libavdevice  53.  4. 0 / 53.  4. 0
    11-28 10:59:18.494 : INFO/Videokit(4125) : libavfilter   2. 53. 0 /  2. 53. 0
    11-28 10:59:18.494 : INFO/Videokit(4125) : libswscale    2.  1. 0 /  2.  1. 0
    11-28 10:59:18.494 : INFO/Videokit(4125) : libpostproc  51.  2. 0 / 51.  2. 0
    11-28 10:59:18.504 : ERROR/Videokit(4125) : /storage/emulated/0/DCIM/20131126_173903.mp4 : Invalid data found when processing input
    

    I digged into ffmpeg's code, and found the error :

    static int opt_input_file(OptionsContext *o, const char *opt, const char *filename)
    {

    // ...

    ic->video_codec_id   = video_codec_name ?
       find_codec_or_die(video_codec_name   , AVMEDIA_TYPE_VIDEO   , 0)->id : CODEC_ID_NONE;
    ic->audio_codec_id   = audio_codec_name ?
       find_codec_or_die(audio_codec_name   , AVMEDIA_TYPE_AUDIO   , 0)->id : CODEC_ID_NONE;
    ic->subtitle_codec_id= subtitle_codec_name ?
       find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0)->id : CODEC_ID_NONE;
    ic->flags |= AVFMT_FLAG_NONBLOCK;
    ic->interrupt_callback = int_cb;

    if (loop_input) {
       LOGW(
           "-loop_input is deprecated, use -loop 1\n"
           "Note, both loop options only work with -f image2\n"
       );
       ic->loop_input = loop_input;
    }

    /* open the input file with generic avformat function */
    err = avformat_open_input(&ic, filename, file_iformat, &format_opts);
    if (err < 0) {
       print_error(filename, err);
       exit_program(1);
    }
    assert_avoptions(format_opts);

    // ...

    }

    As indicated in the logcat, err is here equal to AVERROR_INVALIDDATA. I don't understand the reason however : the mp4 codec is enabled, as far as I can tell. Any hint on how to solve it ?

    Edit : I added more ffmpeg code. I'm pretty sure it's a codec issue now : ic->video_codec_id is set to CODEC_ID_NONE, which causes ic to be set to NULL and return a failure in avformat_open_input().

  • Stream ffmpeg output to flash player in node.js

    10 décembre 2013, par dave

    I'm using ffmpeg to take a video source and live stream it to the browser in flash.

    Here's the code (using expressjs) :

    app.get('/stream', function(req, res) {

       var command = spawn('ffmpeg', ['-re','-i','video.avi','-c:v','libx264','-c:a','libfaac','-ar',44100,'-f','flv','-']);

       res.setHeader("Accept-Ranges", "bytes");
       res.setHeader("Content-Type", "video/x-flv");        
       command.stdout.pipe(res);

    });

    EDIT : The command this uses is :

    ffmpeg -re -i video.avi -c:v libx264 -c:a libfaac -ar 44100 -f flv -

    If I load this URL in the browser directly, it downloads the flv file and I can play it back in VLC player. However, when I use this in a player like JWPlayer or even try to simply embed, it doesn't show or anything.

    Any idea what I could be missing here ?

    Thank you !

    EDIT : Here's the output from ffmpeg, after this it's just the bytes that continue on as it encodes.

    ffmpeg version N-52420-gfc69033 Copyright (c) 2000-2013 the FFmpeg developers
     built on Apr 25 2013 17:10:30 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
     configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libaacplus --enable-libass --enable-libcelt --enable-libfaac --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-openssl --enable-libopus --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --prefix=/usr/local
     libavutil      52. 27.100 / 52. 27.100
     libavcodec     55.  6.100 / 55.  6.100
     libavformat    55.  3.100 / 55.  3.100
     libavdevice    55.  0.100 / 55.  0.100
     libavfilter     3. 60.101 /  3. 60.101
     libswscale      2.  2.100 /  2.  2.100
     libswresample   0. 17.102 /  0. 17.102
     libpostproc    52.  3.100 / 52.  3.100
    [avi @ 0x7ffb12004800] non-interleaved AVI
    Input #0, avi, from 'video.avi':
     Metadata:
       encoder         : AVI-Mux GUI 1.17.8.3, Feb 16 201019:42:50
       JUNK            :
     Duration: 01:58:39.79, start: 0.000000, bitrate: 1710 kb/s
       Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 720x304 [SAR 1:1 DAR 45:19], 29.97 tbr, 29.97 tbn, 29.98 tbc
       Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 192 kb/s
       Metadata:
         title           : videotest
    [libx264 @ 0x7ffb12022000] using SAR=1/1
    [libx264 @ 0x7ffb12022000] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
    [libx264 @ 0x7ffb12022000] profile High, level 3.0
    [libx264 @ 0x7ffb12022000] 264 - core 125 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - 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=6 lookahead_threads=1 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=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, flv, to 'pipe:':
     Metadata:
       JUNK            :
       encoder         : Lavf55.3.100
       Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p, 720x304 [SAR 1:1 DAR 45:19], q=-1--1, 1k tbn, 29.97 tbc
       Stream #0:1: Audio: aac ([10][0][0][0] / 0x000A), 44100 Hz, 5.1, s16, 128 kb/s
       Metadata:
         title           : videotest
    Stream mapping:
     Stream #0:0 -> #0:0 (mpeg4 -> libx264)
     Stream #0:1 -> #0:1 (ac3 -> libfaac)
    Press [q] to stop, [?] for help
    FLVme=  -43 fps= 28 q=0.0 size=       0kB time=00:00:01.48 bitrate=   2.2kbits/s    
    videodatarateionframerate@=?Q??s
    audiodatarate@_@audiosamplerate@刀audiosamplesize@0stereo
                                                            audiocodecid@$JUNKencoder
                                                                                     Lavf55.3.10filesize   8   -d??gd??@?'?c1--?h???"??0   ?B?????E???H??,? ?#??x264 - core 125 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - 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=6 lookahead_threads=1 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=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00?Re??g?$?<<
  • FFmpeg remux rtp to mpegts [on hold]

    16 décembre 2013, par Ardoramor

    I am trying to remux rtp stream into mptegts format. I have an SDP file with the following contents :

    v=0
    o=- 0 0 IN IP4 127.0.0.1
    s=Unnamed
    i=N/A
    c=IN IP4 192.168.17.44
    t=0 0
    a=recvonly
    a=orient:portrait
    m=video 8202 RTP/AVP 96
    a=rtpmap:96 H264/90000
    a=fmtp:96 packetization-mode=1;profile-level-id=428028;sprop-parameter-sets=Z0KAKJWgKA9E,aM48gA==;
    a=control:trackID=1

    I execute the following ffmpeg command :

    ffmpeg -i "test.sdp" -f mpegts -vcodec copy "/tmp/test.ts"

    And I get the following information :

    Input #0, sdp, from 'test.sdp':
     Metadata:
       title           : Unnamed
       comment         : N/A
     Duration: N/A, start: 0.066622, bitrate: N/A
       Stream #0.0: Video: h264 (Baseline), yuv420p, 640x480, 90k tbr, 90k tbn, 180k tbc
    [mpegts @ 0x1101d4c0] muxrate VBR, pcr every 9000 pkts, sdt every 200, pat/pmt every 40 pkts
    Output #0, mpegts, to '/tmp/test.ts':
     Metadata:
       title           : Unnamed
       comment         : N/A
       encoder         : Lavf53.4.0
       Stream #0.0: Video: libx264, yuv420p, 640x480, q=2-31, 90k tbn, 90k tbc
    Stream mapping:
     Stream #0.0 -> #0.0

    I receive the following error :

    [mpegts @ 0x1c85f960] h264 bitstream malformated, no startcode found, use -vbsf h264_mp4toannexb
    av_interleaved_write_frame(): Operation not permitted

    So I add the suggested bitstream filter :

    ffmpeg -i "test.sdp" -f mpegts -vbsf h264_mp4toannexb "/tmp/test.ts"

    But the h264 encoding now becomes h262 (mpeg2video) :

    ~$ffprobe /tmp/test.ts
    Input #0, mpegts, from '/tmp/test.ts':
     Duration: 00:00:04.13, start: 1.400000, bitrate: 640 kb/s
     Program 1
       Metadata:
         service_name    : Unnamed
         service_provider: FFmpeg
       Stream #0.0[0x100]: Video: mpeg2video (Main), yuv420p, 640x480 [PAR 1:1 DAR 4:3], 104857 kb/s, 60 fps, 60 tbr, 90k tbn, 120 tbc

    Is there any way to keep the h264 codec without re-encoding it ? Doing so becomes very CPU intensive.

    Update

    Hopefully this will clear up the issue and remove the off-topic stamp.

    I'm writing an Android app that is based off of SpyDroids streaming architecture. The app communicates with the server, providing it the SDP. The server spawns an ffmpeg process to remux the incoming video stream into mpegts and broadcasts it on multicast (right now just file).

    SpyDroid performs streaming by sending recorded mp4 file through localsocket, received h264 packets, supposedly (according to code removed mp4 h264 prefix [annexb]), wraps it with rtp headrs and sends it on its way. Thus, the RPT stream I get is clearly not originally generated as such.

    As @Wagner Patriota has mentioned, I should add '-vcodec copy'. I had run the remuxing with it before as well but the error is still present (full output) :

    ~$ffmpeg -i "test.sdp" -f mpegts -vcodec copy -vbsf h264_mp4toannexb "/tmp/test.ts"
    ffmpeg version 0.8.6, Copyright (c) 2000-2011 the FFmpeg developers
     built on Jan 30 2012 17:17:54 with gcc 4.5.2
     configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab --disable-avisynth --enable-libdc1394 --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libx264 --enable-libxvid --extra-cflags='-O2 -g -m64 -mtune=generic -fPIC' --disable-stripping --disable-demuxer=v4l --disable-demuxer=v4l2 --disable-indev=v4l --disable-indev=v4l2
     libavutil    51.  9. 1 / 51.  9. 1
     libavcodec   53.  7. 0 / 53.  7. 0
     libavformat  53.  4. 0 / 53.  4. 0
     libavdevice  53.  1. 1 / 53.  1. 1
     libavfilter   2. 23. 0 /  2. 23. 0
     libswscale    2.  0. 0 /  2.  0. 0
     libpostproc  51.  2. 0 / 51.  2. 0
    [h264 @ 0x16b4b1c0] concealing 232 DC, 232 AC, 232 MV errors
    [h264 @ 0x16b4b1c0] concealing 63 DC, 63 AC, 63 MV errors
    [h264 @ 0x16b4b1c0] concealing 25 DC, 25 AC, 25 MV errors
    [h264 @ 0x16b4b1c0] concealing 138 DC, 138 AC, 138 MV errors
    [h264 @ 0x16b4b1c0] concealing 69 DC, 69 AC, 69 MV errors
    [sdp @ 0x16b43400] Estimating duration from bitrate, this may be inaccurate

    Seems stream 0 codec frame rate differs from container frame rate: 180000.00 (180000/1) -> 90000.00 (180000/2)
    Input #0, sdp, from 'test.sdp':
     Metadata:
       title           : Unnamed
       comment         : N/A
     Duration: N/A, start: 0.033256, bitrate: N/A
       Stream #0.0: Video: h264 (Baseline), yuv420p, 640x480, 90k tbr, 90k tbn, 180k tbc
    [mpegts @ 0x16b4a4c0] muxrate VBR, pcr every 9000 pkts, sdt every 200, pat/pmt every 40 pkts
    Output #0, mpegts, to '/tmp/test.ts':
     Metadata:
       title           : Unnamed
       comment         : N/A
       encoder         : Lavf53.4.0
       Stream #0.0: Video: libx264, yuv420p, 640x480, q=2-31, 90k tbn, 90k tbc
    Stream mapping:
     Stream #0.0 -> #0.0
    Press [q] to stop, [?] for help
    h264_mp4toannexb failed for stream 0, codec copy: Invalid argument
    [mpegts @ 0x16b4a4c0] h264 bitstream malformated, no startcode found, use -vbsf h264_mp4toannexb
    av_interleaved_write_frame(): Operation not permitted

    The error reports that the invalid argument has been supplied. Increased loglevel does not give any more information. I know that ffmpeg is sometimes finicky with argument order. However, they seen to be in order of documentation as well as suggested order by @Wagner Patriota.