Skip to content

Commit d853c8c

Browse files
author
Clement Champetier
committed
pyTest: add a test to check full analysis of a raw video stream
1 parent b977583 commit d853c8c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/pyTest/testInputFile.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,31 @@ def testInputFileAnalyseFirstGop():
9292
encodedPictureSize = image[1]
9393
assert_in(pictureType, ['I', 'P', 'B'])
9494
assert_greater(encodedPictureSize, 0)
95+
assert_not_equals(videoProperties.getDuration(), 0)
96+
assert_not_equals(videoProperties.getBitRate(), 0)
97+
assert_not_equals(videoProperties.getNbFrames(), 0)
98+
99+
100+
def testInputFileAnalyseFull():
101+
"""
102+
Analyse the full video stream of an InputFile, and check if the correct attributes are filled.
103+
"""
104+
inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_RAW_FILE']
105+
inputFile = av.InputFile( inputFileName )
106+
107+
# Analyse full stream
108+
progress = av.ConsoleProgress()
109+
inputFile.analyse(progress, av.eAnalyseLevelFull)
110+
111+
# Check properties after full analysis
112+
videoProperties = inputFile.getProperties().getVideoProperties()[0]
113+
assert_greater(videoProperties.getGopSize(), 0)
114+
assert_not_equals(videoProperties.getGopStructure(), ())
115+
for image in videoProperties.getGopStructure():
116+
pictureType = image[0]
117+
encodedPictureSize = image[1]
118+
assert_in(pictureType, ['I', 'P', 'B'])
119+
assert_greater(encodedPictureSize, 0)
120+
assert_not_equals(videoProperties.getDuration(), 0)
121+
assert_not_equals(videoProperties.getBitRate(), 0)
122+
assert_not_equals(videoProperties.getNbFrames(), 0)

0 commit comments

Comments
 (0)