diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2016-05-26 20:25:47 +0200 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2016-05-26 20:25:47 +0200 |
commit | 500cd0cb43dce858a7ed22ea33d9557068cbfae1 (patch) | |
tree | 2eaa6953c8ae3c00d6da82dcc3b5e4b763b722ad | |
parent | 4f0bab9fb0f0b792123077c00e7fe2e5739ceafd (diff) | |
download | flask-mediabrowser-500cd0cb43dce858a7ed22ea33d9557068cbfae1.tar.gz flask-mediabrowser-500cd0cb43dce858a7ed22ea33d9557068cbfae1.zip |
add a test
-rw-r--r-- | test/data/test.mkv | bin | 249856 -> 1214355 bytes | |||
-rw-r--r-- | test/ffmpeg.py | 20 |
2 files changed, 19 insertions, 1 deletions
diff --git a/test/data/test.mkv b/test/data/test.mkv Binary files differindex 9bcacec..6a225a5 100644 --- a/test/data/test.mkv +++ b/test/data/test.mkv 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) + |