-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathtestNbFrames.py
More file actions
65 lines (47 loc) · 2.13 KB
/
Copy pathtestNbFrames.py
File metadata and controls
65 lines (47 loc) · 2.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import os
# Check if environment is setup to run the tests
if os.environ.get('AVTRANSCODER_TEST_VIDEO_AVI_FILE') is None:
from nose.plugins.skip import SkipTest
raise SkipTest("Need to define environment variable AVTRANSCODER_TEST_VIDEO_AVI_FILE")
from nose.tools import *
from pyAvTranscoder import avtranscoder as av
def testNbFramesVideoRewrap():
"""
Rewrap one video stream, check nb frames.
"""
inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_AVI_FILE']
outputFileName = "testNbFramesVideoRewrap.mov"
ouputFile = av.OutputFile( outputFileName )
transcoder = av.Transcoder( ouputFile )
transcoder.addStream( av.InputStreamDesc(inputFileName) )
progress = av.ConsoleProgress()
transcoder.process( progress )
# get src file of rewrap
src_inputFile = av.InputFile( inputFileName )
src_properties = src_inputFile.getProperties()
src_videoStream = src_properties.getVideoProperties()[0]
# get dst file of rewrap
dst_inputFile = av.InputFile( outputFileName )
dst_properties = dst_inputFile.getProperties()
dst_videoStream = dst_properties.getVideoProperties()[0]
assert_equals( src_videoStream.getNbFrames(), dst_videoStream.getNbFrames() )
def testNbFramesVideoTranscode():
"""
Transcode one video stream (to h264), check nb frames.
"""
inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_AVI_FILE']
outputFileName = "testNbFramesVideoTranscode.mov"
ouputFile = av.OutputFile( outputFileName )
transcoder = av.Transcoder( ouputFile )
transcoder.addStream( av.InputStreamDesc(inputFileName), "mpeg2" )
progress = av.ConsoleProgress()
transcoder.process( progress )
# get src file of transcode
src_inputFile = av.InputFile( inputFileName )
src_properties = src_inputFile.getProperties()
src_videoStream = src_properties.getVideoProperties()[0]
# get dst file of transcode
dst_inputFile = av.InputFile( outputFileName )
dst_properties = dst_inputFile.getProperties()
dst_videoStream = dst_properties.getVideoProperties()[0]
assert_equals( src_videoStream.getNbFrames(), dst_videoStream.getNbFrames() )