Skip to content

Commit b261d00

Browse files
author
Clement Champetier
committed
pyTest: uncomment video transcode
* Warning: need an HD video as input when test dnxhd profiles. * Update Travis script to launch pyTest: test with an HD video.
1 parent 09244f7 commit b261d00

File tree

2 files changed

+117
-156
lines changed

2 files changed

+117
-156
lines changed

test/pyTest/testTranscoderTranscode.py

Lines changed: 116 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -65,159 +65,120 @@ def testTranscodeWave16b48kmono():
6565
# assert_equals( "1 channels", dst_audioStream.getChannelLayout() ) # '1 channels' != '0 channels'
6666
assert_equals( 1, dst_audioStream.getChannels() )
6767

68-
# def testTranscodeDnxhd120():
69-
# """
70-
# Transcode one video stream (profile dnxhd120).
71-
# """
72-
# inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_FILE']
73-
# outputFileName = "testTranscodeDnxhd120.mxf"
74-
75-
# ouputFile = av.OutputFile( outputFileName )
76-
# transcoder = av.Transcoder( ouputFile )
77-
78-
# transcoder.add( inputFileName, 0, "dnxhd120" )
79-
80-
# progress = av.ConsoleProgress()
81-
# transcoder.process( progress )
82-
83-
# # get dst file of transcode
84-
# dst_inputFile = av.InputFile( outputFileName )
85-
# dst_inputFile.analyse( progress, av.eAnalyseLevelFast )
86-
# dst_properties = dst_inputFile.getProperties()
87-
# dst_videoStream = dst_properties.getVideoProperties()[0]
88-
89-
# assert_equals( "dnxhd", dst_videoStream.codecName )
90-
# assert_equals( "VC3/DNxHD", dst_videoStream.codecLongName )
91-
# # assert_equals( 120000000, dst_videoStream.bitRate ) # 120000000 != 0L
92-
# assert_equals( "yuv422p", dst_videoStream.pixelName )
93-
# # assert_equals( 1, dst_videoStream.gopSize ) # 1 != 12L
94-
# assert_equals( 25, dst_videoStream.fps )
95-
96-
# def testTranscodeDnxhd185():
97-
# """
98-
# Transcode one video stream (profile dnxhd185).
99-
# """
100-
# inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_FILE']
101-
# outputFileName = "testTranscodeDnxhd185.mxf"
102-
103-
# ouputFile = av.OutputFile( outputFileName )
104-
# transcoder = av.Transcoder( ouputFile )
105-
106-
# transcoder.add( inputFileName, 0, "dnxhd185" )
107-
108-
# progress = av.ConsoleProgress()
109-
# transcoder.process( progress )
110-
111-
# # get dst file of transcode
112-
# dst_inputFile = av.InputFile( outputFileName )
113-
# dst_inputFile.analyse( progress, av.eAnalyseLevelFast )
114-
# dst_properties = dst_inputFile.getProperties()
115-
# dst_videoStream = dst_properties.getVideoProperties()[0]
116-
117-
# assert_equals( "dnxhd", dst_videoStream.codecName )
118-
# assert_equals( "VC3/DNxHD", dst_videoStream.codecLongName )
119-
# assert_equals( 185000000, dst_videoStream.bitRate )
120-
# assert_equals( "yuv422p", dst_videoStream.pixelName )
121-
# assert_equals( 1, dst_videoStream.gopSize )
122-
# assert_equals( 25, dst_videoStream.fps )
123-
124-
# def testTranscodeDnxhd185x():
125-
# """
126-
# Transcode one video stream (profile dnxhd185x).
127-
# """
128-
# inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_FILE']
129-
# outputFileName = "testTranscodeDnxhd185x.mxf"
130-
131-
# ouputFile = av.OutputFile( outputFileName )
132-
# transcoder = av.Transcoder( ouputFile )
133-
134-
# transcoder.add( inputFileName, 0, "dnxhd185x" )
135-
136-
# progress = av.ConsoleProgress()
137-
# transcoder.process( progress )
138-
139-
# # get dst file of transcode
140-
# dst_inputFile = av.InputFile( outputFileName )
141-
# dst_inputFile.analyse( progress, av.eAnalyseLevelFast )
142-
# dst_properties = dst_inputFile.getProperties()
143-
# dst_videoStream = dst_properties.getVideoProperties()[0]
144-
145-
# assert_equals( "dnxhd", dst_videoStream.codecName )
146-
# assert_equals( "VC3/DNxHD", dst_videoStream.codecLongName )
147-
# assert_equals( 185000000, dst_videoStream.bitRate )
148-
# assert_equals( "yuv422p10", dst_videoStream.pixelName )
149-
# assert_equals( 1, dst_videoStream.gopSize )
150-
# assert_equals( 25, dst_videoStream.fps )
151-
152-
# def testTranscodeXdcamhd422():
153-
# """
154-
# Transcode one video stream (profile xdcamhd422).
155-
# """
156-
# inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_FILE']
157-
# outputFileName = "testTranscodeXdcamhd422.mxf"
158-
159-
# ouputFile = av.OutputFile( outputFileName )
160-
# transcoder = av.Transcoder( ouputFile )
161-
162-
# transcoder.add( inputFileName, 0, "xdcamhd422" )
163-
164-
# progress = av.ConsoleProgress()
165-
# transcoder.process( progress )
166-
167-
# # get dst file of transcode
168-
# dst_inputFile = av.InputFile( outputFileName )
169-
# dst_inputFile.analyse( progress, av.eAnalyseLevelFast )
170-
# dst_properties = dst_inputFile.getProperties()
171-
# dst_videoStream = dst_properties.getVideoProperties()[0]
172-
173-
# assert_equals( "mpeg2video", dst_videoStream.codecName )
174-
# assert_equals( "MPEG-2 video", dst_videoStream.codecLongName )
175-
# assert_equals( 0, dst_videoStream.profile )
176-
# assert_equals( 2, dst_videoStream.level )
177-
# assert_equals( 12, dst_videoStream.gopSize )
178-
# assert_equals( True, dst_videoStream.hasBFrames )
179-
# # assert_equals( 10, dst_videoStream.dtgActiveFormat ) # 10 != 0L
180-
# assert_equals( 25, dst_videoStream.fps )
181-
# # assert_equals( 1, dst_videoStream.colorspace ) # 1 != 'unspecified'
182-
# # assert_equals( 1, dst_videoStream.colorTransfert ) # 1 != 'unspecified
183-
# # assert_equals( 1, dst_videoStream.colorPrimaries ) # 1 != 'unspecified'
184-
# assert_equals( "Head", dst_videoStream.colorRange )
185-
# assert_equals( "10:00:00:00", dst_videoStream.startTimecode )
186-
# # assert_equals( 50000, dst_videoStream.bitRate ) # 5000 != 0L
187-
# # assert_equals( 50000, dst_videoStream.maxBitRate ) # 5000 != 0L
188-
# # assert_equals( 50000, dst_videoStream.minBitRate ) # 5000 != 0L
189-
# assert_equals( "bottom bottom", dst_videoStream.fieldOrder )
190-
191-
# def testTranscodeYUV420():
192-
# """
193-
# Process one video stream (custom profile of encoding, with pixel format YUV420).
194-
# """
195-
# inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_FILE']
196-
# outputFileName = "testTranscodeYUV420.avi"
197-
198-
# ouputFile = av.OutputFile( outputFileName )
199-
# transcoder = av.Transcoder( ouputFile )
200-
201-
# # create custom profile
202-
# customProfile = av.ProfileMap()
203-
# customProfile[av.Profile.avProfileIdentificator] = "customProfile"
204-
# customProfile[av.Profile.avProfileIdentificatorHuman] = "custom profile"
205-
# customProfile[av.Profile.avProfileType] = av.Profile.avProfileTypeVideo
206-
# customProfile[av.Profile.avProfileFrameRate] = "25"
207-
# customProfile[av.Profile.avProfileCodec] = "mpeg2video"
208-
# customProfile[av.Profile.avProfilePixelFormat] = "yuv420p"
209-
210-
# transcoder.add( inputFileName, 0, customProfile )
211-
212-
# progress = av.ConsoleProgress()
213-
# transcoder.process( progress )
214-
215-
# # get dst file of transcode
216-
# dst_inputFile = av.InputFile( outputFileName )
217-
# dst_inputFile.analyse( progress, av.eAnalyseLevelFast )
218-
# dst_properties = dst_inputFile.getProperties()
219-
# dst_videoStream = dst_properties.getVideoProperties()[0]
220-
221-
# assert_equals( "mpeg2video", dst_videoStream.codecName )
222-
# assert_equals( "yuv420p", dst_videoStream.pixelName )
68+
def testTranscodeDnxhd120():
69+
"""
70+
Transcode one video stream (profile dnxhd120).
71+
"""
72+
inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_FILE']
73+
outputFileName = "testTranscodeDnxhd120.mxf"
74+
75+
ouputFile = av.OutputFile( outputFileName )
76+
transcoder = av.Transcoder( ouputFile )
77+
78+
transcoder.add( inputFileName, 0, "dnxhd120" )
79+
80+
progress = av.ConsoleProgress()
81+
transcoder.process( progress )
82+
83+
# get dst file of transcode
84+
dst_inputFile = av.InputFile( outputFileName )
85+
dst_inputFile.analyse( progress, av.eAnalyseLevelFirstGop )
86+
dst_properties = dst_inputFile.getProperties()
87+
dst_videoStream = dst_properties.getVideoProperties()[0]
88+
89+
assert_equals( "dnxhd", dst_videoStream.getCodecName() )
90+
assert_equals( "VC3/DNxHD", dst_videoStream.getCodecLongName() )
91+
# assert_equals( 120000000, dst_videoStream.getBitRate() ) # 120000000 != 0L
92+
assert_equals( "yuv422p", dst_videoStream.getPixelProperties().getPixelName() )
93+
# assert_equals( 1, dst_videoStream.getGopSize() ) # 1 != 12L
94+
assert_equals( 25, dst_videoStream.getFps() )
95+
96+
def testTranscodeDnxhd185():
97+
"""
98+
Transcode one video stream (profile dnxhd185).
99+
"""
100+
inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_FILE']
101+
outputFileName = "testTranscodeDnxhd185.mxf"
102+
103+
ouputFile = av.OutputFile( outputFileName )
104+
transcoder = av.Transcoder( ouputFile )
105+
106+
transcoder.add( inputFileName, 0, "dnxhd185" )
107+
108+
progress = av.ConsoleProgress()
109+
transcoder.process( progress )
110+
111+
# get dst file of transcode
112+
dst_inputFile = av.InputFile( outputFileName )
113+
dst_inputFile.analyse( progress, av.eAnalyseLevelHeader )
114+
dst_properties = dst_inputFile.getProperties()
115+
dst_videoStream = dst_properties.getVideoProperties()[0]
116+
117+
assert_equals( "dnxhd", dst_videoStream.getCodecName() )
118+
assert_equals( "VC3/DNxHD", dst_videoStream.getCodecLongName() )
119+
# assert_equals( 185000000, dst_videoStream.getBitRate() ) # 185000000 != 0L
120+
assert_equals( "yuv422p", dst_videoStream.getPixelProperties().getPixelName() )
121+
# assert_equals( 1, dst_videoStream.getGopSize() ) # 1 != 12L
122+
assert_equals( 25, dst_videoStream.getFps() )
123+
124+
def testTranscodeDnxhd185x():
125+
"""
126+
Transcode one video stream (profile dnxhd185x).
127+
"""
128+
inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_FILE']
129+
outputFileName = "testTranscodeDnxhd185x.mxf"
130+
131+
ouputFile = av.OutputFile( outputFileName )
132+
transcoder = av.Transcoder( ouputFile )
133+
134+
transcoder.add( inputFileName, 0, "dnxhd185x" )
135+
136+
progress = av.ConsoleProgress()
137+
transcoder.process( progress )
138+
139+
# get dst file of transcode
140+
dst_inputFile = av.InputFile( outputFileName )
141+
dst_inputFile.analyse( progress, av.eAnalyseLevelHeader )
142+
dst_properties = dst_inputFile.getProperties()
143+
dst_videoStream = dst_properties.getVideoProperties()[0]
144+
145+
assert_equals( "dnxhd", dst_videoStream.getCodecName() )
146+
assert_equals( "VC3/DNxHD", dst_videoStream.getCodecLongName() )
147+
# assert_equals( 185000000, dst_videoStream.getBitRate() ) # 185000000 != 0L
148+
assert_equals( "yuv422p10le", dst_videoStream.getPixelProperties().getPixelName() )
149+
# assert_equals( 1, dst_videoStream.getGopSize() ) # 1 != 12L
150+
assert_equals( 25, dst_videoStream.getFps() )
151+
152+
def testTranscodeYUV420():
153+
"""
154+
Process one video stream (custom profile of encoding, with pixel format YUV420).
155+
"""
156+
inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_FILE']
157+
outputFileName = "testTranscodeYUV420.avi"
158+
159+
ouputFile = av.OutputFile( outputFileName )
160+
transcoder = av.Transcoder( ouputFile )
161+
162+
# create custom profile
163+
customProfile = av.ProfileMap()
164+
customProfile[av.avProfileIdentificator] = "customProfile"
165+
customProfile[av.avProfileIdentificatorHuman] = "custom profile"
166+
customProfile[av.avProfileType] = av.avProfileTypeVideo
167+
customProfile[av.avProfileFrameRate] = "25"
168+
customProfile[av.avProfileCodec] = "mpeg2video"
169+
customProfile[av.avProfilePixelFormat] = "yuv422p"
170+
171+
transcoder.add( inputFileName, 0, customProfile )
172+
173+
progress = av.ConsoleProgress()
174+
transcoder.process( progress )
175+
176+
# get dst file of transcode
177+
dst_inputFile = av.InputFile( outputFileName )
178+
dst_inputFile.analyse( progress, av.eAnalyseLevelHeader )
179+
dst_properties = dst_inputFile.getProperties()
180+
dst_videoStream = dst_properties.getVideoProperties()[0]
181+
182+
assert_equals( "mpeg2video", dst_videoStream.getCodecName() )
183+
assert_equals( "yuv422p", dst_videoStream.getPixelProperties().getPixelName() )
223184

tools/travis.python.nosetests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export AVPROFILES=`pwd`/build/dist/share/ressource
88

99
# Get assets
1010
git clone https://github.com/avTranscoder/avTranscoder-data.git
11-
export AVTRANSCODER_TEST_VIDEO_FILE=`pwd`/avTranscoder-data/video/BigBuckBunny/BigBuckBunny_480p_stereo.avi
11+
export AVTRANSCODER_TEST_VIDEO_FILE=`pwd`/avTranscoder-data/video/BigBuckBunny/BigBuckBunny_HD.mp4
1212
export AVTRANSCODER_TEST_AUDIO_FILE=`pwd`/avTranscoder-data/audio/frequenciesPerChannel.wav
1313

1414
# Launch tests

0 commit comments

Comments
 (0)