[FFmpeg-user] Trouble generating WebM Dash manifest file for live stream

Tom Berger tab1293 at gmail.com
Sun May 15 19:20:14 CEST 2016


Hello,

I am trying to generate a WebM Dash manifest file for a live stream. My
current setup is as follows. I am streaming a video file to nginx-rtmp via:

ffmpeg -i test.mkv -map 0 -c:v libx264 -b:v 2400k -c:a libfdk_aac -b:a 380k
-f flv rtmp://myserver.com/live/test

Then on the nginx-rtmp server I have ffmpeg segmenting the stream in to
WebM chunks like this:

ffmpeg -y -i rtmp://localhost/live/test -map 0:1 -pix_fmt yuv420p \
    -codec libvpx-vp9 \
    -keyint_min 60 -g 60 -speed 6 -tile-columns 4 -frame-parallel 1
-threads 8 -static-thresh 0 -max-intra-rate 300 -deadline realtime
-lag-in-frames 0 -error-resilient 1 \
    -f webm_chunk \
    -header "/etc/nginx/html/streams/webm/test.hdr" \
    -chunk_start_index 1 \
    /etc/nginx/html/streams/webm/test_%d.chk \
    -map 0:0 \
    -codec libvorbis \
      -b:a 128k -ar 44100 \
    -f webm_chunk \
      -audio_chunk_duration 2000 \
      -header /etc/nginx/html/streams/webm/test_audio.hdr \
      -chunk_start_index 1 \
    /etc/nginx/html/streams/webm/test_%d_audio.chk

Which works fine and I see the chunks and header files being created. The
issue arises when I try to generate a manifest file from these chunks. I
try to do so like this:

ffmpeg \
        -loglevel debug \
        -f webm_dash_manifest -live 1 \
        -i /etc/nginx/html/streams/webm/test.hdr \
        -f webm_dash_manifest -live 1 \
        -i /etc/nginx/html/streams/webm/test_audio.hdr \
        -c copy \
        -map 0 -map 1 \
        -f webm_dash_manifest -live 1 \
        -adaptation_sets "id=0,streams=0 id=1,streams=1" \
        -chunk_start_index 1 \
        -chunk_duration_ms 2000 \
        -time_shift_buffer_depth 7200 \
        -minimum_update_period 7200 \
        /etc/nginx/html/streams/webm/test.mpd

The output I receive is:

ffmpeg version N-79989-g51a1c1c Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
  configuration: --prefix=/ffmpeg_build --pkg-config-flags=--static
--extra-cflags=-I/ffmpeg_build/include --extra-ldflags=-L/ffmpeg_build/lib
--bindir=/usr/bin --enable-gpl --enable-libass --enable-libfdk-aac
--enable-libfreetype --enable-libmp3lame --enable-libopus
--enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264
--enable-nonfree
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 41.102 / 57. 41.102
  libavformat    57. 36.100 / 57. 36.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 45.100 /  6. 45.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'webm_dash_manifest'.
Reading option '-live' ... matched as AVOption 'live' with argument '1'.
Reading option '-i' ... matched as input file with argument
'/etc/nginx/html/streams/webm/test.hdr'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'webm_dash_manifest'.
Reading option '-live' ... matched as AVOption 'live' with argument '1'.
Reading option '-i' ... matched as input file with argument
'/etc/nginx/html/streams/webm/test_audio.hdr'.
Reading option '-c' ... matched as option 'c' (codec name) with argument
'copy'.
Reading option '-map' ... matched as option 'map' (set input stream
mapping) with argument '0'.
Reading option '-map' ... matched as option 'map' (set input stream
mapping) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'webm_dash_manifest'.
Reading option '-live' ... matched as AVOption 'live' with argument '1'.
Reading option '-adaptation_sets' ... matched as AVOption 'adaptation_sets'
with argument 'id=0,streams=0 id=1,streams=1'.
Reading option '-chunk_start_index' ... matched as AVOption
'chunk_start_index' with argument '1'.
Reading option '-chunk_duration_ms' ... matched as AVOption
'chunk_duration_ms' with argument '2000'.
Reading option '-time_shift_buffer_depth' ... matched as AVOption
'time_shift_buffer_depth' with argument '7200'.
Reading option '-minimum_update_period' ... matched as AVOption
'minimum_update_period' with argument '7200'.
Reading option '/etc/nginx/html/streams/webm/test.mpd' ... matched as
output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file
/etc/nginx/html/streams/webm/test.hdr.
Applying option f (force format) with argument webm_dash_manifest.
Successfully parsed a group of options.
Opening an input file: /etc/nginx/html/streams/webm/test.hdr.
[file @ 0x355f160] Setting default whitelist 'file,crypto'
st:0 removing common factor 1000000 from timebase
[webm_dash_manifest @ 0x355ea20] Before avformat_find_stream_info() pos:
431 bytes read:431 seeks:0
[webm_dash_manifest @ 0x355ea20] Could not find codec parameters for stream
0 (Video: vp9, 1 reference frame, none, 1280x720, 1/1000): unspecified
pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize'
options
[webm_dash_manifest @ 0x355ea20] After avformat_find_stream_info() pos: 431
bytes read:431 seeks:0 frames:0
Input #0, webm_dash_manifest, from '/etc/nginx/html/streams/webm/test.hdr':
  Metadata:
    encoder         : Lavf57.36.100
  Duration: N/A, bitrate: N/A
    Stream #0:0, 0, 1/1000: Video: vp9, 1 reference frame, none, 1280x720
