forked from avTranscoder/avTranscoder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestTranscoderGenerateStream.py
More file actions
97 lines (73 loc) · 2.44 KB
/
Copy pathtestTranscoderGenerateStream.py
File metadata and controls
97 lines (73 loc) · 2.44 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
from nose.tools import *
from pyAvTranscoder import avtranscoder as av
@raises(RuntimeError)
def testTranscodeNoStream():
"""
Can't process with no stream.
"""
outputFileName = "testTranscodeNoStream.avi"
ouputFile = av.OutputFile( outputFileName )
transcoder = av.Transcoder( ouputFile )
transcoder.process()
@raises(RuntimeError)
def testGenerateVideoWithIncompleteProfile():
"""
Can't generate a video stream without an encoding profile with:
- codec name
- pixel format
- width
- height
"""
outputFileName = "testGenerateVideoWithIncompleteProfile.avi"
ouputFile = av.OutputFile( outputFileName )
transcoder = av.Transcoder( ouputFile )
encodingProfile = {
av.avProfileIdentificator : "newVideoPreset",
av.avProfileIdentificatorHuman : "New video preset",
av.avProfileType : av.avProfileTypeVideo,
}
transcoder.addGenerateStream( encodingProfile )
transcoder.process()
@raises(RuntimeError)
def testGenerateAudioWithIncompleteProfile():
"""
Can't generate an audio stream without an encoding profile with:
- codec name
- sample format
- sample rate
- number of channels
"""
outputFileName = "testGenerateAudioWithIncompleteProfile.wav"
ouputFile = av.OutputFile( outputFileName )
transcoder = av.Transcoder( ouputFile )
encodingProfile = {
av.avProfileIdentificator : "newAudioPreset",
av.avProfileIdentificatorHuman : "New audio preset",
av.avProfileType : av.avProfileTypeAudio,
}
transcoder.addGenerateStream( encodingProfile )
transcoder.process()
def testTranscodeDummyAudio():
"""
Process one frame with a dummy audio (profile wave24b48kmono).
"""
outputFileName = "testTranscodeDummyAudio.wav"
ouputFile = av.OutputFile( outputFileName )
transcoder = av.Transcoder( ouputFile )
# generate an audio stream
transcoder.addGenerateStream( "wave24b48kmono" )
ouputFile.beginWrap()
transcoder.processFrame()
ouputFile.endWrap()
def testTranscodeDummyVideo():
"""
Process one frame with a dummy video (profile dnxhd120).
"""
outputFileName = "testTranscodeDummyVideo.avi"
ouputFile = av.OutputFile( outputFileName )
transcoder = av.Transcoder( ouputFile )
# generate a video stream
transcoder.addGenerateStream( "dnxhd120" )
ouputFile.beginWrap()
transcoder.processFrame()
ouputFile.endWrap()