Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP

Autres articles (96)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

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

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

Sur d’autres sites (9646)

  • The ffmpeg webm_dash_manifest demuxer fails with webvtt subtitles

    30 janvier 2020, par Hyldrean

    I am trying to create a DASH manifest using ffmpeg and I encounter some difficulties with the subtitles. I get the error

    [webm_dash_manifest @ 0x55e19db48180] EBML header parsing failed
    [webm_dash_manifest @ 0x55e19db48180] Failed to read file headers
    subtitles.vtt: Operation not permitted

    The subtitles are encoded in the plain text webvtt format. I first assume that the EBML header are missing because the subtitles were not contained in a webm container. I then tried to create a webm file containing only the subtitles. It appears impossible.

    I think the problem comes from the webm_dash_manifest demuxer. It seeks metadata in a file with no metadata. However neither Google nor Stack Overflow give me an answer.

    The command I used :

    ffmpeg \
    -f webm_dash_manifest -i video.webm \
    -f webm_dash_manifest -i audio.webm \
    -f webm_dash_manifest -i subtitles.vtt \
    -map 0 -map 1 -map 2 \
    -c copy \
    -f webm_dash_manifest \
    -adaptation_sets "id=0,streams=0 id=1,streams=1 id=2,stream=2" \
    minimal.mpd

    and the ffmpeg output :

    ffmpeg version 3.2.14-1~deb9u1 Copyright (c) 2000-2019 the FFmpeg developers
     built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
     configuration: --prefix=/usr --extra-version='1~deb9u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --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-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
     libavutil      55. 34.101 / 55. 34.101
     libavcodec     57. 64.101 / 57. 64.101
     libavformat    57. 56.101 / 57. 56.101
     libavdevice    57.  1.100 / 57.  1.100
     libavfilter     6. 65.100 /  6. 65.100
     libavresample   3.  1.  0 /  3.  1.  0
     libswscale      4.  2.100 /  4.  2.100
     libswresample   2.  3.100 /  2.  3.100
     libpostproc    54.  1.100 / 54.  1.100
    [webm_dash_manifest @ 0x55e19db17160] Could not find codec parameters for stream 0 (Video: vp9, none, 1280x534): unspecified pixel format
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    Input #0, webm_dash_manifest, from 'video.webm':
     Metadata:
       title           : Cloud Atlas
       ENCODER         : Lavf58.35.104
     Duration: 00:05:00.01, bitrate: 998 kb/s
       Chapter #0:0: start 0.000000, end 300.000000
       Metadata:
         title           : Chapter 01
       Stream #0:0(eng): Video: vp9, none, 1280x534, SAR 1:1 DAR 640:267, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default) (forced)
       Metadata:
         title           : Video @ 6.9 Mbps [frame B:188517 Avg QP:20.66]
         ENCODER         : Lavc58.66.100 libvpx-vp9
         DURATION        : 00:05:00.008000000
         webm_dash_manifest_duration: 300008
         webm_dash_manifest_initialization_range: 900
         webm_dash_manifest_file_name: video.webm
         webm_dash_manifest_track_number: 1
         webm_dash_manifest_cues_start: 37455991
         webm_dash_manifest_cues_end: 37457486
         webm_dash_manifest_bandwidth: 1420427
         webm_dash_manifest_cluster_keyframe: 1
         webm_dash_manifest_cue_timestamps: 298715
    Input #1, webm_dash_manifest, from 'audio.webm':
     Metadata:
       title           : Cloud Atlas
       ENCODER         : Lavf58.35.104
     Duration: 00:05:00.01, bitrate: 126 kb/s
       Chapter #1:0: start 0.000000, end 300.000000
       Metadata:
         title           : Chapter 01
       Stream #1:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
       Metadata:
         title           : Audio Eng DTS 5.1 channels 24 bits @ 1509 Kbps cbr
         ENCODER         : Lavc58.66.100 libopus
         DURATION        : 00:05:00.007000000
         webm_dash_manifest_duration: 300007
         webm_dash_manifest_initialization_range: 838
         webm_dash_manifest_file_name: audio.webm
         webm_dash_manifest_track_number: 1
         webm_dash_manifest_cues_start: 4744091
         webm_dash_manifest_cues_end: 4745279
         webm_dash_manifest_bandwidth: 137531
         webm_dash_manifest_cluster_keyframe: 1
         webm_dash_manifest_cue_timestamps: 295000
    [webm_dash_manifest @ 0x55e19db48180] EBML header parsing failed
    [webm_dash_manifest @ 0x55e19db48180] Failed to read file headers
    subtitles.vtt: Operation not permitted

    I noticed that ffmpeg -f webm_dash_manifest -i subtitles.vtt suffices to reproduce the error.

    I have also tried without the -f webm_dash_manifest flag, with no success :

    ffmpeg \
    -f webm_dash_manifest -i video.webm \
    -f webm_dash_manifest -i audio.webm \
    -i subtitles.vtt \
    -map 0 -map 1 -map 2 \
    -c copy \
    -f webm_dash_manifest \
    -adaptation_sets "id=0,streams=0 id=1,streams=1 id=2,stream=2" minimal.mpd

    Output :

    ffmpeg version 3.2.14-1~deb9u1 Copyright (c) 2000-2019 the FFmpeg developers
     built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
     configuration: --prefix=/usr --extra-version='1~deb9u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --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-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
     libavutil      55. 34.101 / 55. 34.101
     libavcodec     57. 64.101 / 57. 64.101
     libavformat    57. 56.101 / 57. 56.101
     libavdevice    57.  1.100 / 57.  1.100
     libavfilter     6. 65.100 /  6. 65.100
     libavresample   3.  1.  0 /  3.  1.  0
     libswscale      4.  2.100 /  4.  2.100
     libswresample   2.  3.100 /  2.  3.100
     libpostproc    54.  1.100 / 54.  1.100
    [webm_dash_manifest @ 0x557f55dd1160] Could not find codec parameters for stream 0 (Video: vp9, none, 1280x534): unspecified pixel format
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    Input #0, webm_dash_manifest, from 'video.webm':
     Metadata:
       title           : Cloud Atlas
       ENCODER         : Lavf58.35.104
     Duration: 00:05:00.01, bitrate: 998 kb/s
       Chapter #0:0: start 0.000000, end 300.000000
       Metadata:
         title           : Chapter 01
       Stream #0:0(eng): Video: vp9, none, 1280x534, SAR 1:1 DAR 640:267, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default) (forced)
       Metadata:
         title           : Video @ 6.9 Mbps [frame B:188517 Avg QP:20.66]
         ENCODER         : Lavc58.66.100 libvpx-vp9
         DURATION        : 00:05:00.008000000
         webm_dash_manifest_duration: 300008
         webm_dash_manifest_initialization_range: 900
         webm_dash_manifest_file_name: video.webm
         webm_dash_manifest_track_number: 1
         webm_dash_manifest_cues_start: 37455991
         webm_dash_manifest_cues_end: 37457486
         webm_dash_manifest_bandwidth: 1420427
         webm_dash_manifest_cluster_keyframe: 1
         webm_dash_manifest_cue_timestamps: 298715
    Input #1, webm_dash_manifest, from 'audio.webm':
     Metadata:
       title           : Cloud Atlas
       ENCODER         : Lavf58.35.104
     Duration: 00:05:00.01, bitrate: 126 kb/s
       Chapter #1:0: start 0.000000, end 300.000000
       Metadata:
         title           : Chapter 01
       Stream #1:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
       Metadata:
         title           : Audio Eng DTS 5.1 channels 24 bits @ 1509 Kbps cbr
         ENCODER         : Lavc58.66.100 libopus
         DURATION        : 00:05:00.007000000
         webm_dash_manifest_duration: 300007
         webm_dash_manifest_initialization_range: 838
         webm_dash_manifest_file_name: audio.webm
         webm_dash_manifest_track_number: 1
         webm_dash_manifest_cues_start: 4744091
         webm_dash_manifest_cues_end: 4745279
         webm_dash_manifest_bandwidth: 137531
         webm_dash_manifest_cluster_keyframe: 1
         webm_dash_manifest_cue_timestamps: 295000
    Input #2, webvtt, from 'subtitles.vtt':
     Duration: N/A, bitrate: N/A
       Stream #2:0: Subtitle: webvtt
    Could not write header for output file #0 (incorrect codec parameters ?): Operation not permittedStream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #1:0 -> #0:1 (copy)
     Stream #2:0 -> #0:2 (copy)
       Last message repeated 1 times

    Note : [webm_dash_manifest @ 0x557f55dd1160] Could not find codec parameters for stream 0 (Video: vp9, none, 1280x534): unspecified pixel format is harmless according to this post.

    The subtitles have been extracted with ffmpeg :

    ffmpeg -i "Cloud Atlas.mkv" -map 0:6 -t 00:05:00 -c:s webvtt -dash 1 subtitles.vtt

    Thank you for reading my long post, I have no idea what to do next.

    EDIT : The WebM Project website says : ’Initial WebM release does not support subtitles’. Has someone heard of a new release ? Or a convenient way to create DASH manifest with subtitles ?

  • Call to avformat_find_stream_info prevents decoding of simple PNG image ?

    10 avril 2014, par kloffy

    I am running into a problem decoding a simple PNG image with libav. The decode_ok flag after the call to avcodec_decode_video2 is set to 0, even though the packet contains the entire image. Through some experimentation, I have managed to pinpoint the issue and it seems related to calling avformat_find_stream_info. If the call is removed, the example runs successfully. However, I would like to use the same code for other media, and calling avformat_find_stream_info is recommended in the documentation.

    The following minimal example illustrates the behavior (unfortunately still a bit lengthy) :

    #include <iostream>

    extern "C"
    {
    #include <libavformat></libavformat>avformat.h>
    #include <libavcodec></libavcodec>avcodec.h>
    }

    // Nothing to see here, it&#39;s just a helper function
    AVCodecContext* open(AVMediaType mediaType, AVFormatContext* formatContext)
    {
       auto ret = 0;
       if ((ret = av_find_best_stream(formatContext, mediaType, -1, -1, nullptr, 0)) &lt; 0)
       {
           std::cerr &lt;&lt; "Failed to find video stream." &lt;&lt; std::endl;
           return nullptr;
       }

       auto codecContext = formatContext->streams[ret]->codec;
       auto codec = avcodec_find_decoder(codecContext->codec_id);
       if (!codec)
       {
           std::cerr &lt;&lt; "Failed to find codec." &lt;&lt; std::endl;
           return nullptr;
       }

       if ((ret = avcodec_open2(codecContext, codec, nullptr)) != 0)
       {
           std::cerr &lt;&lt; "Failed to open codec context." &lt;&lt; std::endl;
           return nullptr;
       }

       return codecContext;
    }

    // All the interesting bits are here
    int main(int argc, char* argv[])
    {
       auto path = "/path/to/test.png"; // Replace with valid path to PNG
       auto ret = 0;

       av_log_set_level(AV_LOG_DEBUG);

       av_register_all();
       avcodec_register_all();

       auto formatContext = avformat_alloc_context();
       if ((ret = avformat_open_input(&amp;formatContext, path, NULL, NULL)) != 0)
       {
           std::cerr &lt;&lt; "Failed to open input." &lt;&lt; std::endl;
           return -1;
       }
       av_dump_format(formatContext, 0, path, 0);

    //*/ Info is successfully found, but interferes with decoding
       if((ret = avformat_find_stream_info(formatContext, nullptr)) &lt; 0)
       {
           std::cerr &lt;&lt; "Failed to find stream info." &lt;&lt; std::endl;
           return -1;
       }
       av_dump_format(formatContext, 0, path, 0);
    //*/

       auto codecContext = open(AVMEDIA_TYPE_VIDEO, formatContext);

       AVPacket packet;
       av_init_packet(&amp;packet);

       if ((ret = av_read_frame(formatContext, &amp;packet)) &lt; 0)
       {
           std::cerr &lt;&lt; "Failed to read frame." &lt;&lt; std::endl;
           return -1;
       }

       auto frame = av_frame_alloc();
       auto decode_ok = 0;
       if ((ret = avcodec_decode_video2(codecContext, frame, &amp;decode_ok, &amp;packet)) &lt; 0 || !decode_ok)
       {
           std::cerr &lt;&lt; "Failed to decode frame." &lt;&lt; std::endl;
           return -1;
       }

       av_frame_free(&amp;frame);
       av_free_packet(&amp;packet);

       avcodec_close(codecContext);

       avformat_close_input(&amp;formatContext);
       av_free(formatContext);

       return 0;
    }
    </iostream>

    The format dump before avformat_find_stream_info prints :

    Input #0, image2, from '/path/to/test.png' :
      Duration : N/A, bitrate : N/A
        Stream #0:0, 0, 1/25 : Video : png, 25 tbn

    The format dump after avformat_find_stream_info prints :

    Input #0, image2, from '/path/to/test.png' :
      Duration : 00:00:00.04, start : 0.000000, bitrate : N/A
        Stream #0:0, 1, 1/25 : Video : png, rgba, 512x512 [SAR 3780:3780 DAR 1:1], 1/25, 25 tbr, 25 tbn, 25 tbc

    So it looks like the search yields potentially useful information. Can anybody shed some light on this problem ? Other image formats seem to work fine. I assume that this is a simple user error rather than a bug.

    Edit : Debug logging was already enabled, but the PNG decoder does not produce a lot of output. I have also tried setting a custom logging callback.

    Here is what I get without the call to avformat_find_stream_info, when decoding succeeds :

    Statistics : 52125 bytes read, 0 seeks

    And here is what I get with the call to avformat_find_stream_info, when decoding fails :

    Statistics : 52125 bytes read, 0 seeks
    

    detected 8 logical cores

    The image is 52125 bytes, so the whole file is read. I am not sure what the logical cores are referring to.

  • avformat/mov : fix seeking with HEVC open GOP files

    18 février 2022, par Clément Bœsch
    avformat/mov : fix seeking with HEVC open GOP files
    

    This was tested with medias recorded from an iPhone XR and an iPhone 13.

    Here is how a typical stream looks like in coding order :

    ┌────────┬─────┬─────┬──────────┐
    │ sample | PTS | DTS | keyframe |
    ├────────┼─────┼─────┼──────────┤
    ┊ ┊ ┊ ┊ ┊
    │ 53 │ 560 │ 510 │ No │
    │ 54 │ 540 │ 520 │ No │
    │ 55 │ 530 │ 530 │ No │
    │ 56 │ 550 │ 540 │ No │
    │ 57 │ 600 │ 550 │ Yes │
    │ * 58 │ 580 │ 560 │ No │
    │ * 59 │ 570 │ 570 │ No │
    │ * 60 │ 590 │ 580 │ No │
    │ 61 │ 640 │ 590 │ No │
    │ 62 │ 620 │ 600 │ No │
    ┊ ┊ ┊ ┊ ┊

    In composition/display order :

    ┌────────┬─────┬─────┬──────────┐
    │ sample | PTS | DTS | keyframe |
    ├────────┼─────┼─────┼──────────┤
    ┊ ┊ ┊ ┊ ┊
    │ 55 │ 530 │ 530 │ No │
    │ 54 │ 540 │ 520 │ No │
    │ 56 │ 550 │ 540 │ No │
    │ 53 │ 560 │ 510 │ No │
    │ * 59 │ 570 │ 570 │ No │
    │ * 58 │ 580 │ 560 │ No │
    │ * 60 │ 590 │ 580 │ No │
    │ 57 │ 600 │ 550 │ Yes │
    │ 63 │ 610 │ 610 │ No │
    │ 62 │ 620 │ 600 │ No │
    ┊ ┊ ┊ ┊ ┊

    Sample/frame 58, 59 and 60 are B-frames which actually depends on the
    key frame (57). Here the key frame is not an IDR but a "CRA" (Clean
    Random Access).

    Initially, I thought I could rely on the sdtp box (independent and
    disposable samples), but unfortunately :

    sdtp[54] is_leading:0 sample_depends_on:1 sample_is_depended_on:0 sample_has_redundancy:0
    sdtp[55] is_leading:0 sample_depends_on:1 sample_is_depended_on:2 sample_has_redundancy:0
    sdtp[56] is_leading:0 sample_depends_on:1 sample_is_depended_on:2 sample_has_redundancy:0
    sdtp[57] is_leading:0 sample_depends_on:2 sample_is_depended_on:0 sample_has_redundancy:0
    sdtp[58] is_leading:0 sample_depends_on:1 sample_is_depended_on:0 sample_has_redundancy:0
    sdtp[59] is_leading:0 sample_depends_on:1 sample_is_depended_on:2 sample_has_redundancy:0
    sdtp[60] is_leading:0 sample_depends_on:1 sample_is_depended_on:2 sample_has_redundancy:0
    sdtp[61] is_leading:0 sample_depends_on:1 sample_is_depended_on:0 sample_has_redundancy:0
    sdtp[62] is_leading:0 sample_depends_on:1 sample_is_depended_on:0 sample_has_redundancy:0

    The information that might have been useful here would have been
    is_leading, but all the samples are set to 0 so this was unusable.

    Instead, we need to rely on sgpd/sbgp tables. In my case the video track
    contained 3 sgpd tables with the following grouping types : tscl, sync
    and tsas. In the sync table we have the following 2 entries (only) :

    sgpd.sync[1] : sync nal_unit_type:0x14
    sgpd.sync[2] : sync nal_unit_type:0x15

    (The count starts at 1 because 0 carries the undefined semantic, we'll
    see that later in the reference table).

    The NAL unit types presented here correspond to :

    libavcodec/hevc.h : HEVC_NAL_IDR_N_LP = 20,
    libavcodec/hevc.h : HEVC_NAL_CRA_NUT = 21,

    In parallel, the sbgp sync table contains the following :

    ┌────┬───────┬─────┐
    │ id │ count │ gdi │
    ├────┼───────┼─────┤
    │ 0 │ 1 │ 1 │
    │ 1 │ 56 │ 0 │
    │ 2 │ 1 │ 2 │
    │ 3 │ 59 │ 0 │
    │ 4 │ 1 │ 2 │
    │ 5 │ 59 │ 0 │
    │ 6 │ 1 │ 2 │
    │ 7 │ 59 │ 0 │
    │ 8 │ 1 │ 2 │
    │ 9 │ 59 │ 0 │
    │ 10 │ 1 │ 2 │
    │ 11 │ 11 │ 0 │
    └────┴───────┴─────┘

    The gdi column (group description index) directly refers to the index in
    the sgpd.sync table. This means the first frame is an IDR, then we have
    batches of undefined frames interlaced with CRA frames. No IDR ever
    appears again (tried on a 30+ seconds sample).

    With that information, we can build an heuristic using the presentation
    order.

    A few things needed to be introduced in this commit :

    1. min_sample_duration is extracted from the stts : we need the minimal
    step between sample in order to PTS-step backward to a valid point
    2. In order to avoid a loop over the ctts table systematically during a
    seek, we build an expanded list of sample offsets which will be used
    to translate from DTS to PTS
    3. An open_key_samples index to keep track of all the non-IDR key
    frames ; for now it only supports HEVC CRA frames. We should probably
    add BLA frames as well, but I don't have any sample so I prefered to
    leave that for later

    It is entirely possible I missed something obvious in my approach, but I
    couldn't come up with a better solution. Also, as mentioned in the diff,
    we could optimize is_open_key_sample(), but the linear scaling overhead
    should be fine for now since it only happens in seek events.

    Fixing this issue prevents sending broken packets to the decoder. With
    FFmpeg hevc decoder the frames are skipped, with VideoToolbox the frames
    are glitching.

    • [DH] libavformat/isom.h
    • [DH] libavformat/mov.c