Compare commits

..

5 Commits

Author SHA1 Message Date
Ricardo Garcia
b58faab5e7 Bump version number 2011-02-26 00:47:29 +01:00
Idan Kamara
377086af3d Use '--' to separate the file argument from the options when calling ffmpeg
This is to avoid a potential issue if the file name begins with a hyphen since ffmpeg will interpret it as an option
2011-02-25 23:24:58 +02:00
Ricardo Garcia
820eedcb50 Bump version number 2011-02-25 21:54:16 +01:00
Ricardo Garcia
da273188f3 Catch possible exceptions when running ffprobe 2011-02-25 21:53:26 +01:00
Idan Kamara
1bd9258272 Fix stderr print when ffmpeg fails 2011-02-25 22:30:22 +02:00
2 changed files with 12 additions and 9 deletions

View File

@@ -1 +1 @@
2011.02.25
2011.02.25c

View File

@@ -2619,11 +2619,14 @@ class FFmpegExtractAudioPP(PostProcessor):
@staticmethod
def get_audio_codec(path):
handle = subprocess.Popen(['ffprobe', '-show_streams', path],
try:
handle = subprocess.Popen(['ffprobe', '-show_streams', '--', path],
stderr=file(os.path.devnull, 'w'), stdout=subprocess.PIPE)
output = handle.communicate()[0]
if handle.wait() != 0:
return None
except (IOError, OSError):
return None
audio_codec = None
for line in output.split('\n'):
if line.startswith('codec_name='):
@@ -2635,7 +2638,7 @@ class FFmpegExtractAudioPP(PostProcessor):
@staticmethod
def run_ffmpeg(path, out_path, codec, more_opts):
try:
ret = subprocess.call(['ffmpeg', '-y', '-i', path, '-vn', '-acodec', codec] + more_opts + [out_path],
ret = subprocess.call(['ffmpeg', '-y', '-i', path, '-vn', '-acodec', codec] + more_opts + ['--', out_path],
stdout=file(os.path.devnull, 'w'), stderr=subprocess.STDOUT)
return (ret == 0)
except (IOError, OSError):
@@ -2646,7 +2649,7 @@ class FFmpegExtractAudioPP(PostProcessor):
filecodec = self.get_audio_codec(path)
if filecodec is None:
self._downloader.to_stderr(u'WARNING: no audio codec found in file')
self._downloader.to_stderr(u'WARNING: unable to obtain file audio codec with ffprobe')
return None
more_opts = []
@@ -2676,7 +2679,7 @@ class FFmpegExtractAudioPP(PostProcessor):
status = self.run_ffmpeg(path, new_path, acodec, more_opts)
if not status:
self._downloader.to_stderr(u'WARNING: error running ffmpeg' % ret)
self._downloader.to_stderr(u'WARNING: error running ffmpeg')
return None
try:
@@ -2720,7 +2723,7 @@ if __name__ == '__main__':
# Parse command line
parser = optparse.OptionParser(
usage='Usage: %prog [options] url...',
version='2011.02.25',
version='2011.02.25c',
conflict_handler='resolve',
)