[FFmpeg-user] Properly download/trim a hls-stream which reports invalid timestamps
Reino Wijnsma
rwijnsma at xs4all.nl
Thu Nov 16 21:48:47 EET 2017
On 16-11-2017 14:54, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
> 2017-11-16 14:43 GMT+01:00 Reino Wijnsma <rwijnsma at xs4all.nl>:
>> I didn't care much about these errors when I wanted to download the
>> entire hls-stream, but now that I want to download a ±30sec segment,
>> things become a bit nasty:
>>
>> ffmpeg-N-87867-g0655810-win32-static_legacy.exe -hide_banner -ss 2000 -i
>> "http://manifest.us.rtl.nl/10/v166/aes/adaptive/components/videorecorder/38/389438/389439/0bf68d1e-97f6-3c3e-9498-e1a3ffa8a13a.ssm/0bf68d1e-97f6-3c3e-9498-e1a3ffa8a13a.ism/0bf68d1e-97f6-3c3e-9498-e1a3ffa8a13a-audio_eng=125437-video=3877000.m3u8"
>> -ss 14 -t 30 -c copy "output.ts"
> This is of course problematic - not necessarily related to invalid
> timestamps - since a new file is created.
> Is there no tool to dump hls streams?
I'm not sure I understand what you mean. Another tool then FFmpeg? Sure.
Youtube-dl for instance:
youtube-dl.exe -F
https://www.rtl.nl/video/0bf68d1e-97f6-3c3e-9498-e1a3ffa8a13a/
[rtl.nl] 0bf68d1e-97f6-3c3e-9498-e1a3ffa8a13a: Downloading JSON metadata
[rtl.nl] 0bf68d1e-97f6-3c3e-9498-e1a3ffa8a13a: Downloading m3u8 information
[info] Available formats for 0bf68d1e-97f6-3c3e-9498-e1a3ffa8a13a:
format code extension resolution note
hls-132 mp4 audio only 132k , mp4a.40.2 at 125k
hls-1255 mp4 704x400 1255k , avc1.77.31 at 1059k, mp4a.40.2 at 125k
pg-a3t mp4 704x400 1255k , avc1.77.31 at 1059k, mp4a.40.2 at 125k
hls-2426 mp4 910x512 2426k , avc1.100.41 at 2164k, mp4a.40.2 at 125k
hls-4242 mp4 1280x720 4242k , avc1.100.41 at 3877k, mp4a.40.2 at 125k
pg-nettv mp4 1280x720 4242k , avc1.100.41 at 3877k,
mp4a.40.2 at 125k (best)
youtube-dl.exe -f hls-4242 --hls-prefer-native -o "%(title)s.%(ext)s"
https://www.rtl.nl/video/0bf68d1e-97f6-3c3e-9498-e1a3ffa8a13a/
[rtl.nl] 0bf68d1e-97f6-3c3e-9498-e1a3ffa8a13a: Downloading JSON metadata
[rtl.nl] 0bf68d1e-97f6-3c3e-9498-e1a3ffa8a13a: Downloading m3u8 information
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 312
[download] Destination: De Geschiedenis En Toekomst Van Het Internet.mp4
[download] 0.2% of ~1.63GiB at 2.00MiB/s ETA 14:39
Youtube-dl by default uses FFmpeg to download the hls-stream, but with
--hls-prefer-native it can do it on its own.
The mp4-extension is misleading btw, because Youtube-dl lacks the
'-bsf:a aac_adtstoasc'-conversion. Therefore the output is in fact a
MPEG-TS file.
However,...
ffmpeg-N-87867-g0655810-win32-static_legacy.exe -hide_banner -ss 2000 -i
"youtube-dl_output.ts" -ss 14 -t 30 -c copy "output.ts"
produces the same faulty output as
ffmpeg-N-87867-g0655810-win32-static_legacy.exe -hide_banner -ss 2000 -i
"http://manifest.us.rtl.nl/10/v166/aes/adaptive/components/videorecorder/38/389438/389439/0bf68d1e-97f6-3c3e-9498-e1a3ffa8a13a.ssm/0bf68d1e-97f6-3c3e-9498-e1a3ffa8a13a.ism/0bf68d1e-97f6-3c3e-9498-e1a3ffa8a13a-audio_eng=125437-video=3877000.m3u8"
-ss 14 -t 30 -c copy "output.ts"
-- Reino
More information about the ffmpeg-user
mailing list