summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2016-01-02 02:09:32 +0100
committerYves Fischer <yvesf-git@xapek.org>2016-01-08 20:38:18 +0100
commit7c6120bae3ed4e7cdd015b536a53bb2724967013 (patch)
treed1a61b2bf0f40ca0c99ed8c6c843d30f16b6bd47
parent4578aa44fce996faf4711eb6e5fad25cdc86374c (diff)
downloadflask-mediabrowser-7c6120bae3ed4e7cdd015b536a53bb2724967013.tar.gz
flask-mediabrowser-7c6120bae3ed4e7cdd015b536a53bb2724967013.zip
set initial segment size to 20, replace test data, handle missing pkt_duration_time
-rw-r--r--mediabrowser/ffmpeg.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/mediabrowser/ffmpeg.py b/mediabrowser/ffmpeg.py
index b174b59..d8d40f5 100644
--- a/mediabrowser/ffmpeg.py
+++ b/mediabrowser/ffmpeg.py
@@ -72,7 +72,7 @@ def find_next_keyframe(ospath, start, max_offset):
data[name] = value
- if 'pkt_duration_time' in data:
+ if 'pkt_duration_time' in data and data['pkt_duration_time'][1:-1] != "N/A":
prev_duration = float(data['pkt_duration_time'][1:-1])
if 'key_frame' in data and data['key_frame'] == '1' and prev_duration is not None:
@@ -103,7 +103,7 @@ def calculate_splittimes(ospath, chunk_duration):
"""
def calculate_points(media_duration):
- pos = 10
+ pos = min(20, media_duration)
while pos < media_duration:
yield pos
pos += chunk_duration
@@ -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 \ No newline at end of file
+ return encoder.stdout