Compare commits

..

No commits in common. "fc46f24dc51d984395fc84c8b6823fbe96bf2476" and "bb9ec9a24d9c3527854a963ecc97611972ad1ca0" have entirely different histories.

2 changed files with 11 additions and 14 deletions

View File

@ -4242,7 +4242,7 @@ class YoutubeDL:
self.write_debug(f'Skipping writing {label} thumbnail') self.write_debug(f'Skipping writing {label} thumbnail')
return ret return ret
if thumbnails and not self._ensure_dir_exists(filename): if not self._ensure_dir_exists(filename):
return None return None
for idx, t in list(enumerate(thumbnails))[::-1]: for idx, t in list(enumerate(thumbnails))[::-1]:

View File

@ -1046,23 +1046,20 @@ class FFmpegSplitChaptersPP(FFmpegPostProcessor):
destination, destination,
['-ss', str(chapter['start_time']), ['-ss', str(chapter['start_time']),
'-t', str(chapter['end_time'] - chapter['start_time'])]) '-t', str(chapter['end_time'] - chapter['start_time'])])
# FFmpeg adds metadata about all chapters from parent file to all split m4a files. # FFmpeg adds metadata about all chapters from parent file to all split m4a files.
# This is incorrect since there must be only single chapter in each file after split. # This is incorrect since there must be only single chapter in each file after split.
# Such behavior confuses players who think multiple chapters present # Such behavior confuses players who think multiple chapters present
def _set_out_opts(self, ext, chapter_title): def _set_out_opts(self, ext, chapter_title):
out_opts = [*self.stream_copy_opts()]
out_opts.extend(['-map_metadata', '0'])
# exclude chapters metadata but keep everything else
out_opts.extend(['-map_chapters', '-1'])
if not chapter_title:
return out_opts
# replace global title with chapter specific title in split files
if ext == 'm4a': if ext == 'm4a':
out_opts.extend(['-metadata', 'title={}'.format(chapter_title)]) return [
if ext == 'opus': *self.stream_copy_opts(),
out_opts.extend(['-metadata:s', 'title={}'.format(chapter_title)]) # For m4a ffmpeg copies all available parent track chapters to split tracks metadata
return out_opts # And such behavior confuses players
# Wipe parent track metadata from split tracks and fill out only title
'-metadata', 'title={}'.format(chapter_title),
'-map_metadata','-1']
else:
return self.stream_copy_opts()
@PostProcessor._restrict_to(images=False) @PostProcessor._restrict_to(images=False)
def run(self, info): def run(self, info):
@ -1078,7 +1075,7 @@ class FFmpegSplitChaptersPP(FFmpegPostProcessor):
self.to_screen('Splitting video by chapters; %d chapters found' % len(chapters)) self.to_screen('Splitting video by chapters; %d chapters found' % len(chapters))
for idx, chapter in enumerate(chapters): for idx, chapter in enumerate(chapters):
destination, opts = self._ffmpeg_args_for_chapter(idx + 1, chapter, info) destination, opts = self._ffmpeg_args_for_chapter(idx + 1, chapter, info)
out_file_opts = self._set_out_opts(info['ext'], chapter.get('title', '')) out_file_opts = self._set_out_opts(info['ext'], chapter['title'])
self.real_run_ffmpeg([(in_file, opts)], [(destination, out_file_opts)]) self.real_run_ffmpeg([(in_file, opts)], [(destination, out_file_opts)])
if in_file != info['filepath']: if in_file != info['filepath']:
self._delete_downloaded_files(in_file, msg=None) self._delete_downloaded_files(in_file, msg=None)