ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.34k stars 9.95k forks source link

FAQ request: how to repair a "raw" hls (live)stream #26540

Open ke352802081770314 opened 4 years ago

ke352802081770314 commented 4 years ago

Checklist

Question

Unfortunately I didn't find this issue covered in the FAQ and searching open and closed bugs for some keywords diodn't result in relevant content, google searching neither. I am sure it happens to people every now and then, so I think it is worth addressing. Thank you for your consideration.

I captured a livestream from twitch.com and unfortunately the process terminated ungracefully, so the "fixing" which is done when pressing Ctrl-C or when the livestream finishes didn't happen. Now I have a .mp4 file, presumably containing HLS slices, which is not understood by the player (I use MPlayer 1.4 from mplayerhq.hu, via the debian-multimedia package). Can the file be "repaired" or is the captured content lost? I guess I should have used --hls-use-mpegts but I didn't.

ke352802081770314 commented 4 years ago

What I actually did,. based on web search results, was timeout -s INT 65m youtube-dl -q -f "best[height<=720]" https://www.twitch.tv/SOMECHANNEL because I expected to not be there to stop the stream and the livestream continued for several hours, but then I was there and pressed Ctrl-C at the actual end of the segment I wanted, and timeout when receiving Ctrl-C apparently killed the youtube-dl fiercely not allowing it to shut down properly. If there is a preferred method to achieve a time limit/maximum duration for a livestream grab, this would also be a good FAQ item, since youtube-dl does not have such an option (like ffmpeg -t) as far as I can see.

blackjack4494 commented 4 years ago

ffmpeg should be able to help here or some video editing software (maybe davinci resolve or so)