Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
youtube-dl often hangs when live stream is ended or paused #12271
Comments
|
If you are getting a bad container, then one way for youtube-dl to fix this is to pass ffmpeg will correctly finish the file as long as you exit once. If you try to exit forcefully (pressing ^C twice or |
|
Thanks, but the problem is not the corrupted file (I'm already using |
|
I'm still experiencing this issue. At the end of the youtube stream it hangs every time. Pressing Ctrl+C once does nothing (even after an 8 hour wait). Pressing Ctrl+C again will force it to stop but that causes the output file to be corrupt. Sometimes I can disconnect my internet and that will cause it to stop properly and produce a working output file but other times it just stays hung. |
|
@Tatsh If I hit Ctrl+C twice is my file corrupted and unrecoverable, or can I do something to get it back? |
|
Most of the time if it's MP4 container you can't. The data required to fix the stream isn't in the file at that time. |
|
+1, it's quite annoying. |
|
I'm having the same issue. |
|
Same problem here, why is there no way to gracefully stop capturing a live stream without getting a corrupt file?? |
|
Apparently you used to be able to press 'q', but they put in a hack that stops that from working because people didn't know how to write scripts: #8252 |
|
This is definitely still a problem. If a livestream ends while youtube-dl is still attempting to capture it, it is not possible to exit gracefully with a single Ctrl-C. It will never exit, and will never close out the file. The only way to exit is a double-Ctrl-C, which results in an unplayable file. This just happened to me yesterday. |
What is the purpose of your issue?
Description of your issue, suggested solution and other information
Quite often while recording a live stream, when the stream ends, youtube-dl doesn't exit, but hangs for several minutes, then it exits (sometimes correctly renaming the *.part file, sometimes leaving it as is).
The same happens sometimes when the live stream stops for a few seconds, e.g. because of bad network connection at the transmitting or receiving end, and then resumes: youtube hangs and fails to continue writing to the file.
I've experienced these bugs mainly with periscope.tv. I'm not sure if it may affect other sites.
I've tried passing
--socket-timeoutwith a low value, but it doesn't have any effect (BTW, maybe it could be useful to mention the default value (600 secs) in the man page).Are there any other network parameters in the source code that I can try to tweak?
As a second-best solution, if the bug can't be fixed properly because youtube-dl can't be sure is the stream is actually ended or not, it would be better to change the default behaviour from "when in doubt hang" to "when in doubt exit", so that the user could run youtube-dl inside a while loop through a wrapper script, and have it restart automatically after exiting when the live stream stops.