Opened 15 months ago

Last modified 15 months ago

#10247 new defect

play of webm dash live not working

Reported by: razvan Owned by:
Priority: normal Component: ffmpeg
Version: git-master Keywords: webm dash live
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by razvan)

I'm following the instructions from here

http://wiki.webmproject.org/adaptive-streaming/instructions-to-do-webm-live-streaming-via-dash

to create a dash live stream.
I want an audio only stream so I removed from above the video.

Ubuntu 22.04, latest ffmpeg,ffplay compiled from git, lighttpd and latest shaka player from git (in firefox/chrome)

These are the ffmpeg commands I used and their output
* to create the chunks

ffmpeg \
  -stream_loop -1 -re -i $HOME/.stream-dash/test.flac \
  -map 0:0 \
  -c:a libvorbis \
    -b:a 128k -ar 44100 -ac 2 -dash 1 \
  -f webm_chunk \
    -audio_chunk_duration 2000 \
    -header /dev/shm/dash/sunet_5.hdr \
    -chunk_start_index 1 \
  /dev/shm/dash/sunet_5_%d.chk 

ffmpeg version N-109970-g7dc0944ce2-09.mar.2023 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.3.0-1ubuntu1~22.04)
  configuration: --prefix=/dev/shm/ffmpeg/build --pkg-config-flags=--static --extra-cflags=-I/dev/shm/ffmpeg/build/include --extra-ldflags=-L/dev/shm/ffmpeg/build/lib --extra-ldflags=-L/usr/lib/x86_64-linux-gnu --extra-libs='-lpthread -lm' --ld=g++ --bindir=/dev/shm/ffmpeg/bin --extra-version=09.mar.2023 --arch=x86_64 --enable-gpl --enable-version3 --enable-gnutls --enable-libass --enable-libfreetype --enable-libfontconfig --enable-libcaca --enable-libcodec2 --enable-libmp3lame --enable-libvorbis --enable-opengl --enable-libpulse --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-libopus --enable-libvpx --enable-libdav1d --enable-libvmaf --enable-libxvid --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libtheora --enable-libvidstab --enable-libxml2 --enable-lv2 --enable-libxcb --enable-libxcb-shm --enable-libzmq --enable-libzimg --enable-nonfree
  libavutil      58.  3.100 / 58.  3.100
  libavcodec     60.  6.100 / 60.  6.100
  libavformat    60.  4.100 / 60.  4.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  4.100 /  9.  4.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Input #0, flac, from '/home/raz/.stream-dash/test.flac':
  Duration: 00:06:41.59, start: 0.000000, bitrate: 379 kb/s
  Stream #0:0: Audio: flac, 44100 Hz, mono, s16
Stream mapping:
  Stream #0:0 -> #0:0 (flac (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help
[webm_chunk @ 0x564b178b2bc0] Opening '/dev/shm/dash/sunet_5.hdr' for writing
Output #0, webm_chunk, to '/dev/shm/dash/sunet_5_%d.chk':
  Metadata:
    encoder         : Lavf60.4.100
  Stream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc60.6.100 libvorbis
[webm_chunk @ 0x564b178b2bc0] Opening '/dev/shm/dash/sunet_5_1.chk' for writing
[webm_chunk @ 0x564b178b2bc0] Opening '/dev/shm/dash/sunet_5_2.chk' for writing
[webm_chunk @ 0x564b178b2bc0] Opening '/dev/shm/dash/sunet_5_3.chk' for writing
[webm_chunk @ 0x564b178b2bc0] Opening '/dev/shm/dash/sunet_5_4.chk' for writing
[webm_chunk @ 0x564b178b2bc0] Opening '/dev/shm/dash/sunet_5_5.chk' for writing
[webm_chunk @ 0x564b178b2bc0] Opening '/dev/shm/dash/sunet_5_6.chk' for writing
....
....

