diff options
author | Ricardo Garcia <[email protected]> | 2011-02-25 21:53:26 +0100 |
---|---|---|
committer | Ricardo Garcia <[email protected]> | 2011-02-25 21:53:26 +0100 |
commit | da273188f33ace3b48290a8cf35d36033a6fa960 (patch) | |
tree | 659f88593c2d6d8f3bfe85ce51710ce38fbec981 | |
parent | 1bd9258272dd4884b5c159ae77e20ae75176e8d1 (diff) | |
download | youtube-dl-da273188f33ace3b48290a8cf35d36033a6fa960.tar.gz youtube-dl-da273188f33ace3b48290a8cf35d36033a6fa960.zip |
Catch possible exceptions when running ffprobe
-rwxr-xr-x | youtube-dl | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/youtube-dl b/youtube-dl index 9e9be6778..617ac1339 100755 --- a/youtube-dl +++ b/youtube-dl @@ -2619,10 +2619,13 @@ class FFmpegExtractAudioPP(PostProcessor): @staticmethod def get_audio_codec(path): - handle = subprocess.Popen(['ffprobe', '-show_streams', path], - stderr=file(os.path.devnull, 'w'), stdout=subprocess.PIPE) - output = handle.communicate()[0] - if handle.wait() != 0: + 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'): @@ -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 = [] |