aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dl/postprocessor/ffmpeg.py
diff options
context:
space:
mode:
authorFelix Stupp <felix.stupp@outlook.com>2020-05-16 18:09:12 +0200
committerFelix Stupp <felix.stupp@outlook.com>2020-05-16 18:45:40 +0200
commitefe87a10ae57fa74d7aa038109079a17a3c4fad2 (patch)
tree180e331360c00c8678d4fd7165780f90923fd4fc /youtube_dl/postprocessor/ffmpeg.py
parent52c50a10af5de16165621f8929b64dc726774276 (diff)
downloadhypervideo-pre-efe87a10ae57fa74d7aa038109079a17a3c4fad2.tar.lz
hypervideo-pre-efe87a10ae57fa74d7aa038109079a17a3c4fad2.tar.xz
hypervideo-pre-efe87a10ae57fa74d7aa038109079a17a3c4fad2.zip
Added --remux-video option
Fixes #6996 - Supported formats declared: mp4, mkv - Added FFmpegVideoRemuxerPP as postprocessor - Added option to README and shell-completion scripts
Diffstat (limited to 'youtube_dl/postprocessor/ffmpeg.py')
-rw-r--r--youtube_dl/postprocessor/ffmpeg.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py
index fd3f921a8..ab9721305 100644
--- a/youtube_dl/postprocessor/ffmpeg.py
+++ b/youtube_dl/postprocessor/ffmpeg.py
@@ -349,6 +349,27 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
return [path], information
+class FFmpegVideoRemuxerPP(FFmpegPostProcessor):
+ def __init__(self, downloader=None, preferedformat=None):
+ super(FFmpegVideoRemuxerPP, self).__init__(downloader)
+ self._preferedformat = preferedformat
+
+ def run(self, information):
+ path = information['filepath']
+ if information['ext'] == self._preferedformat:
+ self._downloader.to_screen('[ffmpeg] Not remuxing video file %s - already is in target format %s' % (path, self._preferedformat))
+ return [], information
+ options = ['-c', 'copy']
+ prefix, sep, ext = path.rpartition('.')
+ outpath = prefix + sep + self._preferedformat
+ self._downloader.to_screen('[' + 'ffmpeg' + '] Remuxing video from %s to %s, Destination: ' % (information['ext'], self._preferedformat) + outpath)
+ self.run_ffmpeg(path, outpath, options)
+ information['filepath'] = outpath
+ information['format'] = self._preferedformat
+ information['ext'] = self._preferedformat
+ return [path], information
+
+
class FFmpegVideoConvertorPP(FFmpegPostProcessor):
def __init__(self, downloader=None, preferedformat=None):
super(FFmpegVideoConvertorPP, self).__init__(downloader)