rg3/youtube-dl — Issue #288: --extract-audio progress
Author: porjo
Created: 2012-02-08 01:30:37+00:00
State: open

The following patch will send the encoding progress output from FFMPEG to youtube-dl stdout ( code taken from http://stackoverflow.com/a/2525493 )

```diff
--- youtube-dl	2012-01-16 03:23:22.000000000 +0000
+++ youtube-dl.new	2012-02-08 01:02:28.366720567 +0000
@@ -4075,7 +4075,13 @@
cmd = ['ffmpeg', '-y', '-i', _encodeFilename(path), '-vn'] + acodec_opts + more_opts + ['--', _encodeFilename(out_path)]
try:
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-	stdout,stderr = p.communicate()
+	while True:
+	out = p.stderr.read(1)
+	if out == '' and p.poll() != None:
+	break
+	if out != '':
+	sys.stdout.write(out)
+	sys.stdout.flush()
except (IOError, OSError):
e = sys.exc_info()[1]
if isinstance(e, OSError) and e.errno == 2:
```