forked from funciton/py-ffmpeg-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.py
More file actions
47 lines (33 loc) · 1.13 KB
/
Copy pathtests.py
File metadata and controls
47 lines (33 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import unittest
import os
import time
from video_inspector import VideoInspector
from video_encoder import VideoEncoder
class TestInspector(unittest.TestCase):
def setUp(self):
self._inspector = VideoInspector("input.mp4")
def testContainer(self):
self.assertEquals(
self._inspector.container(),
"mov,mp4,m4a,3gp,3g2,mj2"
)
def testRawDuration(self):
self.assertEquals(self._inspector.raw_duration(), "00:02:22.70")
def testDuration(self):
self.assertEquals(self._inspector.duration(), 142700)
def testFPS(self):
self.assertEquals(self._inspector.fps(), '24')
class TestEncoder(unittest.TestCase):
def setUp(self):
self._encoder = VideoEncoder("input.mp4")
def testSyncEncoding(self):
t = time.time()
self._encoder.execute(
"%(ffmpeg_bin)s -i %(input_file)s %(output_file)s",
"test.avi"
)
self.assertTrue(os.path.exists("test.avi"))
self.assertTrue((time.time() - t) > 5) # 5 seconds min
os.remove("test.avi")
if __name__ == "__main__":
unittest.main()