def setUp(self): super(CreateJobTestCase, self).setUp() input_url = 'http://bitbucketireland.s3.amazonaws.com/at_test/mono_streams.mkv' input = bitcodin.Input(input_url) self.input = bitcodin.create_input(input) audio_configs = [ bitcodin.AudioStreamConfig( default_stream_id=0, bitrate=192000 ), bitcodin.AudioStreamConfig( default_stream_id=1, bitrate=128000 ) ] video_stream_config = bitcodin.VideoStreamConfig(default_stream_id=0, bitrate=512000, profile='Main', preset='premium', height=480, width=640) encoding_profile = bitcodin.EncodingProfile('API Merge Audio Multi Profile', [video_stream_config], audio_configs) self.encoding_profile = bitcodin.create_encoding_profile(encoding_profile) self.manifests = ['m3u8', 'mpd'] merge_audio_channel_config12 = bitcodin.MergeAudioChannelConfig([1, 2]) merge_audio_channel_config34 = bitcodin.MergeAudioChannelConfig([3, 4]) self.merge_audio_channel_configs = [merge_audio_channel_config12, merge_audio_channel_config34] audio_meta_data12 = bitcodin.AudioMetaData(0, 'en', 'Channel 1 and 2 merged') audio_meta_data34 = bitcodin.AudioMetaData(1, 'en', 'Channel 3 and 4 merged') self.audio_meta_data = [audio_meta_data12, audio_meta_data34]
height=480, width=854 )) audio_configs = [ bitcodin.AudioStreamConfig(default_stream_id=0, bitrate=192000), bitcodin.AudioStreamConfig(default_stream_id=1, bitrate=192000) ] encoding_profile_obj = bitcodin.EncodingProfile('API Test Profile Closed Captions', video_configs, audio_configs) encoding_profile_result = bitcodin.create_encoding_profile(encoding_profile_obj) manifests = ['mpd', 'm3u8'] audio_meta_data = [ bitcodin.AudioMetaData(0, 'Spanish', 'es'), bitcodin.AudioMetaData(1, 'English', 'en') ] video_meta_data = [ bitcodin.VideoMetaData(0, 'Spanish', 'es') ] job = bitcodin.Job( input_id=input_result.input_id, encoding_profile_id=encoding_profile_result.encoding_profile_id, manifest_types=manifests, speed='standard', extract_closed_captions=True, audio_meta_data=audio_meta_data, video_meta_data=video_meta_data
audio_configs = list() audio_stream_config_0 = bitcodin.AudioStreamConfig(default_stream_id=0, bitrate=192000) audio_stream_config_1 = bitcodin.AudioStreamConfig(default_stream_id=1, bitrate=192000) audio_configs.append(audio_stream_config_0) audio_configs.append(audio_stream_config_1) encoding_profile_obj = bitcodin.EncodingProfile('API Test Profile', video_configs, audio_configs) encoding_profile_result = bitcodin.create_encoding_profile( encoding_profile_obj) audio_meta_data = [] audio_stream_config_0_meta_data = bitcodin.AudioMetaData(0, 'de', 'Just Sound') audio_stream_config_1_meta_data = bitcodin.AudioMetaData( 1, 'en', 'Sound and Voice') audio_meta_data.append(audio_stream_config_0_meta_data) audio_meta_data.append(audio_stream_config_1_meta_data) manifests = ['mpd', 'm3u8'] job = bitcodin.Job( input_id=input_result.input_id, encoding_profile_id=encoding_profile_result.encoding_profile_id, manifest_types=manifests, speed='standard', audio_meta_data=audio_meta_data) job_result = bitcodin.create_job(job)
encoding_profile_result = bitcodin.create_encoding_profile(encoding_profile_obj) # MERGE CONFIGURATION # Merge audio channel 1 and 2 audio streams merge_audio_channel_config12 = bitcodin.MergeAudioChannelConfig([1, 2]) # Merge audio channel 3 and 4 merge_audio_channel_config34 = bitcodin.MergeAudioChannelConfig([3, 4]) # This results in two stereo audio channels merge_audio_channel_configs = [merge_audio_channel_config12, merge_audio_channel_config34] # Create audio meta data audio_meta_data12 = bitcodin.AudioMetaData(0, 'en', 'Channel 1 and 2 merged') audio_meta_data34 = bitcodin.AudioMetaData(1, 'en', 'Channel 3 and 4 merged') audio_meta_data = [audio_meta_data12, audio_meta_data34] manifests = ['mpd', 'm3u8'] # Create the job # Audio merging is only available with speed standard job = bitcodin.Job( input_id=input_result.input_id, encoding_profile_id=encoding_profile_result.encoding_profile_id, manifest_types=manifests, speed='standard', merge_audio_channel_configs=merge_audio_channel_configs, audio_meta_data=audio_meta_data )