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

can youtube-dl be interrupted and resumed from the same point #11308

Closed
siddht4 opened this issue Nov 27, 2016 · 12 comments
Closed

can youtube-dl be interrupted and resumed from the same point #11308

siddht4 opened this issue Nov 27, 2016 · 12 comments

Comments

@siddht4
Copy link

@siddht4 siddht4 commented Nov 27, 2016

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like that [x])
  • Use Preview tab to see how your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2016.11.22. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.

  • [ x] I've verified and I assure that I'm running youtube-dl 2016.11.22

Before submitting an issue make sure you have:

  • [x ] At least skimmed through README and most notably FAQ and BUGS sections
  • [ x] Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • [ x] Feature request (request for a new functionality)
  • [x ] Question
  • Other

Is it possible in youtube-dl to interrupt an instance of it and later resume from the exact point.

eg:
I used youtube-dl to download single file from youtube

wrote the command youtube-dl [link]
due to low battery , i interrupted it manually by closing it , then after 30 mins , re typed
the command youtube-dl [link]

now think this with multiple links

is it possible to do something like this

youtube-dl [link]

then i interrupted it with ctrl +i ( it can be anything else too interrupt it )

then youtube-dl shows

forcing youtube-dl to pause , saved as session-1

after 5 hours i resumed it by entering

youtube-dl -resume -session-1

youtube-dl output : resuming session-1 ,

@siddht4
Copy link
Author

@siddht4 siddht4 commented Nov 27, 2016

other reason to do this

  1. network failure
  2. youtube-dl update
  3. power failure
  4. server blocking download
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Nov 27, 2016

--write-info-json and --load-info-json is what you need. However, it's unlikely that the same download link is still valid after hours.

@yan12125 yan12125 closed this Nov 27, 2016
@siddht4
Copy link
Author

@siddht4 siddht4 commented Nov 27, 2016

@yan12125
--write-info-json and --load-info-json is what you need

how to do this ?

However, it's unlikely that the same download link is still valid after hours.

not so with youtube , youtube-dl will also verify it when resuming the session , else should give some error .

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Nov 27, 2016

Here's an example: record all the information first, interrupt it whenever you want and load the .info.json file back to resume.

$ youtube-dl -v --write-info-json test:youtube
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-v', '--write-info-json', 'test:youtube']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2016.11.22
[debug] Git HEAD: 560c8c6
[debug] Python version 3.5.2 - Linux-4.8.10-1-ARCH-x86_64-with-arch
[debug] exe versions: ffmpeg 3.2.1, ffprobe 3.2.1
[debug] Proxy map: {}
[TestURL] Test URL: https://www.youtube.com/watch?v=BaW_jenozKc&t=1s&end=9
[youtube] BaW_jenozKc: Downloading webpage
[youtube] BaW_jenozKc: Downloading video info webpage
[youtube] BaW_jenozKc: Extracting video information
[youtube] BaW_jenozKc: Downloading MPD manifest
[info] Writing video description metadata as JSON to: youtube-dl test video ''_ä↭-BaW_jenozKc.info.json
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[debug] Invoking downloader on 'https://r2---sn-u5oxu-un5e.googlevideo.com/videoplayback?id=05a5bf8de9e8cca7&itag=137&source=youtube&requiressl=yes&initcwndbps=8402500&mn=sn-u5oxu-un5e&mm=31&pl=16&mv=m&ms=au&ratebypass=yes&mime=video/mp4&gir=yes&clen=2208750&lmt=1387961822987808&dur=9.800&key=dg_yt0&mt=1480241574&upn=VwhTxGn02AU&signature=1FD0CF8564DF4F9AD8DB797E3DF8331387458A1B.0657E2010FB2A4092CE513D9D202CF03911FFF7A&ip=140.112.28.103&ipbits=0&expire=1480263336&sparams=ip,ipbits,expire,id,itag,source,requiressl,initcwndbps,mn,mm,pl,mv,ms,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: youtube-dl test video ''_ä↭-BaW_jenozKc.f137.mp4
[download]  47.4% of 2.11MiB at 429.18KiB/s ETA 00:02^CException ignored in: <_io.FileIO name="youtube-dl test video ''_ä↭-BaW_jenozKc.f137.mp4.part" mode='wb' closefd=True>
ResourceWarning: unclosed file <_io.BufferedWriter name="youtube-dl test video ''_ä↭-BaW_jenozKc.f137.mp4.part">

ERROR: Interrupted by user

