Recherche avancée

Médias (1)

Mot : - Tags -/école

Autres articles (27)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

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

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

  • ffmpeg 1.0.7 takes minute to create a thumbnail on "broken" video file but other files are seconds to create thumbnail

    8 juillet 2015, par Wiggler Jtag

    I’ve been using ffmpeg 1.0.7 for over 450GB (cca 400 files) for creating thumbnails and grabbing video-file information. It tooks me like 1-2 seconds to create 10 thumbnails from 8GB file. But now I’ve got some ’broken’ video file (672 MB) which creates me 1 thumbnail over a minute, 10 thumbnails its over 10 minutes -> my server burns :

    PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND
    9769 www-data  20   0  395m  28m 7212 R 157.0  0.4   0:04.99 ffmpeg

    I opened the file in Windows Media Player and getting blank screen while -> video file is weird, opened it in VLC and it wrote me : Because this AVI file index is broken or missing, seeking will not work correctly. VLC won't repair your file but can temporary fix this problem by building an index in memory. I’ve clicked ’Play as is’ and it plays the video file correctly, however my webserver burns because of FFmpeg and PHP waits for the return from exec(); command. Thumbnails are also created fine after 10 minutes, but how can I fix this problem or to prevent from executing FFmpeg for creating thumbnails on these broken ’video’ files ?

    This is my php :

    $cmd = "ffmpeg -i error.avi 2>&1";
    $info = `$cmd`;
    echo '<pre>';
    print_r($info);
    echo '</pre>';

    this is the output I am getting (very quickly)

    ffmpeg version 1.0.7 Copyright (c) 2000-2013 the FFmpeg developers
     built on Jul 19 2013 07:14:44 with gcc 4.7 (Debian 4.7.2-5)
     configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libfdk-aac --enable-libdc1394 --disable-altivec --dis  libavutil      51. 73.101 / 51. 73.101
     libavcodec     54. 59.100 / 54. 59.100
     libavformat    54. 29.104 / 54. 29.104
     libavdevice    54.  2.101 / 54.  2.101
     libavfilter     3. 17.100 /  3. 17.100
     libswscale      2.  1.101 /  2.  1.101
     libswresample   0. 15.100 /  0. 15.100
     libpostproc    52.  0.100 / 52.  0.100
    Input #0, avi, from 'error.avi':
     Metadata:
       encoder         : VirtualDubMod 1.5.10.2 (build 2540/release)
     Duration: 01:29:39.32, start: 0.000000, bitrate: 1048 kb/s
       Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 640x272 [SAR 1:1 DAR 40:17], 23.98 tbr, 23.98 tbn, 23.98 tbc
       Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16, 128 kb/s
    At least one output file must be specified

    So it looks like just creating thumbnails is having problems :

    exec("ffmpeg -ss 01:11:43 -i error.avi -vframes 1 -s 616x320 -an output_1.jpg 2>&amp;1");

    Where could be the problem ? Thanks for your suggestions !

    Btw. I am posting this on SO because I’m not sure where it belongs more than here - I think it could be done somehow by PHP but I’m not really sure.

    EDIT : I have added timeout, which "fixes" my problem, but even latest version of FFmpeg 2. stucks on creating thumbnail from broken video files.

    exec("timeout 5s ffmpeg -ss 01:11:43 -i error.avi -vframes 1 -s 616x320 -an output_1.jpg 2>&amp;1");
  • When merging video and audio, converting audio to AAC, sound is missed at the end 3 seconds

    10 octobre 2013, par profuel

    I have to build video from images and some audio clip.
    Audio is much longer, so I have to mute last 5 seconds of audio track, cutting to video length.
    My issue is that adding AAC encoding to audio removes last 2-5 seconds of audio in resulted video.

    Here are my command lines :

    ffmpeg -i sound.mp3 -i video.mp4 -shortest out.mp4 -> results in correct audio in result video with played audio over 100% of movie

    ffmpeg -i sound.mp3 -i video.mp4 -acodec aac -ab 160000 -strict experimental -shortest out.mp4 -> not correct audio, gets crop at end of video for 2-5 seconds


    The problem appears for me both on Windows and on CentOS 6.4, no matter which version of ffmpeg is used.

    FFMPEG details (downloaded from http://ffmpeg.gusari.org/static/64bit/ffmpeg.static.64bit.2013-06-01.tar.gz )
    ffmpeg version N-53724-g716dbc7 Copyright (c) 2000-2013 the FFmpeg developers
    built on Jun 1 2013 05:26:08 with gcc 4.6 (Debian 4.6.3-1)
    configuration : —prefix=/root/ffmpeg-static/64bit —extra-cflags='-I/root/ffmpeg-static/64bit/include -static' —extra-ldflags='-L/root/ffmpeg-static/64bit/lib -static' —extra-libs='-lxml2 -lexpat -lfreetype' —enable-static —disable-shared —disable-ffserver —disable-doc —enable-bzlib —enable-zlib —enable-postproc —enable-runtime-cpudetect —enable-libx264 —enable-gpl —enable-libtheora —enable-libvorbis —enable-libmp3lame —enable-gray —enable-libass —enable-libfreetype —enable-libopenjpeg —enable-libspeex —enable-libvo-aacenc —enable-libvo-amrwbenc —enable-version3 —enable-libvpx
    libavutil 52. 34.100 / 52. 34.100
    libavcodec 55. 12.102 / 55. 12.102
    libavformat 55. 8.102 / 55. 8.102
    libavdevice 55. 2.100 / 55. 2.100
    libavfilter 3. 73.100 / 3. 73.100
    libswscale 2. 3.100 / 2. 3.100
    libswresample 0. 17.102 / 0. 17.102
    libpostproc 52. 3.100 / 52. 3.100

  • ffmpeg error on decode

    25 octobre 2013, par ademar111190

    I'm developing an android app with the libav and I'm trying decode a 3gp with code below :

    #define simbiLog(...) __android_log_print(ANDROID_LOG_DEBUG, "simbiose", __VA_ARGS__)

    ...

    AVCodec *codec;
    AVCodecContext *c = NULL;
    int len;
    FILE *infile, *outfile;
    uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
    AVPacket avpkt;
    AVFrame *decoded_frame = NULL;

    simbiLog("inbuf size: %d", sizeof(inbuf) / sizeof(inbuf[0]));

    av_register_all();
    av_init_packet(&amp;avpkt);

    codec = avcodec_find_decoder(AV_CODEC_ID_AMR_NB);
    if (!codec) {
       simbiLog("codec not found");
       return ERROR;
    }

    c = avcodec_alloc_context3(codec);
    if (!c) {
       simbiLog("Could not allocate audio codec context");
       return ERROR;
    }

    int open = avcodec_open2(c, codec, NULL);
    if (open &lt; 0) {
       simbiLog("could not open codec %d", open);
       return ERROR;
    }

    infile = fopen(inputPath, "rb");
    if (!infile) {
       simbiLog("could not open %s", inputPath);
       return ERROR;
    }

    outfile = fopen(outputPath, "wb");
    if (!outfile) {
       simbiLog("could not open %s", outputPath);
       return ERROR;
    }

    avpkt.data = inbuf;
    avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, infile);
    int iterations = 0;

    while (avpkt.size > 0) {
       simbiLog("iteration %d", (++iterations));
       simbiLog("avpkt.size %d avpkt.data %X", avpkt.size, avpkt.data);
       int got_frame = 0;

       if (!decoded_frame) {
           if (!(decoded_frame = avcodec_alloc_frame())) {
               simbiLog("out of memory");
               return ERROR;
           }
       } else {
           avcodec_get_frame_defaults(decoded_frame);
       }

       //below the error, but it isn&#39;t occur on first time, only in 4th loop interation
       len = avcodec_decode_audio4(c, decoded_frame, &amp;got_frame, &amp;avpkt);
       if (len &lt; 0) {
           simbiLog("Error while decoding error %d frame %d duration %d", len, got_frame, avpkt.duration);
           return ERROR;
       } else {
           simbiLog("Decoding length %d frame %d duration %d", len, got_frame, avpkt.duration);
       }

       if (got_frame) {
           int data_size = av_samples_get_buffer_size(NULL, c->channels, decoded_frame->nb_samples, c->sample_fmt, 1);
           size_t* fwrite_size = fwrite(decoded_frame->data[0], 1, data_size, outfile);
           simbiLog("fwrite returned %d", fwrite_size);
       }
       avpkt.size -= len;
       avpkt.data += len;
       if (avpkt.size &lt; AUDIO_REFILL_THRESH) {
           memmove(inbuf, avpkt.data, avpkt.size);
           avpkt.data = inbuf;
           len = fread(avpkt.data + avpkt.size, 1, AUDIO_INBUF_SIZE - avpkt.size, infile);
           if (len > 0)
               avpkt.size += len;
           simbiLog("fread returned %d", len);
       }
    }

    fclose(outfile);
    fclose(infile);

    avcodec_close(c);
    av_free(c);
    av_free(decoded_frame);

    but I'm getting the follow log and error :

    inbuf size: 20488
    iteration 1
    avpkt.size 3305 avpkt.data BEEED40C
    Decoding length 13 frame 1 duration 0
    fwrite returned 640
    fread returned 0
    iteration 2
    avpkt.size 3292 avpkt.data BEEED40C
    Decoding length 13 frame 1 duration 0
    fwrite returned 640
    fread returned 0
    iteration 3
    avpkt.size 3279 avpkt.data BEEED40C
    Decoding length 14 frame 1 duration 0
    fwrite returned 640
    fread returned 0
    iteration 4
    avpkt.size 3265 avpkt.data BEEED40C
    Error while decoding error -1052488119 frame 0 duration 0

    the audio file I'm trying decode :

    $ avprobe blue.3gp
    avprobe version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2007-2013 the Libav developers
     built on Mar 30 2013 22:23:21 with gcc 4.7.2
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#39;blue.3gp&#39;:
     Metadata:
       major_brand     : 3gp4
       minor_version   : 0
       compatible_brands: isom3gp4
       creation_time   : 2013-09-19 18:53:38
     Duration: 00:00:01.52, start: 0.000000, bitrate: 17 kb/s
       Stream #0.0(eng): Audio: amrnb, 8000 Hz, 1 channels, flt, 12 kb/s
       Metadata:
         creation_time   : 2013-09-19 18:53:38

    thanks a lot !


    EDITED

    I read on ffmper documentation about the method avcodec_decode_audio4 the follow :

    @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE larger than the actual read bytes because some optimized bitstream readers read 32 or 64 bits at once and could read over the end.
    @note You might have to align the input buffer. The alignment requirements depend on the CPU and the decoder.

    and I see here a solution using posix_memalign, to android i founded a similar method called memalign, so i did the change :

    removed :

    uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];

    inserted :

    int inbufSize = sizeof(uint8_t) * (AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
    uint8_t *inbuf = memalign(FF_INPUT_BUFFER_PADDING_SIZE, inbufSize);
    simbiLog("inbuf size: %d", inbufSize);
    for (; inbufSize >= 0; inbufSize--)
       simbiLog("inbuf position: %d index: %p", inbufSize, &amp;inbuf[inbufSize]);

    I'm getting the correct memory sequence position, but the error not changed.

    A piece of outpout :

    inbuf position: 37 index: 0x4e43d745
    inbuf position: 36 index: 0x4e43d744
    inbuf position: 35 index: 0x4e43d743
    inbuf position: 34 index: 0x4e43d742
    inbuf position: 33 index: 0x4e43d741
    inbuf position: 32 index: 0x4e43d740
    inbuf position: 31 index: 0x4e43d73f
    inbuf position: 30 index: 0x4e43d73e
    inbuf position: 29 index: 0x4e43d73d
    inbuf position: 28 index: 0x4e43d73c
    inbuf position: 27 index: 0x4e43d73b
    inbuf position: 26 index: 0x4e43d73a
    inbuf position: 25 index: 0x4e43d739
    inbuf position: 24 index: 0x4e43d738
    inbuf position: 23 index: 0x4e43d737
    inbuf position: 22 index: 0x4e43d736
    inbuf position: 21 index: 0x4e43d735
    inbuf position: 20 index: 0x4e43d734
    inbuf position: 19 index: 0x4e43d733