Skip to content

Commit

Permalink
Fix broken ffmpeg (Closes #623)
Browse files Browse the repository at this point in the history
  • Loading branch information
phihag committed Jan 9, 2013
1 parent 74fdba6 commit 712e86b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions youtube_dl/PostProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def executable(exe):
def get_audio_codec(self, path):
if not self._exes['ffprobe'] and not self._exes['avprobe']: return None
try:
cmd = [self._exes['avprobe'] or self._exes['ffprobe'], '-show_streams', '--', encodeFilename(path)]
cmd = [self._exes['avprobe'] or self._exes['ffprobe'], '-show_streams', encodeFilename(self._ffmpeg_filename_argument(path))]
handle = subprocess.Popen(cmd, stderr=compat_subprocess_get_DEVNULL(), stdout=subprocess.PIPE)
output = handle.communicate()[0]
if handle.wait() != 0:
Expand All @@ -110,7 +110,7 @@ def run_ffmpeg(self, path, out_path, codec, more_opts):
acodec_opts = ['-acodec', codec]
cmd = ([self._exes['avconv'] or self._exes['ffmpeg'], '-y', '-i', encodeFilename(path), '-vn']
+ acodec_opts + more_opts +
['--', encodeFilename(out_path)])
[encodeFilename(self._ffmpeg_filename_argument(out_path))])
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout,stderr = p.communicate()
if p.returncode != 0:
Expand Down Expand Up @@ -202,3 +202,10 @@ def run(self, information):

information['filepath'] = new_path
return information

def _ffmpeg_filename_argument(self, fn):
# ffmpeg broke --, see https://ffmpeg.org/trac/ffmpeg/ticket/2127 for details
if fn.startswith(u'-'):
return u'./' + fn
return fn

0 comments on commit 712e86b

Please sign in to comment.