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

Add concat-playlist flag to merge videos from a playlist into one continuous file #28153

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adammw
Copy link
Contributor

@adammw adammw commented Feb 13, 2021

Before submitting a pull request make sure you have:

In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

  • Bug fix
  • Improvement
  • New extractor
  • New feature

Prior art

#12385
#995
#2723
#2844

Description of your pull request and other information

Added flag to merge videos from a playlist into one continuous file.

In its current form, it uses the ffmpeg concat demux, which has limited support for mixed streams within a playlist, therefore is only really suited to the use case below.

The main use case is downloading episodes from MTV, as episodes are internally represented as a playlist of multiple segments, and downloading them as individual files becomes a pain for managing in other applications.

HELP WANTED - need to improve the filename/extractor logic as often the playlist name is not the best name for the video, in the example of MTV, the individual segments have more metadata about the show/season/episode than the playlist does.

Resolves #30093.

Copy link
Contributor

@pukkandan pukkandan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DISCLAIMER: I am not a maintainer of this project. I am just putting up my suggestions since I find this PR interesting

@@ -1677,6 +1692,7 @@ def is_wellformed(f):
new_info = dict(info_dict)
new_info.update(format)
self.process_info(new_info)
format.update(new_info)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

@@ -203,7 +201,7 @@ def get_audio_codec(self, path):
return mobj.group(1)
return None

def run_ffmpeg_multiple_files(self, input_paths, out_path, opts):
def run_ffmpeg_multiple_files(self, input_paths, out_path, opts, file_opts):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to make this an optional argument than changing the code in the other classes

@@ -274,7 +273,8 @@ def run(self, information):
raise PostProcessingError('WARNING: unable to obtain file audio codec with ffprobe')

more_opts = []
if self._preferredcodec == 'best' or self._preferredcodec == filecodec or (self._preferredcodec == 'm4a' and filecodec == 'aac'):
if self._preferredcodec == 'best' or self._preferredcodec == filecodec or (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best not to make unrelated changes in a PR. Same issue below. Also these changes often don't obey the linter

Comment on lines +567 to +569
def can_merge(self):
return True

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

def run(self, info):
filename = info['filepath']

list_filename = prepend_extension(filename, 'list')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filename will end up as .list.mkv which doesn't make sense. It should be either .mkv.list or just .list

@tomck
Copy link

tomck commented May 12, 2023

This does not work with using output titles, I think that it's expecting different filenames when concatenating and it misses. I have tested with using an output format: https://pastebin.com/jspQV0Q0 and without using an output format: https://pastebin.com/iAiMZAMB

The command I'm using is referenced from yt-dlp/yt-dlp#447 - he also has a workaround for renaming the files after finished, but I think the --concat-playlist flag is failing if it doesn't work only when using the --output flag. Since these 'acts' are all of the same episode (there could be a check to see if they match for all x acts), it should work.

It is interesting to me that the %(title)s finds the %(episode)s part and that becomes the final output file.

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

Successfully merging this pull request may close these issues.

Adding support for website (playlist concatenation)
3 participants