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

Split youtube audio using video chapters #30822

Open MartinBarker opened 2 years ago

MartinBarker commented 2 years ago

Checklist

Description

Hello, I was wondering if there was support for splitting a youtube video's audio into separate audio files based on the video's chapters.

For example, this video:

https://www.youtube.com/watch?v=hrxTh9m-xQw

Is 31 minutes long, and you can see the video's chapters when you scroll your mouse through the video, also included in the video description are timestamps

00:00 Sweet Matara
17:24 House of Music
21:14 Bambo's Bump

image

What I'm trying to accomplish is instead of downloading the entire 31 minute video as a single audio file:

Sweet Matara - Barney Rachabane & Company (1976)-hrxTh9m-xQw.mp3

The 31 minute video gets split up into the three chapters named/tagged accordingly:

- 1. Sweet Matara - Sweet Matara - Barney Rachabane & Company (1976)-hrxTh9m-xQw.mp3
- 2. House of Music - Sweet Matara - Barney Rachabane & Company (1976)-hrxTh9m-xQw.mp3
- 3. Bambo's Bump - Sweet Matara - Barney Rachabane & Company (1976)-hrxTh9m-xQw.mp3

I was wondering if this feature was possible currently using the youtube-dl pip package, if not then Its something I can work on adding and submitting in a PR

dirkf commented 2 years ago

yt-dl isn't meant to be a general-purpose AV processor. That's what ffmpeg (eg) is for.

You probably need something like this that turned up high in my search for "split audio by chapters -audiobook".

Having said that, there is yt-dlp --split-chapters which shows that it is possible (see class FFmpegSplitChaptersPP in yt_dlp/postprocessor/ffmpeg.py), that it might be back-ported, and that some other maintainer didn't agree with me regarding the scope of the program.

pukkandan commented 2 years ago

I can see why this could be considered out of scope. Here are a few reasons why this was added to yt-dlp:

  1. This feature has been requested by a lot of people
  2. In the initial stages of yt-dlp, it was an important objective to bring together the many different forks that existed at the time; including https://github.com/animelover1984/youtube-dl which had already implemented this feature
  3. It is non-trivial to implement as a separate script. But since youtube-dl already has access to the chapter information, it is much easier to implement as a postprocessor
  4. imho, this is no more out of scope than --recode-video/--extract-audio
dirkf commented 2 years ago

These are all good reasons. What is out of scope one day might be considered in scope the next given compelling user demand and a working PR or back-portable code.

But as the user demand can be satisfied by using yt-dlp I won't personally progress a change for this.

gamer191 commented 2 years ago

fixed_in_dlp