From 2f9b07c03d262f76114266afa5247a14692665fd Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 22 Jul 2013 09:26:22 +0200 Subject: [PATCH] improve frame extraction, #849 --- pandora_client/extract.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pandora_client/extract.py b/pandora_client/extract.py index a3a5504..ee44857 100644 --- a/pandora_client/extract.py +++ b/pandora_client/extract.py @@ -60,7 +60,12 @@ def frame(video, target, position): return r == 0 ''' #ffmpeg - cmd = [command('ffmpeg'), '-y', '-ss', str(position), '-i', video, '-an', '-vframes', '1', target] + pre = position - 2 + if pre < 0: + pre = 0 + else: + position = 2 + cmd = [command('ffmpeg'), '-y', '-ss', str(pre), '-i', video, '-ss', str(position), '-an', '-vframes', '1', target] r = run_command(cmd) return r == 0