(0x0), 0/1, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn (default)
    Metadata:
      webm_dash_manifest_file_name: test.hdr
      webm_dash_manifest_track_number: 1
Successfully opened the file.
Parsing a group of options: input file
/etc/nginx/html/streams/webm/test_audio.hdr.
Applying option f (force format) with argument webm_dash_manifest.
Successfully parsed a group of options.
Opening an input file: /etc/nginx/html/streams/webm/test_audio.hdr.
[file @ 0x35817e0] Setting default whitelist 'file,crypto'
st:0 removing common factor 1000000 from timebase
[webm_dash_manifest @ 0x35811c0] Before avformat_find_stream_info() pos:
6964 bytes read:6964 seeks:0
[webm_dash_manifest @ 0x35811c0] After avformat_find_stream_info() pos:
6964 bytes read:6964 seeks:0 frames:0
Input #1, webm_dash_manifest, from
'/etc/nginx/html/streams/webm/test_audio.hdr':
  Metadata:
    encoder         : Lavf57.36.100
  Duration: N/A, bitrate: N/A
    Stream #1:0, 0, 1/1000: Audio: vorbis, 44100 Hz, 5.1, fltp (default)
    Metadata:
      webm_dash_manifest_file_name: test_audio.hdr
      webm_dash_manifest_track_number: 1
Successfully opened the file.
Parsing a group of options: output file
/etc/nginx/html/streams/webm/test.mpd.
Applying option c (codec name) with argument copy.
Applying option map (set input stream mapping) with argument 0.
Applying option map (set input stream mapping) with argument 1.
Applying option f (force format) with argument webm_dash_manifest.
Successfully parsed a group of options.
Opening an output file: /etc/nginx/html/streams/webm/test.mpd.
[file @ 0x3597b40] Setting default whitelist 'file,crypto'
Successfully opened the file.
[webm_dash_manifest @ 0x358e040] Using AVStream.codec to pass codec
parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, webm_dash_manifest, to '/etc/nginx/html/streams/webm/test.mpd':
  Metadata:
    encoder         : Lavf57.36.100
    Stream #0:0, 0, 1/1000: Video: vp9, 1 reference frame, none, 1280x720
(0x0) [SAR 1:1 DAR 16:9], 0/1, q=2-31, 23.98 fps, 23.98 tbr, 1k tbn
(default)
    Metadata:
      webm_dash_manifest_file_name: test.hdr
      webm_dash_manifest_track_number: 1
    Stream #0:1, 0, 1/1000: Audio: vorbis, 44100 Hz, 5.1 (default)
    Metadata:
      webm_dash_manifest_file_name: test_audio.hdr
      webm_dash_manifest_track_number: 1
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
Could not write header for output file #0 (incorrect codec parameters ?):
Invalid data found when processing input
[AVIOContext @ 0x358dec0] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 0x3567400] Statistics: 431 bytes read, 0 seeks
[AVIOContext @ 0x3589a20] Statistics: 6964 bytes read, 0 seeks

I am not sure if I am doing something incorrectly or if this is a bug with
ffmpeg. Does anyone know what is causing this error and how I can fix it? I
would be happy to provide any additional information needed to help debug
this problem.

Thanks!
Tom Berger


More information about the ffmpeg-user mailing list