0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-27 03:03:01 +00:00

[postprocessor/ffmpeg] Add can_merge method

This commit is contained in:
Sergey M․ 2015-05-11 02:00:31 +06:00
parent 7fcb605b82
commit 13763ce599

View file

@ -36,9 +36,7 @@ def __init__(self, downloader=None):
def check_version(self): def check_version(self):
if not self.available: if not self.available:
raise FFmpegPostProcessorError('ffmpeg or avconv not found. Please install one.') raise FFmpegPostProcessorError('ffmpeg or avconv not found. Please install one.')
self.check_outdated()
def check_outdated(self):
required_version = '10-0' if self.basename == 'avconv' else '1.0' required_version = '10-0' if self.basename == 'avconv' else '1.0'
if is_outdated_version( if is_outdated_version(
self._versions[self.basename], required_version): self._versions[self.basename], required_version):
@ -46,8 +44,6 @@ def check_outdated(self):
self.basename, self.basename, required_version) self.basename, self.basename, required_version)
if self._downloader: if self._downloader:
self._downloader.report_warning(warning) self._downloader.report_warning(warning)
return True
return False
@staticmethod @staticmethod
def get_versions(downloader=None): def get_versions(downloader=None):
@ -595,6 +591,23 @@ def run(self, info):
os.rename(encodeFilename(temp_filename), encodeFilename(filename)) os.rename(encodeFilename(temp_filename), encodeFilename(filename))
return info['__files_to_merge'], info return info['__files_to_merge'], info
def can_merge(self):
# TODO: figure out merge-capable ffmpeg version
if self.basename != 'avconv':
return True
required_version = '10-0'
if is_outdated_version(
self._versions[self.basename], required_version):
warning = ('Your copy of %s is outdated and unable to properly mux separate video and audio files, '
'youtube-dl will download single file media. '
'Update %s to version %s or newer to fix this.') % (
self.basename, self.basename, required_version)
if self._downloader:
self._downloader.report_warning(warning)
return False
return True
class FFmpegFixupStretchedPP(FFmpegPostProcessor): class FFmpegFixupStretchedPP(FFmpegPostProcessor):
def run(self, info): def run(self, info):