Skip to content

Commit

Permalink
Replace mplayer with ffmpeg; mplayer in current Ubuntu seems to have …
Browse files Browse the repository at this point in the history
…forgotten how to decode my older .flvs
  • Loading branch information
Ken committed Aug 30, 2009
1 parent 3a26e68 commit b764dc2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions singleshot/handlers/flv.py
Expand Up @@ -39,12 +39,14 @@ def load_metadata(self, target, fileinfo):

def generate(self, source=None, dest=None, size=None):
tmpdir = tempfile.mkdtemp()
args = ['mplayer', '-nosound', '-really-quiet', '-quiet', '-vo', 'jpeg:outdir=%s' % tmpdir, '-ss', '00:00:03', '-frames', '1', source]
#args = ['mplayer', '-nosound', '-really-quiet', '-quiet', '-vo', 'jpeg:outdir=%s' % tmpdir, '-ss', '00:00:03', '-frames', '1', source]
args = ['ffmpeg', '-i', source, '-an', '-r', '1', '-ss', '00:00:03', '-vframes', '1', '-y', os.path.join(tmpdir, '%d.jpg')]
proc = subprocess.Popen(args, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=self.config.getInvokeEnvironment())
data = proc.stdout.read()
LOG.warn("mplayer invocation: %s" % data)
#LOG.warn("mplayer invocation: %s" % data)
r = proc.wait()
jpg = os.path.join(tmpdir, '00000001.jpg')
#jpg = os.path.join(tmpdir, '00000001.jpg')
jpg = os.path.join(tmpdir, '1.jpg')
if r != 0 or not os.path.exists(jpg):
LOG.debug("ImageProcessor failed for %s -> %s", source, dest)
else:
Expand Down

0 comments on commit b764dc2

Please sign in to comment.