summaryrefslogtreecommitdiff
path: root/mediabrowser
diff options
context:
space:
mode:
Diffstat (limited to 'mediabrowser')
-rw-r--r--mediabrowser/__init__.py4
-rw-r--r--mediabrowser/ffmpeg.py8
2 files changed, 6 insertions, 6 deletions
diff --git a/mediabrowser/__init__.py b/mediabrowser/__init__.py
index 8766ac2..62aeb48 100644
--- a/mediabrowser/__init__.py
+++ b/mediabrowser/__init__.py
@@ -154,8 +154,8 @@ def build(root_directory, cache):
if client_mtime is not None and mtime <= client_mtime:
return Response(status=304)
else:
- thumbnail_stream = ffmpeg.thumbnail_video(ospath, 90, 50)
- r = Response(thumbnail_stream, mimetype="video/webm")
+ process = ffmpeg.thumbnail_video(ospath, 90, 50)
+ r = Response(process.stdout, mimetype="video/webm")
r.last_modified = mtime
return r
diff --git a/mediabrowser/ffmpeg.py b/mediabrowser/ffmpeg.py
index d8d40f5..fd1782c 100644
--- a/mediabrowser/ffmpeg.py
+++ b/mediabrowser/ffmpeg.py
@@ -115,8 +115,8 @@ def calculate_splittimes(ospath, chunk_duration):
def thumbnail(ospath, width, height):
- process = LoggedPopen(shlex.split("ffmpeg -noaccurate_seek -ss 25.0 -i") + [ospath] +
- shlex.split("-frames:v 10 -map 0:0"
+ process = LoggedPopen(shlex.split("ffmpeg -v fatal -noaccurate_seek -ss 25.0 -i") + [ospath] +
+ shlex.split("-frames:v 10 -map 0:v"
" -filter:v 'scale=w=oh*a:h={}, crop=(min(iw\,{})):(min(ih\,{}))'"
" -f singlejpeg pipe:".format(height+(height/10), width, height)),
stdout=PIPE)
@@ -131,7 +131,7 @@ def thumbnail_video(ospath, width, height):
for pos in chunk_startpos:
command += ["-ss", "{:.6f}".format(pos), "-t", "2", "-i", ospath]
- filter = " ".join(map(lambda i: "[{}:0]".format(i), range(len(chunk_startpos))))
+ filter = " ".join(map(lambda i: "[{}:v]".format(i), range(len(chunk_startpos))))
filter += " concat=n={}:v=1:a=0 [v1]".format(len(chunk_startpos))
filter += "; [v1] fps=14 [v2]"
filter += "; [v2] scale='w=trunc(oh*a/2)*2:h={}' [v3]".format(height + 6)
@@ -140,4 +140,4 @@ def thumbnail_video(ospath, width, height):
command += shlex.split("-c:v libvpx -deadline realtime -f webm pipe:")
encoder = LoggedPopen(command, stdout=PIPE)
- return encoder.stdout
+ return encoder