Skip to content

Commit ff0cc1b

Browse files
author
Clement Champetier
committed
pyTest: added test to check properties of a raw video stream
1 parent edfa4e6 commit ff0cc1b

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

test/pyTest/testProperties.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
# Check if environment is setup to run the tests
44
if os.environ.get('AVTRANSCODER_TEST_AUDIO_WAVE_FILE') is None or \
55
os.environ.get('AVTRANSCODER_TEST_VIDEO_MP4_FILE') is None or \
6-
os.environ.get('AVTRANSCODER_TEST_VIDEO_MOV_FILE') is None:
6+
os.environ.get('AVTRANSCODER_TEST_VIDEO_MOV_FILE') is None or \
7+
os.environ.get('AVTRANSCODER_TEST_VIDEO_RAW_FILE') is None:
78
from nose.plugins.skip import SkipTest
89
raise SkipTest("Need to define environment variables "
910
"AVTRANSCODER_TEST_AUDIO_WAVE_FILE and "
1011
"AVTRANSCODER_TEST_VIDEO_MP4_FILE and "
11-
"AVTRANSCODER_TEST_VIDEO_MOV_FILE")
12+
"AVTRANSCODER_TEST_VIDEO_MOV_FILE and "
13+
"AVTRANSCODER_TEST_VIDEO_RAW_FILE")
1214

1315
from nose.tools import *
1416

@@ -98,6 +100,36 @@ def testCheckVideoProperties():
98100
assert_equals( videoStream.getFps(), expectedFps )
99101

100102

103+
104+
def testCheckRawVideoProperties():
105+
"""
106+
Check properties of a raw video stream.
107+
A raw stream does not contain header (so the duration, number of frames... needs to be computed).
108+
"""
109+
inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_RAW_FILE']
110+
progress = av.NoDisplayProgress()
111+
inputFile = av.InputFile(inputFileName)
112+
inputFile.analyse(progress, av.eAnalyseLevelFirstGop)
113+
properties = inputFile.getProperties()
114+
115+
assert_true(properties.isRawFormat())
116+
assert_equals(properties.getNbStreams(), 1)
117+
assert_equals(properties.getNbVideoStreams(), 1)
118+
assert_equals(properties.getDuration(), 0) # file duration is unknown
119+
assert_equals(properties.getBitRate(), 0) # file bitrate is unknown
120+
121+
expectedBitRate = 177200L
122+
expectedNbFrames = 200
123+
expectedDuration = 8
124+
expectedFps = 25
125+
126+
videoStream = properties.getVideoProperties()[0]
127+
assert_equals(videoStream.getNbFrames(), expectedNbFrames)
128+
assert_equals(videoStream.getDuration(), expectedDuration)
129+
assert_equals(videoStream.getBitRate(), expectedBitRate)
130+
assert_equals(videoStream.getFps(), expectedFps)
131+
132+
101133
def testCheckAudioProperties():
102134
"""
103135
Check properties of an audio stream.

tools/travis/python.nosetests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ git clone https://github.com/avTranscoder/avTranscoder-data.git
1212
export AVTRANSCODER_TEST_VIDEO_AVI_FILE=`pwd`/avTranscoder-data/video/BigBuckBunny/BigBuckBunny_480p_stereo.avi
1313
export AVTRANSCODER_TEST_VIDEO_MP4_FILE=`pwd`/avTranscoder-data/video/BigBuckBunny/BigBuckBunny_HD.mp4
1414
export AVTRANSCODER_TEST_VIDEO_MOV_FILE=`pwd`/avTranscoder-data/video/BigBuckBunny/BigBuckBunny_640p_h264.mov
15+
export AVTRANSCODER_TEST_VIDEO_RAW_FILE=`pwd`/avTranscoder-data/video/Intro/Intro_raw_1080p.h264
1516
export AVTRANSCODER_TEST_AUDIO_WAVE_FILE=`pwd`/avTranscoder-data/audio/frequenciesPerChannel.wav
1617
export AVTRANSCODER_TEST_AUDIO_MOV_FILE=`pwd`/avTranscoder-data/video/BigBuckBunny/BigBuckBunny_1080p_5_1.mov
1718
export AVTRANSCODER_TEST_IMAGE_PNG_FILE=`pwd`/avTranscoder-data/image/BigBuckBunny/bbb-splash.thumbnail.png

0 commit comments

Comments
 (0)