diff options
author | Lesmiscore (Naoya Ozaki) <nao20010128@gmail.com> | 2022-07-09 05:58:46 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-09 02:28:46 +0530 |
commit | ca9def714a71151bec9e16ae0042a2c49f9ec99c (patch) | |
tree | f2f238a76f8b6b24955f3b6c3e4f8f3379cba631 | |
parent | 47cdc68e034cd7f61414e6634df334f56b795a07 (diff) | |
download | hypervideo-pre-ca9def714a71151bec9e16ae0042a2c49f9ec99c.tar.lz hypervideo-pre-ca9def714a71151bec9e16ae0042a2c49f9ec99c.tar.xz hypervideo-pre-ca9def714a71151bec9e16ae0042a2c49f9ec99c.zip |
Skip some fixup if remux/recode is needed (#4266)
Authored by: Lesmiscore
-rw-r--r-- | yt_dlp/YoutubeDL.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 6455b0df2..f38a885ae 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -43,9 +43,11 @@ from .postprocessor import ( FFmpegFixupTimestampPP, FFmpegMergerPP, FFmpegPostProcessor, + FFmpegVideoConvertorPP, MoveFilesAfterDownloadPP, get_postprocessor, ) +from .postprocessor.ffmpeg import resolve_mapping as resolve_recode_mapping from .update import detect_variant from .utils import ( DEFAULT_OUTTMPL, @@ -3181,22 +3183,23 @@ class YoutubeDL: self.report_warning(f'{vid}: {msg}. Install ffmpeg to fix this automatically') stretched_ratio = info_dict.get('stretched_ratio') - ffmpeg_fixup( - stretched_ratio not in (1, None), - f'Non-uniform pixel ratio {stretched_ratio}', - FFmpegFixupStretchedPP) - - ffmpeg_fixup( - (info_dict.get('requested_formats') is None - and info_dict.get('container') == 'm4a_dash' - and info_dict.get('ext') == 'm4a'), - 'writing DASH m4a. Only some players support this container', - FFmpegFixupM4aPP) + ffmpeg_fixup(stretched_ratio not in (1, None), + f'Non-uniform pixel ratio {stretched_ratio}', + FFmpegFixupStretchedPP) downloader = get_suitable_downloader(info_dict, self.params) if 'protocol' in info_dict else None downloader = downloader.FD_NAME if downloader else None - if info_dict.get('requested_formats') is None: # Not necessary if doing merger + ext = info_dict.get('ext') + postprocessed_by_ffmpeg = info_dict.get('requested_formats') or any(( + isinstance(pp, FFmpegVideoConvertorPP) + and resolve_recode_mapping(ext, pp.mapping)[0] not in (ext, None) + ) for pp in self._pps['post_process']) + + if not postprocessed_by_ffmpeg: + ffmpeg_fixup(ext == 'm4a' and info_dict.get('container') == 'm4a_dash', + 'writing DASH m4a. Only some players support this container', + FFmpegFixupM4aPP) ffmpeg_fixup(downloader == 'hlsnative' and not self.params.get('hls_use_mpegts') or info_dict.get('is_live') and self.params.get('hls_use_mpegts') is None, 'Possible MPEG-TS in MP4 container or malformed AAC timestamps', |