]> jfr.im git - yt-dlp.git/commitdiff
[ffmpeg] Document more formats that are supported for remux/recode
authorpukkandan <redacted>
Thu, 28 Jan 2021 03:56:50 +0000 (09:26 +0530)
committerpukkandan <redacted>
Thu, 28 Jan 2021 05:06:34 +0000 (10:36 +0530)
youtube_dlc/__init__.py
youtube_dlc/options.py
youtube_dlc/postprocessor/ffmpeg.py

index 6a790339d39c489778fd6b9e35384fec47664026..cd0ab7613816c57e435577d9a299046c1adc2cb6 100644 (file)
@@ -15,6 +15,7 @@
 
 from .options import (
     parseOpts,
+    _remux_formats,
 )
 from .compat import (
     compat_getpass,
@@ -209,12 +210,15 @@ def parse_retries(retries):
         opts.audioquality = opts.audioquality.strip('k').strip('K')
         if not opts.audioquality.isdigit():
             parser.error('invalid audio quality specified')
-    if opts.remuxvideo is not None:
-        if opts.remuxvideo not in ['mp4', 'mkv']:
-            parser.error('invalid video container format specified')
     if opts.recodevideo is not None:
-        if opts.recodevideo not in ['mp4', 'flv', 'webm', 'ogg', 'mkv', 'avi']:
+        if opts.recodevideo not in _remux_formats:
             parser.error('invalid video recode format specified')
+    if opts.remuxvideo and opts.recodevideo:
+        opts.remuxvideo = None
+        write_string('WARNING: --remux-video is ignored since --recode-video was given\n', out=sys.stderr)
+    if opts.remuxvideo is not None:
+        if opts.remuxvideo not in _remux_formats:
+            parser.error('invalid video remux format specified')
     if opts.convertsubtitles is not None:
         if opts.convertsubtitles not in ['srt', 'vtt', 'ass', 'lrc']:
             parser.error('invalid subtitle format specified')
index 749a6c6e04108450e7fdfba6075e86d9a8890b1d..e17460e1c5c57ea0dda7b522f89a90f78326f677 100644 (file)
@@ -22,6 +22,9 @@
 from .version import __version__
 
 
+_remux_formats = ('mp4', 'mkv', 'flv', 'webm', 'mov', 'avi', 'mp3', 'mka', 'm4a', 'ogg', 'opus')
+
+
 def _hide_login_info(opts):
     PRIVATE_OPTS = set(['-p', '--password', '-u', '--username', '--video-password', '--ap-password', '--ap-username'])
     eqre = re.compile('^(?P<key>' + ('|'.join(re.escape(po) for po in PRIVATE_OPTS)) + ')=.+$')
@@ -1017,14 +1020,16 @@ def _dict_from_multiple_values_options_callback(
         '--remux-video',
         metavar='FORMAT', dest='remuxvideo', default=None,
         help=(
-            'Remux the video into another container if necessary (currently supported: mp4|mkv). '
+            'Remux the video into another container if necessary (currently supported: %s). '
             'If target container does not support the video/audio codec, remuxing will fail. '
             'You can specify multiple rules; eg. "aac>m4a/mov>mp4/mkv" will remux aac to m4a, mov to mp4 '
-            'and anything else to mkv.'))
+            'and anything else to mkv.' % '|'.join(_remux_formats)))
     postproc.add_option(
         '--recode-video',
         metavar='FORMAT', dest='recodevideo', default=None,
-        help='Re-encode the video into another format if re-encoding is necessary (currently supported: mp4|flv|ogg|webm|mkv|avi)')
+        help=(
+            'Re-encode the video into another format if re-encoding is necessary. '
+            'The supported formats are the same as --remux-video'))
     postproc.add_option(
         '--postprocessor-args', '--ppa',
         metavar='NAME:ARGS', dest='postprocessor_args', default={}, type='str',
index f2be0f415f51b54bb2a6e4a6f6c61725955912be..94eeec98081718722888c7ede938b9dbff38d21b 100644 (file)
@@ -402,7 +402,7 @@ def run(self, information):
             else 'already is in target format %s' if sourceext == targetext
             else None)
         if _skip_msg:
-            self.to_screen('Not remuxing media file %s - %s' % (path, _skip_msg % sourceext))
+            self.to_screen('Not remuxing media file %s; %s' % (path, _skip_msg % sourceext))
             return [], information
 
         options = ['-c', 'copy', '-map', '0', '-dn']