summaryrefslogtreecommitdiff
path: root/test/ffmpeg.py
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2016-05-26 20:25:47 +0200
committerYves Fischer <yvesf-git@xapek.org>2016-05-26 20:25:47 +0200
commit500cd0cb43dce858a7ed22ea33d9557068cbfae1 (patch)
tree2eaa6953c8ae3c00d6da82dcc3b5e4b763b722ad /test/ffmpeg.py
parent4f0bab9fb0f0b792123077c00e7fe2e5739ceafd (diff)
downloadflask-mediabrowser-500cd0cb43dce858a7ed22ea33d9557068cbfae1.tar.gz
flask-mediabrowser-500cd0cb43dce858a7ed22ea33d9557068cbfae1.zip
add a test
Diffstat (limited to 'test/ffmpeg.py')
-rw-r--r--test/ffmpeg.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/ffmpeg.py b/test/ffmpeg.py
index 913d8d8..58b1398 100644
--- a/test/ffmpeg.py
+++ b/test/ffmpeg.py
@@ -1,6 +1,7 @@
import mediabrowser.ffmpeg as ffmpeg
import os
+import tempfile
from pprint import pprint
from unittest import TestCase
@@ -23,4 +24,21 @@ class TestFfmpeg(TestCase):
def test_calculate_splittimes(self):
for time in ffmpeg.calculate_splittimes(self.test_mkv, 120):
- print(time) \ No newline at end of file
+ print(time)
+
+ def test_split(self):
+ _, pos1 = ffmpeg.find_next_keyframe(self.test_mkv, 2, 5)
+ frame_dur1, pos2 = ffmpeg.find_next_keyframe(self.test_mkv, pos1+2, 5)
+ frame_dur2, pos3 = ffmpeg.find_next_keyframe(self.test_mkv, pos2+2, 5)
+ out1 = open(tempfile.mktemp(), "wb")
+ out2 = open(tempfile.mktemp(), "wb")
+ pprint(locals())
+
+ out1.write(ffmpeg.stream(self.test_mkv, pos1, pos2-pos1-frame_dur1).stdout.read())
+ out2.write(ffmpeg.stream(self.test_mkv, pos2, pos3-pos2-frame_dur2).stdout.read())
+
+
+
+ os.remove(out1.name)
+ os.remove(out2.name)
+