File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,22 +81,26 @@ VIDEO_CODEC = qencode.x264_video_codec()
8181DESTINATION.url = "..."
8282DESTINATION.key = "..."
8383DESTINATION.secret = "..."
84+ DESTINATION.remove_null_params()
8485
8586VIDEO_CODEC.vprofile = "baseline"
8687VIDEO_CODEC.level = 31
8788VIDEO_CODEC.coder = 0
8889VIDEO_CODEC.flags2 = "-bpyramid+fastpskip-dct8x8"
8990VIDEO_CODEC.partitions = "+parti8x8+parti4x4+partp8x8+partb8x8"
9091VIDEO_CODEC.directpred = 2
92+ VIDEO_CODEC.remove_null_params()
9193
9294STREAM.profile = "baseline"
9395STREAM.size = "1920x1080"
9496STREAM.audio_bitrate = 128
9597STREAM.video_codec_parameters = VIDEO_CODEC
98+ STREAM.remove_null_params()
9699
97100FORMAT.stream = [STREAM]
98101FORMAT.output = "advanced_hls"
99102FORMAT.destination = DESTINATION
103+ FORMAT.remove_null_params()
100104
101105params.source = 'your source url'
102106params.format = [FORMAT]
Original file line number Diff line number Diff line change 11import json
22from json import JSONEncoder
3+ from utils import rm_key_if_null
34
45class CustomTranscodingParams (object ):
56 """CustomTranscodingParams
@@ -12,6 +13,9 @@ def __init__(self):
1213 self .source = None
1314 self .format = None
1415
16+ def remove_null_params (self ):
17+ rm_key_if_null (self )
18+
1519class Format (object ):
1620 """
1721 :var
@@ -25,12 +29,18 @@ def __init__(self):
2529 self .segment_duration = None
2630 self .stream = None
2731
32+ def remove_null_params (self ):
33+ rm_key_if_null (self )
34+
2835class Destination (object ):
2936 def __init__ (self ):
3037 self .url = None
3138 self .key = None
3239 self .secret = None
3340
41+ def remove_null_params (self ):
42+ rm_key_if_null (self )
43+
3444class Stream (object ):
3545 def __init__ (self ):
3646 self .size = None
@@ -52,6 +62,10 @@ def __init__(self):
5262 self .audio_codec = None
5363 self .downmix_mode = None
5464
65+ def remove_null_params (self ):
66+ rm_key_if_null (self )
67+
68+
5569
5670class Libx264_VideoCodecParameters (object ):
5771 def __init__ (self ):
@@ -64,6 +78,9 @@ def __init__(self):
6478 self .directpred = None
6579 self .me_method = None
6680
81+ def remove_null_params (self ):
82+ rm_key_if_null (self )
83+
6784class Libx265_VideoCodecParameters (object ):
6885 def __init__ (self ):
6986 pass
Original file line number Diff line number Diff line change @@ -13,6 +13,11 @@ def get_percent(p):
1313 return round (p )
1414 return 0
1515
16+ def rm_key_if_null (class_obj ):
17+ for key , val in class_obj .__dict__ .items ():
18+ if not val :
19+ class_obj .__dict__ .pop (key )
20+
1621def progress_bar (self , custom_message = None ):
1722 message = custom_message if custom_message else ''
1823 while 1 :
Original file line number Diff line number Diff line change 2020DESTINATION .url = "s3://s3-eu-west-2.amazonaws.com/qencode-test"
2121DESTINATION .key = "AKIAIKZIPSJ7SDAIWK4A"
2222DESTINATION .secret = "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"
23+ DESTINATION .remove_null_params ()
2324
2425VIDEO_CODEC .vprofile = "baseline"
2526VIDEO_CODEC .level = 31
2627VIDEO_CODEC .coder = 0
2728VIDEO_CODEC .flags2 = "-bpyramid+fastpskip-dct8x8"
2829VIDEO_CODEC .partitions = "+parti8x8+parti4x4+partp8x8+partb8x8"
2930VIDEO_CODEC .directpred = 2
31+ VIDEO_CODEC .remove_null_params ()
3032
3133STREAM .profile = "baseline"
3234STREAM .size = "1920x1080"
3335STREAM .audio_bitrate = 128
3436STREAM .video_codec_parameters = VIDEO_CODEC
37+ STREAM .remove_null_params ()
3538
3639FORMAT .stream = [STREAM ]
3740FORMAT .output = "advanced_hls"
3841FORMAT .destination = DESTINATION
42+ FORMAT .remove_null_params ()
3943
4044params .source = 'https://qa.qencode.com/static/1.mp4'
4145params .format = [FORMAT ]
You can’t perform that action at this time.
0 commit comments