[1]$ ls
AUTHORS          LICENSE      setup.py    youtube-dl.plugin.zsh
bin              Makefile     test        'youtube-dl test video '\'''\''_ä↭-BaW_jenozKc.f137.mp4.part'
ChangeLog        MANIFEST.in  test.html   'youtube-dl test video '\'''\''_ä↭-BaW_jenozKc.info.json'
CONTRIBUTING.md  pythons.sh   test_js.py
devscripts       README.md    tox.ini
docs             setup.cfg    youtube_dl

$ youtube-dl -v --load-info-json youtube-dl\ test\ video\ \'\'_ä↭-BaW_jenozKc.info.json  
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-v', '--load-info-json', "youtube-dl test video ''_ä↭-BaW_jenozKc.info.json"]
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2016.11.22
[debug] Git HEAD: 560c8c6
[debug] Python version 3.5.2 - Linux-4.8.10-1-ARCH-x86_64-with-arch
[debug] exe versions: ffmpeg 3.2.1, ffprobe 3.2.1
[debug] Proxy map: {}
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[debug] Invoking downloader on 'https://r2---sn-u5oxu-un5e.googlevideo.com/videoplayback?id=05a5bf8de9e8cca7&itag=137&source=youtube&requiressl=yes&initcwndbps=8402500&mn=sn-u5oxu-un5e&mm=31&pl=16&mv=m&ms=au&ratebypass=yes&mime=video/mp4&gir=yes&clen=2208750&lmt=1387961822987808&dur=9.800&key=dg_yt0&mt=1480241574&upn=VwhTxGn02AU&signature=1FD0CF8564DF4F9AD8DB797E3DF8331387458A1B.0657E2010FB2A4092CE513D9D202CF03911FFF7A&ip=140.112.28.103&ipbits=0&expire=1480263336&sparams=ip,ipbits,expire,id,itag,source,requiressl,initcwndbps,mn,mm,pl,mv,ms,ratebypass,mime,gir,clen,lmt,dur'
[download] Resuming download at byte 1047552
[download] Destination: youtube-dl test video ''_ä↭-BaW_jenozKc.f137.mp4
[download] 100% of 2.11MiB in 00:02
[debug] Invoking downloader on 'https://r2---sn-u5oxu-un5e.googlevideo.com/videoplayback?id=05a5bf8de9e8cca7&itag=251&source=youtube&requiressl=yes&initcwndbps=8402500&mn=sn-u5oxu-un5e&mm=31&pl=16&mv=m&ms=au&ratebypass=yes&mime=audio/webm&gir=yes&clen=190742&lmt=1422348740429751&dur=9.841&key=dg_yt0&mt=1480241574&upn=VwhTxGn02AU&signature=24DDEED27E01AC72A7702B46D276552BF4EFAC00.95D54F0C06374A27FAA9901E171B512EBFC5D0E9&ip=140.112.28.103&ipbits=0&expire=1480263336&sparams=ip,ipbits,expire,id,itag,source,requiressl,initcwndbps,mn,mm,pl,mv,ms,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: youtube-dl test video ''_ä↭-BaW_jenozKc.f251.webm
[download] 100% of 186.27KiB in 00:00
[ffmpeg] Merging formats into "youtube-dl test video ''_ä↭-BaW_jenozKc.mkv"
[debug] ffmpeg command line: ffmpeg -y -i 'file:youtube-dl test video '"'"''"'"'_ä↭-BaW_jenozKc.f137.mp4' -i 'file:youtube-dl test video '"'"''"'"'_ä↭-BaW_jenozKc.f251.webm' -c copy -map 0:v:0 -map 1:a:0 'file:youtube-dl test video '"'"''"'"'_ä↭-BaW_jenozKc.temp.mkv'
Deleting original file youtube-dl test video ''_ä↭-BaW_jenozKc.f137.mp4 (pass -k to keep)
Deleting original file youtube-dl test video ''_ä↭-BaW_jenozKc.f251.webm (pass -k to keep)
@siddht4
Copy link
Author

@siddht4 siddht4 commented Nov 27, 2016

@yan12125 you should add this example in readme.md file , its a great feature by the way , i can just code a session.json file to behave like my example

how did you interrupted it without closing the terminal

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Nov 27, 2016

how did you interrupted it without closing the terminal

Just Ctrl+C

@siddht4
Copy link
Author

@siddht4 siddht4 commented Nov 27, 2016

Just Ctrl+C

its copy command

can you provide just another example with mutiple file link , so that i can get it properly

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Nov 27, 2016

its copy command

By default Ctrl+C terminates the current process. You may want to check your terminal settings.

can you provide just another example with mutiple file link , so that i can get it properly

Not sure what you mean. youtube-dl -v --write-info-json <url1> <url2> ...?

@siddht4
Copy link
Author

@siddht4 siddht4 commented Nov 27, 2016

Not sure what you mean. youtube-dl -v --write-info-json <url1> <url2> ...?
no not that , in means

a.txt has 10 links
so
youtube-dl -a a.txt
in --write-info-json

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Nov 27, 2016

Try this: youtube-dl -v -a a.txt --write-info-json

@siddht4
Copy link
Author

@siddht4 siddht4 commented Nov 27, 2016

how to resume it

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Nov 28, 2016

Just like the case of a single video - youtube-dl --load-info-json xxx.info.json

@ytdl-org ytdl-org deleted a comment from samehvarta Jan 17, 2018
@ytdl-org ytdl-org locked and limited conversation to collaborators Jan 17, 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
2 participants
You can’t perform that action at this time.