* to create the manifest

  
ffmpeg \
  -f webm_dash_manifest -live 1 \
  -i /dev/shm/dash/sunet_5.hdr \
  -c copy \
  -map 0 \
  -f webm_dash_manifest -live 1 \
    -adaptation_sets "id=0,streams=0" \
    -chunk_start_index 1 \
    -chunk_duration_ms 2000 \
    -time_shift_buffer_depth 10 \
    -minimum_update_period 7200 \
    -utc_timing_url "http://192.168.1.2:5050/time.php" \
  /dev/shm/dash/sunet.mpd


ffmpeg version N-109970-g7dc0944ce2-09.mar.2023 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.3.0-1ubuntu1~22.04)
  configuration: --prefix=/dev/shm/ffmpeg/build --pkg-config-flags=--static --extra-cflags=-I/dev/shm/ffmpeg/build/include --extra-ldflags=-L/dev/shm/ffmpeg/build/lib --extra-ldflags=-L/usr/lib/x86_64-linux-gnu --extra-libs='-lpthread -lm' --ld=g++ --bindir=/dev/shm/ffmpeg/bin --extra-version=09.mar.2023 --arch=x86_64 --enable-gpl --enable-version3 --enable-gnutls --enable-libass --enable-libfreetype --enable-libfontconfig --enable-libcaca --enable-libcodec2 --enable-libmp3lame --enable-libvorbis --enable-opengl --enable-libpulse --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-libopus --enable-libvpx --enable-libdav1d --enable-libvmaf --enable-libxvid --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libtheora --enable-libvidstab --enable-libxml2 --enable-lv2 --enable-libxcb --enable-libxcb-shm --enable-libzmq --enable-libzimg --enable-nonfree
  libavutil      58.  3.100 / 58.  3.100
  libavcodec     60.  6.100 / 60.  6.100
  libavformat    60.  4.100 / 60.  4.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  4.100 /  9.  4.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Input #0, webm_dash_manifest, from '/dev/shm/dash/sunet_5.hdr':
  Metadata:
    ENCODER         : Lavf60.4.100
  Duration: N/A, bitrate: N/A
  Stream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp
    Metadata:
      ENCODER         : Lavc60.6.100 libvorbis
      webm_dash_manifest_file_name: sunet_5.hdr
      webm_dash_manifest_track_number: 1
Output #0, webm_dash_manifest, to '/dev/shm/dash/sunet.mpd':
  Metadata:
    encoder         : Lavf60.4.100
  Stream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp
    Metadata:
      ENCODER         : Lavc60.6.100 libvorbis
      webm_dash_manifest_file_name: sunet_5.hdr
      webm_dash_manifest_track_number: 1
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=       1kB time=-577014:32:22.77 bitrate=N/A speed=N/A    ed=N/A    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: unknown

In the script that start ffmpeg I have:

  • start ffmpeg webm_chunk creation in background
  • sleep 2
  • run ffmpeg webm_dash_manifest

Use shaka player to play the stream

If I start the play right after starting stream creation with ffmpeg, shaka play the stream with no errors in browser console
But after 1 minute, these shaka report these errors in browser console:

media_source_engine.js:850 
Possible encoding problem detected! Unexpected buffered range for reference shaka.media.SegmentReference 
{startTime: 104, endTime: 106, trueEndTime: 106, startByte: 0, getUrisInner: ƒ, …} 
from URIs ['https://xxx/dash/sunet_5_54.chk'] should be {start: 104, end: 106} but got {start: 104.986, end: 107.006}
...
...
media_source_engine.js:850 
Possible encoding problem detected! Unexpected buffered range for reference shaka.media.SegmentReference 
{startTime: 322, endTime: 324, trueEndTime: 324, startByte: 0, getUrisInner: ƒ, …} f
rom URIs ['https://xxx/dash/sunet_5_162.chk'] should be {start: 322, end: 324} but got {start: 324.852, end: 326.858}
...
...
media_source_engine.js:850 Possible encoding problem detected! Unexpected buffered range for reference 
shaka.media.SegmentReference {startTime: 394, endTime: 396, trueEndTime: 396, startByte: 0, getUrisInner: ƒ, …} 
from URIs ['https://xxx/dash/sunet_5_198.chk'] should be {start: 394, end: 396} but got {start: 397.225, end: 399.256}

