@@ -45,6 +45,13 @@ def checkStream(src_stream, dst_stream):
45
45
continue
46
46
assert_equals ( src_propertiesMap [key ], dst_propertiesMap [key ] )
47
47
48
+ def checkVideoStat (src_videoStream , dst_videoStat ):
49
+ """
50
+ Check the values of the video process stats returned after a process.
51
+ """
52
+ assert_equals (src_videoStream .getDuration (), dst_videoStat .getDuration ())
53
+ assert_equals (int (src_videoStream .getDuration () * src_videoStream .getFps ()), dst_videoStat .getNbFrames ())
54
+
48
55
49
56
def testRewrapAudioStream ():
50
57
"""
@@ -63,7 +70,11 @@ def testRewrapAudioStream():
63
70
transcoder = av .Transcoder ( ouputFile )
64
71
transcoder .add ( inputFileName , 0 )
65
72
progress = av .NoDisplayProgress ()
66
- transcoder .process ( progress )
73
+ processStat = transcoder .process ( progress )
74
+
75
+ # check process stat returned
76
+ audioStat = processStat .getAudioStat (0 )
77
+ assert_equals (src_audioStream .getDuration (), audioStat .getDuration ())
67
78
68
79
# get dst file of wrap
69
80
dst_inputFile = av .InputFile ( outputFileName )
@@ -94,7 +105,10 @@ def testRewrapAVIVideoStream():
94
105
transcoder = av .Transcoder ( ouputFile )
95
106
transcoder .add ( inputFileName , 0 )
96
107
progress = av .NoDisplayProgress ()
97
- transcoder .process ( progress )
108
+ processStat = transcoder .process ( progress )
109
+
110
+ # check process stat returned
111
+ checkVideoStat (src_videoStream , processStat .getVideoStat (0 ))
98
112
99
113
# get dst file of wrap
100
114
dst_inputFile = av .InputFile ( outputFileName )
@@ -125,7 +139,10 @@ def testRewrapMOVVideoStream():
125
139
transcoder = av .Transcoder ( ouputFile )
126
140
transcoder .add ( inputFileName , 1 )
127
141
progress = av .NoDisplayProgress ()
128
- transcoder .process ( progress )
142
+ processStat = transcoder .process ( progress )
143
+
144
+ # check process stat returned
145
+ checkVideoStat (src_videoStream , processStat .getVideoStat (0 ))
129
146
130
147
# get dst file of wrap
131
148
dst_inputFile = av .InputFile ( outputFileName )
0 commit comments