拼接MP4视频后全程音频无声问题求助(Python + FFmpeg)
拼接MP4视频后全程音频无声问题求助(Python + FFmpeg)
我现在碰到一个头疼的问题:把几个视频文件拼接在一起后,生成的整个视频全程没有声音。情况是这样的:我需要先生成两个带静音的视频——一个标题页和一个结尾页,都是用图片转的,然后把它们和最多7个原本带立体声(48000Hz采样率)的真实视频拼接起来,顺序是「标题页 + 最多7个视频 + 结尾页」。
我已经给标题页和结尾页加了静音,也设置了对应采样率、声道数这些参数,但拼接后的视频里,原本有声音的那些视频也没声音了,完全静音。
下面是相关的代码片段:
标题页生成代码:
( ffmpeg .input(thumbnail_path, loop=1, t=self.config.title_duration) .filter('fade', type='in', duration=self.config.fade_duration) .output(title_temp, vcodec='h264', acodec='aac', af='aevalsrc=0:d={}[aout]:s=48000:c=2'.format(self.config.title_duration)) .overwrite_output() .run(capture_stdout=True, capture_stderr=True) )
结尾页生成代码:
( ffmpeg .input(end_screen_path, loop=1, t=self.config.end_screen_duration) .filter('fade', type='in', duration=self.config.fade_duration) .output(end_temp, vcodec='h264', acodec='aac', af='aevalsrc=0:d={}[aout]:s=48000:c=2'.format(self.config.end_screen_duration)) .overwrite_output() .run(capture_stdout=True, capture_stderr=True) )
拼接代码:
( ffmpeg .input(concat_file, format='concat', safe=0) .output(output_path, c='copy') .overwrite_output() .run(capture_stdout=True, capture_stderr=True) )
有没有大佬能帮忙看看问题出在哪?万分感谢!
备注:内容来源于stack exchange,提问作者John Coleman
相关产品推荐
相关产品推荐

