From a331a508a23d00c0af783005f9d95316be8c8754 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Wed, 1 Jun 2016 17:52:26 +0000 Subject: use different poster command --- mediabrowser/__init__.py | 2 +- mediabrowser/ffmpeg.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'mediabrowser') diff --git a/mediabrowser/__init__.py b/mediabrowser/__init__.py index 139fbf3..adbe5ad 100644 --- a/mediabrowser/__init__.py +++ b/mediabrowser/__init__.py @@ -149,7 +149,7 @@ def build(root_directory, cache): @cached_stream(cache=cache, keyfunc=lambda ospath: "thumb_poster_{}".format(ospath)) def ffmpeg_thumbnail_poster(ospath): - process = ffmpeg.thumbnail(ospath, 852, 480) + process = ffmpeg.poster(ospath) return process.stdout @blueprint.route('//stream/_') diff --git a/mediabrowser/ffmpeg.py b/mediabrowser/ffmpeg.py index dfdc619..4aeaecc 100644 --- a/mediabrowser/ffmpeg.py +++ b/mediabrowser/ffmpeg.py @@ -118,6 +118,14 @@ def calculate_splittimes(ospath, chunk_duration): for (point, nextPoint) in zip([0.0] + points, points + [duration]): yield ("{:0.6f}".format(point), "{:0.6f}".format(nextPoint - point)) +def poster(ospath): + process = LoggedPopen(shlex.split("ffmpeg -v fatal -noaccurate_seek -ss 25.0 -i") + [ospath] + + shlex.split("-frames:v 1 -map 0:v" + " -filter:v \"scale='w=trunc(oh*a/2)*2:h=480'\"" + " -f singlejpeg pipe:"), + stdout=PIPE) + return process + def thumbnail(ospath, width, height): process = LoggedPopen(shlex.split("ffmpeg -v fatal -noaccurate_seek -ss 25.0 -i") + [ospath] + -- cgit v1.2.1