mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-12-09 01:35:18 +00:00
Merge branch 'ext/remuxe-video' of https://github.com/Zocker1999NET/youtube-dl into Zocker1999NET-ext/remuxe-video
This commit is contained in:
@@ -11,6 +11,7 @@ from .ffmpeg import (
|
||||
FFmpegMergerPP,
|
||||
FFmpegMetadataPP,
|
||||
FFmpegVideoConvertorPP,
|
||||
FFmpegVideoRemuxerPP,
|
||||
FFmpegSubtitlesConvertorPP,
|
||||
)
|
||||
from .xattrpp import XAttrMetadataPP
|
||||
@@ -35,6 +36,7 @@ __all__ = [
|
||||
'FFmpegPostProcessor',
|
||||
'FFmpegSubtitlesConvertorPP',
|
||||
'FFmpegVideoConvertorPP',
|
||||
'FFmpegVideoRemuxerPP',
|
||||
'MetadataFromTitlePP',
|
||||
'XAttrMetadataPP',
|
||||
]
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user