Advanced search

Medias (91)

Other articles (29)

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 January 2010, by

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation; Oggz-tools : outils d’inspection de fichiers ogg; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores;
    Binaires complémentaires et facultatifs flvtool2 : extraction / (...)

  • Support audio et vidéo HTML5

    10 April 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 (...)

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

    31 January 2010, by

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

On other websites (2277)

  • hls fails to play m3u8 playlist with videojs

    9 November 2020, by charlie

    I created an hls stream from yuv frames with ffmpeg which appears to work just fine. It creates a playlist and updates that, and all .ts files as expected. However even videojs refuses to play it, and I really run out of ideas, probably missing the obvious?

    


    First, the m3u8 list which is continuously updated:

    


    #EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:2
#EXT-X-MEDIA-SEQUENCE:190
#EXTINF:2.000000,
test190.ts
#EXTINF:2.000000,
test191.ts
#EXTINF:2.000000,
test192.ts
#EXTINF:2.000000,
test193.ts
#EXTINF:2.000000,
test194.ts


    


    Those .ts files exist and have sizes of approx 250 kBytes.
Then, I open this standard videojs html file (residing in the same directory):

    


    &#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;&#xA;&#xA;  <h1>VSTream</h1>&#xA;&#xA;  &#xA;    <source src="test.m3u8" type="application/x-mpegURL">&#xA;  &#xA;  &#xA;  <code class="echappe-js">&lt;script src='http://stackoverflow.com/feeds/tag/video.min.js'&gt;&lt;/script&gt;&#xA;  &lt;script src='http://stackoverflow.com/feeds/tag/videojs-http-streaming.min.js'&gt;&lt;/script&gt;&#xA;  &#xA;  &lt;script&gt;&amp;#xA;    var player = videojs(&amp;#x27;my_video_1&amp;#x27;);&amp;#xA;  &lt;/script&gt;&#xA;  &#xA;&#xA;&#xA;

    &#xA;

    I open this in Firefox (or Chrome, or Edge, none works) and use its debugger which in the console shows:

    &#xA;

    &#xA;

    VIDEOJS: WARN: A plugin named "reloadSourceOnError" already exists.&#xA;You may want to avoid re-registering plugins! video.min.js:12:977&#xA;Specified “type” attribute of “application/x-mpegURL” is not&#xA;supported. Load of media resource test.m3u8 failed. vstream.html All&#xA;candidate resources failed to load. Media load paused. vstream.html&#xA;XML Parsing Error: syntax error Location: file:///C:/test/test.m3u8&#xA;Line Number 1, Column 1: 2 test.m3u8:1:1 MouseEvent.mozPressure is&#xA;deprecated. Use PointerEvent.pressure instead. video.min.js:12:9031&#xA;VIDEOJS: ERROR: (CODE:3 MEDIA_ERR_DECODE) Playback cannot continue. No&#xA;available working or supported playlists. Object code: 3, message:&#xA;"Playback cannot continue. No available working or supported&#xA;playlists." video.min.js:12:977

    &#xA;

    &#xA;

    This doesn't make much sense to me. Why would it throw an XML parsing error for an m3u8 file? Of course, the MEDIA_ERR_DECODE points in some direction, but the same problem persists with fMP4 files.

    &#xA;

    The relevant ffmpeg c++ code (format is "hls" and formatContext works well in other scenarios, gop is 2):

    &#xA;

        AVDictionary* options = 0;&#xA;    if (fragmented)&#xA;    {&#xA;        // type&#xA;        if (codecID == AV_CODEC_ID_H264)&#xA;            av_dict_set (&amp;options, "hls_segment_type", "fmp4", 0);&#xA;        else&#xA;            av_dict_set (&amp;options, "hls_segment_type", "mpegts", 0);&#xA;&#xA;        av_dict_set (&amp;options, "hls_time", "2.0", 0);&#xA;        av_dict_set_int (&amp;options, "hls_list_size", 5, 0);&#xA;        av_dict_set (&amp;options, "hls_flags", "delete_segments", 0);&#xA;    }&#xA;&#xA;    int ret = avformat_write_header (formatContext, &amp;options);&#xA;

    &#xA;

    ...which returns success. Then writing frames

    &#xA;

        int ret = avcodec_send_frame (videoStream->codecContext, frame);&#xA;    av_init_packet (avPacket);&#xA;    AVRational timeBase = videoStream->getTimeBase ();&#xA;    avPacket->stream_index = streams.indexOf (videoStream);&#xA;    ret = avcodec_receive_packet (videoStream->codecContext, avPacket);&#xA;    avPacket->duration = av_rescale_q (1, videoStream->codecContext->time_base, videoStream->getTimeBase ());&#xA;    pts &#x2B;= avPacket->duration;&#xA;    avPacket->pts = pts;&#xA;    avPacket->dts = pts;    //  AV_NOPTS_VALUE;&#xA;    ret = av_interleaved_write_frame (formatContext, avPacket);&#xA;

    &#xA;

    (videoStream here is an internal object representing the avstream).&#xA;I've omitted error checks for clarity. All return values show success.&#xA;Thanks for any help on this!

    &#xA;

  • HLS playlist of self-contained fmp4 segments

    16 October 2020, by Mathieu

    I am working on a VMS that stores 10 second long video segments in MPEGTS format. Those segments can then be streamed using HLS, with playlists that look like this:

    &#xA;

    #EXTM3U&#xA;#EXT-X-INDEPENDENT-SEGMENTS&#xA;#EXT-X-VERSION:6&#xA;#EXT-X-TARGETDURATION:11&#xA;#EXT-X-PLAYLIST-TYPE:EVENT&#xA;#EXT-X-START:TIME-OFFSET=1.0,PRECISE=YES&#xA;#EXTINF:10,&#xA;1602816779831000000.ts&#xA;#EXTINF:10,&#xA;1602816789831000000.ts&#xA;#EXT-X-ENDLIST&#xA;

    &#xA;

    This is working great as long as those files are encoded in h.264. However, if I try creating a similar playlist using h.265 segments, it works only with our Android client, Apple and hls.js having decided to support h.265 HLS using fragmented MP4 only.

    &#xA;

    "Natively" supporting h.265 by storing fmp4 files directly isn't an option for me, so I would like to transpackage those MPEGTS files to fmp4 on demand.

    &#xA;

    So what I have attempted to do is, return this playlist instead (changing only the file extension):

    &#xA;

    #EXTM3U&#xA;#EXT-X-INDEPENDENT-SEGMENTS&#xA;#EXT-X-VERSION:6&#xA;#EXT-X-TARGETDURATION:11&#xA;#EXT-X-PLAYLIST-TYPE:EVENT&#xA;#EXT-X-START:TIME-OFFSET=1.0,PRECISE=YES&#xA;#EXTINF:10,&#xA;1602816779831000000.mp4&#xA;#EXTINF:10,&#xA;1602816789831000000.mp4&#xA;#EXT-X-ENDLIST&#xA;

    &#xA;

    and then lazily transpackage those MPEGTS files to fmp4 one by one using FFMPEG as they are getting requested:

    &#xA;

    ffmpeg -i 1602816779831000000.ts -c copy -movflags frag_keyframe&#x2B;empty_moov&#x2B;default_base_moof 1602816779831000000.mp4&#xA;ffmpeg -i 1602816789831000000.ts -c copy -movflags frag_keyframe&#x2B;empty_moov&#x2B;default_base_moof 1602816789831000000.mp4&#xA;

    &#xA;

    Unfortunately, this seems to work only for playlists with a single segment (which means, up to 10 seconds in my case). As soon as I have 2+ files, it doesn't work, with a behavior that changes depending on which client I'm using: some will play the first file then stop, some will fast forward to the last file then play this one instead, some won't play at all...

    &#xA;

    I understand that the "normal" approach for fmp4 streaming over HLS is to use a "media initialization" segment and put it in a #EXT-X-MAP header for each segment, which are then usually encoded as *.m4s files instead of *.mp4. However, is it possible to make fmp4 work over HLS with self-contained segments, similarly to what we can do with MPEGTS? Since playlists with a single entry seem to support that, I would assume there is probably a way to do so.

    &#xA;

    Also, I know Apple got inspired by MPEG-DASH for this part of the HLS spec, and from what I understand, this is possible in MPEG-DASH.

    &#xA;

  • ffmpeg only posting playlist but not segments for HLS

    13 October 2020, by Yanick Salzmann

    I am launching an ffmpeg process that is supposed to send the HLS "encoded" data to a webserver that will distribute it to the clients requesting it. I am using the following command line:

    &#xA;

                    "ffmpeg",&#xA;                "-hide_banner",&#xA;                "-f", "rawvideo",&#xA;                "-pixel_format", "rgb32",&#xA;                "-video_size", "800x600",&#xA;                "-framerate", "22",&#xA;                "-i", "-",&#xA;                "-f", "hls",&#xA;                "-c:v", "libx264",&#xA;                "-crf", "17",&#xA;                "-preset", "ultrafast",&#xA;                "-hls_time", "1",&#xA;                "-flags", "&#x2B;cgop",&#xA;                "-g", "30",&#xA;                "-hls_segment_filename", "%d.ts",&#xA;                "-method", "POST",&#xA;                fmt::format("http://localhost:8082/video/{}/live.m3u8", _uuid)&#xA;

    &#xA;

    or specifically ffmpeg -hide_banner -f rawvideo -pixel_format rgb32 -video_size 800x600 -framerate 22 -i - -f hls -c:v libx264 -crf 17 -preset ultrafast -hls_time 1 -flags &#x2B;cgop -g 30 -hls_segment_filename %d.ts -method POST http://localhost:8082/video/ee811a74-7a48-4c4e-8c82-371c1cbbff05/live.m3u8

    &#xA;

    The first few lines of the output look fine:

    &#xA;

    [hls @ 0x224aeb0] Opening &#x27;0.ts&#x27; for writing&#xA;Output #0, hls, to &#x27;http://localhost:8082/video/ee811a74-7a48-4c4e-8c82-371c1cbbff05/live.m3u8&#x27;:&#xA;

    &#xA;

    The file name was picked up, the URL was also properly recognized. After the first file has been generated I also get a POST request to the URL mentioned above with the live.m3u8 containing the following playlist:

    &#xA;

    #EXTM3U&#xA;#EXT-X-VERSION:3&#xA;#EXT-X-TARGETDURATION:1&#xA;#EXT-X-MEDIA-SEQUENCE:0&#xA;#EXTINF:1.363667,&#xA;0.ts&#xA;

    &#xA;

    But I do not get the 0.ts file posted to my webserver. This continues like that, the playlist keeps getting updated, but no segment files are posted to my server. They are all written to the disk and stay there forever.

    &#xA;

    Am I missing a flag?

    &#xA;