projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'duncankl/airmozilla'
[youtube-dl]
/
youtube_dl
/
postprocessor
/
ffmpeg.py
diff --git
a/youtube_dl/postprocessor/ffmpeg.py
b/youtube_dl/postprocessor/ffmpeg.py
index 504a71193661a2a9537e3cdd121ca1a434d7a8bf..398fe050ede3d7da8678fd1453bc1ae475419362 100644
(file)
--- a/
youtube_dl/postprocessor/ffmpeg.py
+++ b/
youtube_dl/postprocessor/ffmpeg.py
@@
-34,10
+34,10
@@
class FFmpegPostProcessor(PostProcessor):
self._determine_executables()
def check_version(self):
self._determine_executables()
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.')
- required_version = '10-0' if self.
_uses_avconv()
else '1.0'
+ required_version = '10-0' if self.
basename == 'avconv'
else '1.0'
if is_outdated_version(
self._versions[self.basename], required_version):
warning = 'Your copy of %s is outdated, update %s to version %s or newer if you encounter any errors.' % (
if is_outdated_version(
self._versions[self.basename], required_version):
warning = 'Your copy of %s is outdated, update %s to version %s or newer if you encounter any errors.' % (
@@
-108,12
+108,10
@@
class FFmpegPostProcessor(PostProcessor):
self.probe_basename = p
break
self.probe_basename = p
break
+ @property
def available(self):
return self.basename is not None
def available(self):
return self.basename is not None
- def _uses_avconv(self):
- return self.basename == 'avconv'
-
@property
def executable(self):
return self._paths[self.basename]
@property
def executable(self):
return self._paths[self.basename]
@@
-138,7
+136,7
@@
class FFmpegPostProcessor(PostProcessor):
if self._downloader.params.get('verbose', False):
self._downloader.to_screen('[debug] ffmpeg command line: %s' % shell_quote(cmd))
if self._downloader.params.get('verbose', False):
self._downloader.to_screen('[debug] ffmpeg command line: %s' % shell_quote(cmd))
- p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE
, stdin=subprocess.PIPE
)
stdout, stderr = p.communicate()
if p.returncode != 0:
stderr = stderr.decode('utf-8', 'replace')
stdout, stderr = p.communicate()
if p.returncode != 0:
stderr = stderr.decode('utf-8', 'replace')
@@
-178,8
+176,8
@@
class FFmpegExtractAudioPP(FFmpegPostProcessor):
encodeArgument('-show_streams'),
encodeFilename(self._ffmpeg_filename_argument(path), True)]
if self._downloader.params.get('verbose', False):
encodeArgument('-show_streams'),
encodeFilename(self._ffmpeg_filename_argument(path), True)]
if self._downloader.params.get('verbose', False):
- self._downloader.to_screen('[debug]
ffprobe command line: %s' % shell_quote(cmd
))
- handle = subprocess.Popen(cmd, stderr=compat_subprocess_get_DEVNULL(), stdout=subprocess.PIPE)
+ self._downloader.to_screen('[debug]
%s command line: %s' % (self.basename, shell_quote(cmd)
))
+ handle = subprocess.Popen(cmd, stderr=compat_subprocess_get_DEVNULL(), stdout=subprocess.PIPE
, stdin=subprocess.PIPE
)
output = handle.communicate()[0]
if handle.wait() != 0:
return None
output = handle.communicate()[0]
if handle.wait() != 0:
return None
@@
-498,10
+496,6
@@
class FFmpegEmbedSubtitlePP(FFmpegPostProcessor):
'zu': 'zul',
}
'zu': 'zul',
}
- def __init__(self, downloader=None, subtitlesformat='srt'):
- super(FFmpegEmbedSubtitlePP, self).__init__(downloader)
- self._subformat = subtitlesformat
-
@classmethod
def _conver_lang_code(cls, code):
"""Convert language code from ISO 639-1 to ISO 639-2/T"""
@classmethod
def _conver_lang_code(cls, code):
"""Convert language code from ISO 639-1 to ISO 639-2/T"""
@@
-511,13
+505,14
@@
class FFmpegEmbedSubtitlePP(FFmpegPostProcessor):
if information['ext'] != 'mp4':
self._downloader.to_screen('[ffmpeg] Subtitles can only be embedded in mp4 files')
return True, information
if information['ext'] != 'mp4':
self._downloader.to_screen('[ffmpeg] Subtitles can only be embedded in mp4 files')
return True, information
- if not information.get('subtitles'):
+ subtitles = information.get('requested_subtitles')
+ if not subtitles:
self._downloader.to_screen('[ffmpeg] There aren\'t any subtitles to embed')
return True, information
self._downloader.to_screen('[ffmpeg] There aren\'t any subtitles to embed')
return True, information
- sub_langs =
[key for key in information['subtitles']]
+ sub_langs =
list(subtitles.keys())
filename = information['filepath']
filename = information['filepath']
- input_files = [filename] + [subtitles_filename(filename, lang, s
elf._subformat) for lang in sub_langs
]
+ input_files = [filename] + [subtitles_filename(filename, lang, s
ub_info['ext']) for lang, sub_info in subtitles.items()
]
opts = [
'-map', '0',
opts = [
'-map', '0',