Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to stop a livestream download #8932

Closed
DyonR opened this issue Mar 21, 2016 · 10 comments
Closed

Unable to stop a livestream download #8932

DyonR opened this issue Mar 21, 2016 · 10 comments
Labels

Comments

@DyonR
Copy link

@DyonR DyonR commented Mar 21, 2016

I am unable to stop a livestream download/capture by pressing q in the console window.
Also, sending a ? in the command window doesn't work.
If I use version 2016.01.01, this works, since 2016.01.09 this feature got broken.
Sending CTRL+C still works, but that will not trigger ffmpeg to convert the captured file to another format.

At first I thought this was maybe a ffmpeg issue, but since it works in youtube-dl 2016.01.01, and not anymore since 2016.01.09, this is probably a youtube-dl issue.

Here is the command I used for testing this in the current version (2016.03.18) and in 2016.01.01;
youtube-dl.exe --ffmpeg-location C:\ffmpeg\bin https://www.twitch.tv/monstercat

Here is the debug information, but I am not sure if this helps, at the end, I pressed CTRL+C.

D:\Downloads\Media Downloads>youtube-dl.exe -v --ffmpeg-location C:\ffmpeg\bin h
ttps://www.twitch.tv/monstercat
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'--ffmpeg-location', u'C:\\ffmpeg\\bin', u'h
ttps://www.twitch.tv/monstercat']
[debug] Encodings: locale cp1252, fs mbcs, out cp850, pref cp1252
[debug] youtube-dl version 2016.03.18
[debug] Python version 2.7.10 - Windows-8-6.2.9200
[debug] exe versions: ffmpeg N-79083-gc411e90, ffprobe N-79083-gc411e90, rtmpdum
p 2.4
[debug] Proxy map: {}
[twitch:stream] monstercat: Downloading stream JSON
[twitch:stream] monstercat: Downloading channel access token
[twitch:stream] monstercat: Downloading m3u8 information
[debug] Invoking downloader on u'http://video31.ams01.hls.ttvnw.net/hls40/monste
rcat_20341112448_421885192/chunked/py-index-live.m3u8?token=id=80530594404265431
05,bid=20341112448,exp=1458683651,node=video31-1.ams01.hls.justin.tv,nname=video
31.ams01,fmt=chunked&sig=c9cf294f47d92636c421d91977c2ea4bc37b3009'
[download] Destination: Monstercat 2016-03-21 22_54-20341112352.mp4
[debug] ffmpeg command line: 'C:\ffmpeg\bin\ffmpeg' -y -headers 'Accept-Charset:
 ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/44.0
 (Chrome)
' -i 'http://video31.ams01.hls.ttvnw.net/hls40/monstercat_20341112448_421885192/
chunked/py-index-live.m3u8?token=id=8053059440426543105,bid=20341112448,exp=1458
683651,node=video31-1.ams01.hls.justin.tv,nname=video31.ams01,fmt=chunked&sig=c9
cf294f47d92636c421d91977c2ea4bc37b3009' -c copy -f mp4 -bsf:a aac_adtstoasc 'fil
e:Monstercat 2016-03-21 22_54-20341112352.mp4.part'
ffmpeg version N-79083-gc411e90 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopenc
ore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --ena
ble-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enabl
e-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-l
ibvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-li
bwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enab
le-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 28.103 / 57. 28.103
  libavformat    57. 28.102 / 57. 28.102
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 39.102 /  6. 39.102
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, hls,applehttp, from 'http://video31.ams01.hls.ttvnw.net/hls40/monsterc
at_20341112448_421885192/chunked/py-index-live.m3u8?token=id=8053059440426543105
,bid=20341112448,exp=1458683651,node=video31-1.ams01.hls.justin.tv,nname=video31
.ams01,fmt=chunked&sig=c9cf294f47d92636c421d91977c2ea4bc37b3009':
  Duration: N/A, start: 64529.611333, bitrate: N/A
  Program 0
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, flt
p, 166 kb/s
    Stream #0:1: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709/