every time the issue start with the same chunk , sunet_5_54.chk
and are reported for every chunk after that.
Start, End discrepancy increase from chunk to chunk.

Shaka continue to play smoothly for a while even if these errors are reported.

But if I try to play the stream around 1 minute after I started ffmpeg, some different errors are reported,
(I think shaka is asking for chunks not created yet) and no play is possible.

Use ffplay to play the stream

ffplay request from the lighttpd chunks in future, that are not yet created, like 3-4 number in the future

ffplay http://192.168.1.2:5050/dash/sunet.mpd

ffplay version N-109970-g7dc0944ce2-09.mar.2023 Copyright (c) 2003-2023 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.3.0-1ubuntu1~22.04)
  configuration: --prefix=/dev/shm/ffmpeg/build --pkg-config-flags=--static --extra-cflags=-I/dev/shm/ffmpeg/build/include --extra-ldflags=-L/dev/shm/ffmpeg/build/lib --extra-ldflags=-L/usr/lib/x86_64-linux-gnu --extra-libs='-lpthread -lm' --ld=g++ --bindir=/dev/shm/ffmpeg/bin --extra-version=09.mar.2023 --arch=x86_64 --enable-gpl --enable-version3 --enable-gnutls --enable-libass --enable-libfreetype --enable-libfontconfig --enable-libcaca --enable-libcodec2 --enable-libmp3lame --enable-libvorbis --enable-opengl --enable-libpulse --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-libopus --enable-libvpx --enable-libdav1d --enable-libvmaf --enable-libxvid --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libtheora --enable-libvidstab --enable-libxml2 --enable-lv2 --enable-libxcb --enable-libxcb-shm --enable-libzmq --enable-libzimg --enable-nonfree
  libavutil      58.  3.100 / 58.  3.100
  libavcodec     60.  6.100 / 60.  6.100
  libavformat    60.  4.100 / 60.  4.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  4.100 /  9.  4.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
[http @ 0x7f9b2400a480] HTTP error 404 Not FoundB sq=    0B f=0/0   
[dash @ 0x7f9b24000c80] Failed to open fragment of playlist
[http @ 0x7f9b240099c0] HTTP error 404 Not Found
[dash @ 0x7f9b24000c80] Failed to open fragment of playlist
[http @ 0x7f9b24008580] HTTP error 404 Not Found
[dash @ 0x7f9b24000c80] Failed to open fragment of playlist
[http @ 0x7f9b24008640] HTTP error 404 Not Found
[dash @ 0x7f9b24000c80] Failed to open fragment of playlist
...
...

from lighttpd access log, when ffplay asked for sunet_5_29.chk, ffmpeg created sunet_5_26.chk

11:58:35  -  "GET /dash/sunet.mpd HTTP/1.1"  206  1047  "-"  "Lavf/60.4.100"
11:58:35  -  "GET /dash/sunet_5.hdr HTTP/1.1"  200  4688  "-"  "Lavf/60.4.100"
11:58:35  -  "GET /dash/sunet_5_29.chk HTTP/1.1"  404  341  "-"  "Lavf/60.4.100" 
11:58:35  -  "GET /dash/sunet_5_30.chk HTTP/1.1"  404  341  "-"  "Lavf/60.4.100"
11:58:35  -  "GET /dash/sunet_5_31.chk HTTP/1.1"  404  341  "-"  "Lavf/60.4.100"
11:58:35  -  "GET /dash/sunet_5_32.chk HTTP/1.1"  404  341  "-"  "Lavf/60.4.100"

If I increase the sleep to 5 seconds between ffmpeg chunk creation and mpd creation,
then ffplay can play the stream (it seems it ask for the right chunk).
After some 2 minutes playing I stop/start ffplay and it is again asking for chunk in the future.

I think either is something incorrect with the manifest, or the chunks created, or something I don't know and don't use correctly.

Thanks

Change History (3)

comment:1 by razvan, 15 months ago

Description: modified (diff)

comment:2 by razvan, 15 months ago

Description: modified (diff)

comment:3 by razvan, 15 months ago

Summary: ffmpeg webm dash liveplay of webm dash live not working
Note: See TracTickets for help on using tickets.