[FFmpeg-user] Recording MPEG-DASH live streams with FFmpeg
Jörg Beckmann
Joerg.Beckmann at scisys.de
Mon Aug 20 12:07:25 EEST 2018
Hi,
I'm trying to record MPEG-DASH live streams using FFmpeg 4.0.2, e.g.
./ffmpeg.exe -v 40 -i http://irtdashreference-i.akamaihd.net/dash/live/901161/bfs/manifestBR.mpd -c:a copy test.aac
The first few fragments are recorded correctly, but then I only get HTTP 404 responses:
[dash @ 000000000070cc40] Parsing 'http://irtdashreference-i.akamaihd.net/dash/live/901161/bfs/manifestBR.mpd' - skipp not supported representation type
[...]
[dash @ 000000000070cc40] DASH request for url 'http://irtdashreference-i.akamaihd.net/dash/live/901161/bfs/83c5debb3328a0e08b8c102b6d5ce378_1_audio_06-init.mp4', offset 0, playlist 0
[dash @ 000000000070cc40] Could not read complete fragment.
[dash @ 000000000070cc40] DASH request for url 'http://irtdashreference-i.akamaihd.net/dash/live/901161/bfs/83c5debb3328a0e08b8c102b6d5ce378_1_audio_06-133781.mp4', offset 0, playlist 0
[...]
Input #0, dash, from 'http://irtdashreference-i.akamaihd.net/dash/live/901161/bfs/manifestBR.mpd':
Duration: N/A, start: 267558.240000, bitrate: N/A
Program 0
Stream #0:0: Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(tv, bt709, left), 1280x720 [SAR 1:1 DAR 16:9], 0 kb/s, 25 fps, 25 tbr, 10000k tbn, 50 tbc
Metadata:
variant_bitrate : 2000000
id : video_00
Stream #0:1: Video: h264 (Main), 1 reference frame (avc1 / 0x31637661), yuv420p(tv, bt470bg, left), 960x540 (960x544) [SAR 1:1 DAR 16:9], 0 kb/s, 25 fps, 25 tbr, 10000k tbn, 20000k tbc
Metadata:
variant_bitrate : 1800000
id : video_01
Stream #0:2: Video: h264 (Main), 1 reference frame (avc1 / 0x31637661), yuv420p(tv, bt470bg, left), 640x360 (640x368) [SAR 1:1 DAR 16:9], 0 kb/s, 25 fps, 25 tbr, 10000k tbn, 20000k tbc
Metadata:
variant_bitrate : 1024000
id : video_02
Stream #0:3: Video: h264 (Main), 1 reference frame (avc1 / 0x31637661), yuv420p(tv, bt470bg, left), 512x288 [SAR 1:1 DAR 16:9], 0 kb/s, 25 fps, 25 tbr, 10000k tbn, 20000k tbc
Metadata:
variant_bitrate : 512000
id : video_03
Stream #0:4: Video: h264 (Constrained Baseline), 1 reference frame (avc1 / 0x31637661), yuv420p(tv, bt470bg, left), 480x270 (480x272) [SAR 1:1 DAR 16:9], 0 kb/s, 25 fps, 25 tbr, 10000k tbn, 50 tbc
Metadata:
variant_bitrate : 256000
id : video_04
Stream #0:5: Video: h264 (Constrained Baseline), 1 reference frame (avc1 / 0x31637661), yuv420p(tv, bt470bg, left), 320x180 (320x192) [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 10000k tbn, 50 tbc
Metadata:
variant_bitrate : 128000
id : video_05
Stream #0:6: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 0 kb/s
Metadata:
variant_bitrate : 192000
id : audio_06
Output #0, adts, to 'test.aac':
Metadata:
encoder : Lavf58.12.100
Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 0 kb/s
Metadata:
variant_bitrate : 192000
id : audio_06
Stream mapping:
Stream #0:6 -> #0:0 (copy)
Press [q] to stop, [?] for help
[dash @ 000000000070cc40] No longer receiving stream_index 0
[dash @ 000000000070cc40] No longer receiving stream_index 1
[dash @ 000000000070cc40] No longer receiving stream_index 2
[dash @ 000000000070cc40] No longer receiving stream_index 3
[dash @ 000000000070cc40] No longer receiving stream_index 4
[dash @ 000000000070cc40] No longer receiving stream_index 5
[dash @ 000000000070cc40] DASH request for url 'http://irtdashreference-i.akamaihd.net/dash/live/901161/bfs/83c5debb3328a0e08b8c102b6d5ce378_1_audio_06-133782.mp4', offset 0, playlist 0
[dash @ 000000000070cc40] DASH request for url 'http://irtdashreference-i.akamaihd.net/dash/live/901161/bfs/83c5debb3328a0e08b8c102b6d5ce378_1_audio_06-133783.mp4', offset 0, playlist 0
[dash @ 000000000070cc40] new fragment: min[133758] max[133783], playlist 0
[dash @ 000000000070cc40] DASH request for url 'http://irtdashreference-i.akamaihd.net/dash/live/901161/bfs/83c5debb3328a0e08b8c102b6d5ce378_1_audio_06-133784.mp4', offset 0, playlist 0
[http @ 0000000000792d40] HTTP error 404 Not Found
[dash @ 000000000070cc40] Failed to open fragment of playlist 0
[dash @ 000000000070cc40] new fragment: min[133758] max[133783], playlist 0
[dash @ 000000000070cc40] DASH request for url 'http://irtdashreference-i.akamaihd.net/dash/live/901161/bfs/83c5debb3328a0e08b8c102b6d5ce378_1_audio_06-133785.mp4', offset 0, playlist 0
[http @ 0000000000792d40] HTTP error 404 Not Found
[dash @ 000000000070cc40] Failed to open fragment of playlist 0
[dash @ 000000000070cc40] new fragment: min[133758] max[133783], playlist 0
[dash @ 000000000070cc40] DASH request for url 'http://irtdashreference-i.akamaihd.net/dash/live/901161/bfs/83c5debb3328a0e08b8c102b6d5ce378_1_audio_06-133786.mp4', offset 0, playlist 0
[...]
I used wireshark to compare what's happening when using FFmpeg and when using the HTML demo player at http://subtitling.irt.de/
FFmpeg tries to read the stream as fast as possible resulting in requests for fragments not yet available, while the player requests the next fragment after 2 seconds. FFmpeg does not retry to read the fragments. It just increases the fragment number and tries the next one again and again.
Is there something I'm doing wrong or is this a bug in FFmpeg? I already looked into the current sources. The code for MPEG-DASH does not seem to have changed since 4.0.2.
Kind regards,
Jörg
More information about the ffmpeg-user
mailing list