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.41k stars 9.96k forks source link

[Feature] Parsing multi-part videos into multiple files #12907

Open YourFin opened 7 years ago

YourFin commented 7 years ago

Please follow the guide below


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

Before submitting an issue make sure you have:

What is the purpose of your issue?


Description of your issue, suggested solution and other information

Many soundtrack, compilation, and long music videos have multiple parts that users may want to have as individual files, and it is usually a pain to split up these files manually.

Solving this presents four problems: A) Parsing the description for timestamps B) Parsing the list of timestamps into time ranges C) Splitting the downloaded video into parts as per the time ranges D) Naming these files

I have a pretty clear idea of how to parse for timestamps and turn them into time ranges, and am willing to do the heavy lifting for those parts on my own. The problem lies in the next two steps.

Just from briefly reading through the ffmpeg man page, it looks like it should be capable of this for any video format that can be thrown at it, but I don't have much experience with video and audio codecs/file formats. This would also mean adding it as a dependency for this feature, and if there's a way around that I would love to know.

As for naming the files, this would again require parsing the description in some way relative to time stamps, but I have no idea how to incorporate the current naming scheme. Chapter/track integration maybe? Would like help figuring out how to integrate this into the current structure of youtube-dl.

I'm willing to do all of the heavy lifting for this myself, but I am unfamiliar with the codebase, and would greatly appreciate help finding relevant places to start/guidance if the project would be interested in adding this feature.

yan12125 commented 7 years ago

Seems that's quite similar to https://github.com/rg3/youtube-dl/pull/9409? The code is almost there but there's a bug on Windows.

remitamine commented 7 years ago

9409 has been kept stuck for long time because of the problem in windows, as i don't use windows i couldn't report the bug to ffmpeg or test if there is workaround it.

so i'm thinking about just introducing the chapters field without the metadata part which will allow external use of the information, and may be in the future if there is a windows user that has an interest in reporting the bug or finding a work around than we can add the metadata part.

YourFin commented 7 years ago

9409 looks like that only refers to adding a chapters field to the video metadata, and while this looks like the right way of going about this, I would like to add an option to split a single video into multiple files as per these chapters, should that be within the purview of this project.

I guess what I am really proposing then is smart chapter parsing from descriptions (should it not be provided explicitly) and file splitting by chapter.

remitamine commented 7 years ago

9409 looks like that only refers to adding a chapters field to the video metadata.

it extracts the chapters information and add the chapter marks to video files.

YourFin commented 7 years ago

@remitamine thanks for the clarification

xantares commented 3 years ago

maybe related: #24858

rafutek commented 3 years ago

So is this going to be merged ? I'd love to extract tracks from albums...