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

Feature Request: Download a Portion of Video with youtube-dl #32631

Open
progressive-galib opened this issue Nov 9, 2023 · 3 comments
Open
Labels

Comments

@progressive-galib
Copy link

Feature Request: Download a Portion of Video with youtube-dl

Description:
I would like to request a new feature for youtube-dl that allows users to download a specific portion of a video by specifying a start time and an end time. This feature would be particularly useful for users who want to download only a certain segment of a longer video.

Proposed Implementation:
One way to implement this feature could be by introducing additional command-line arguments, such as --start-time and --end-time, to youtube-dl. Users would provide the start and end times in the format "HH:MM:SS," and youtube-dl would download the video from the specified start time to the end time.

Suggested Behavior:

  • Add an option to specify the start time and end time when downloading a video. For example:
youtube-dl --start-time 01:30 --end-time 02:00 https://www.youtube.com/watch?v=VIDEO_ID
@progressive-galib
Copy link
Author

it'd be really really nice to have it natively, do you mind if i implement it myself and submit a pull request ?

@dirkf
Copy link
Contributor

dirkf commented Nov 30, 2023

As originally suggested in #4821, there isn't see a realistic way to do this internally: an implementation will have to rely on ffmpeg (or something similar).

You could review the --split-chapters function of yt-dlp and maybe adapt that, with some way of specifying the clip region in the yt-dl command line.

Probably better is what I suggested in #4821: back-port the NAME: modifier for the various --...-args ... options: then it's straightforward to formulate --external-downloader-args so that ffmpeg downloads just the wanted time range.

What happens now is ffmpeg -i URL ARGS DEST; if -ss ... is in the ARGS position the whole stream is downloaded.

What we want is ffmpeg -ss START -i URL -t DURATION ARGS DEST or ffmpeg -ss START -to END -i URL ARGS DEST. The latter can be specified in yt-dlp by '--downloader-args ffmpeg_i "-ss START -to END"`.

Also review stale PR #30850.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants