summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/data/test.mkvbin249856 -> 1214355 bytes
-rw-r--r--test/ffmpeg.py20
2 files changed, 19 insertions, 1 deletions
diff --git a/test/data/test.mkv b/test/data/test.mkv
index 9bcacec..6a225a5 100644
--- a/test/data/test.mkv
+++ b/test/data/test.mkv
Binary files differ
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)
+