def setUp(self) -> None: super().setUp() self.video_metadata = video_meta_data(width=1920, height=1080, dar=1.777777778, par=1.0, duration=300.0, frame_rate=10.0, frame_count=3000) self.source_audio_duration = 200.0 self.source_sampling_rate = 48000 self.source_samples_count = (self.source_audio_duration * self.source_sampling_rate) self.source_audio_bitrate = 128000 self.audio_metadata = audio_meta_data( duration=self.source_audio_duration, sampling_rate=self.source_sampling_rate, samples_count=self.source_samples_count, bit_rate=self.source_audio_bitrate, ) self.target_audio_bitrate = 64000 self.source = inputs.Input( input_file='input.mp4', streams=(inputs.Stream(VIDEO, meta=self.video_metadata), inputs.Stream(AUDIO, meta=self.audio_metadata))) self.output = outputs.output_file( 'output.mp4', codecs.VideoCodec('libx264'), FdkAAC(bitrate=self.target_audio_bitrate)) self.input_list = inputs.InputList((self.source, )) self.output_list = outputs.OutputList((self.output, )) self.fc = FilterComplex(self.input_list, self.output_list)
def test_append_source(self): """ Source file streams receive indices when appended to input list. """ il = inputs.InputList() v3 = inputs.Stream(StreamType.VIDEO) il.append(inputs.Input(streams=(v3, ))) self.assertEqual(v3.name, '0:v')
def test_input_list(self): """ Inputs and streams are properly enumerated.""" il = inputs.InputList((self.i1, self.i2)) self.assertEqual(il[0].index, 0) self.assertEqual(il[1].index, 1) self.assertEqual(self.v1.name, '0:v') self.assertEqual(self.a1.name, '0:a') self.assertEqual(self.v2.name, '1:v') self.assertEqual(self.a2.name, '1:a') self.assertEqual(self.a3.name, '1:a:1')
def setUp(self) -> None: super().setUp() self.video_metadata = video_meta_data(width=1920, height=1080, dar=1.777777778, par=1.0, duration=300.0, frame_rate=10.0, frame_count=3000) self.audio_metadata = audio_meta_data(duration=200.0, sampling_rate=48000, samples_count=200 * 48000) self.source = inputs.Input( input_file='input.mp4', streams=(inputs.Stream(VIDEO, meta=self.video_metadata), inputs.Stream(AUDIO, meta=self.audio_metadata))) self.output = outputs.output_file('output.mp4', codecs.VideoCodec('libx264'), codecs.AudioCodec('libfdk_aac')) self.input_list = inputs.InputList((self.source, )) self.output_list = outputs.OutputList((self.output, )) self.fc = FilterComplex(self.input_list, self.output_list)
def fc_factory(): src = inputs.input_file("input.mp4", inputs.Stream(VIDEO)) dst = outputs.output_file('output.mp4') fc = FilterComplex(inputs.InputList((src, )), outputs.OutputList((dst, ))) return fc, src, dst