bt709/iec61966-2-1), 1920x1080, 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #0:2: Data: timed_id3 (ID3  / 0x20334449)
Output #0, mp4, to 'file:Monstercat 2016-03-21 22_54-20341112352.mp4.part':
  Metadata:
    encoder         : Lavf57.28.102
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080, q=2-3
1, 30 fps, 30 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 166
 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  239 fps=0.0 q=-1.0 size=    1615kB time=00:00:08.00 bitrate=1653.7kbits/
frame=  358 fps= 75 q=-1.0 Lsize=    2438kB time=00:00:11.98 bitrate=1665.6kbits
/s speed=2.51x
video:2192kB audio:234kB subtitle:0kB other streams:0kB global headers:0kB muxin
g overhead: 0.477996%
Exiting normally, received signal 2.

ERROR: Interrupted by user
@mxr576
Copy link

@mxr576 mxr576 commented Jul 3, 2016

Same issue on OSX El Captan with 2016.07.02.

@dstftw dstftw added the request label Jul 3, 2016
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jul 3, 2016

Since #8139 q is disabled. See #8252 for reasons not re-enable it.

@dawnerd
Copy link

@dawnerd dawnerd commented Jul 3, 2016

I have been seeing this a lot when a live stream stalls or fails to end correctly. Ffmpeg will just keep recording forever. If you try to stop it you end up with a corrupt file and a whole lot of wasted time. I feel like there's got to be a good way to have ffmpeg gracefully quit.

@yopalien
Copy link

@yopalien yopalien commented Sep 4, 2016

So, is there any solution to this other than downloading the old version?

@rikva
Copy link

@rikva rikva commented Nov 24, 2016

I'd like to know the answer to this as well.

@sbernard31
Copy link

@sbernard31 sbernard31 commented Jan 7, 2017

I'v got the same problem. Any workaround ? I don't know maybe a command line to use to make the capture usable ?

@rikva
Copy link

@rikva rikva commented Jan 8, 2017

I'm currently using this workaround:

  1. get video URL: youtube-dl --get-url --restrict-filenames <url>
  2. use ffmpeg to download timeboxed video: ffmpeg -i <url> -t <seconds> -c copy <out_file>
@sbernard31
Copy link

@sbernard31 sbernard31 commented Jan 9, 2017

I finally used a crappy workaround : just switch off the internet connection...

@Tatsh
Copy link
Contributor

@Tatsh Tatsh commented Mar 15, 2017

My main issue with this 'solution' is that we lose youtube-dl's postprocessing which I very much would like to have in any stream I get.

If we do ^C while a live stream is going, youtube-dl assumes it's an error even though ffmpeg says Exiting normally and then youtube-dl does do post-processing, not even renaming the file.

If you are using --postprocessor-args '-movflags +faststart' you should not get a corrupted MP4 in any case, but it takes longer to save the file.

@nyuszika7h
Copy link
Contributor

@nyuszika7h nyuszika7h commented Apr 23, 2017

I just ran into the exact same issue. Honestly, I don't see a valid reason not to allow input to ffmpeg. How is handling q harder than Ctrl-C? You can see that ffmpeg exited, what's so hard in that? So what if you have to add a little extra code? And you say this would prevent you from wrapping ffmpeg? You can disable stdin if you actually wrap ffmpeg and hide its output, until then it's just a bad excuse.

Another possible solution to the problem, at least for HLS live streaming, could be to save to .ts and only remux to .mp4 or whatever format at the end.

Also, why is this tagged "request" and unsolved for a year? This is definitely a bug if ffmpeg freezes an there is no way to gracefully terminate the download. I don't know if the freezing is an ffmpeg or a youtube-dl bug, but even if it's the former, that's no excuse. There are lots of alternative solutions if you are insistent on not allowing input to ffmpeg.

@dstftw dstftw closed this in e7db675 Apr 28, 2017
@ytdl-org ytdl-org deleted a comment from Nottt Jan 26, 2018
@ytdl-org ytdl-org locked and limited conversation to collaborators Jan 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants
You can’t perform that action at this time.