FFMPEG音频视频开发: 命令行方式给视频添加音频数据

一、环境介绍

操作系统介绍:win10 64位

FFMPEG版本: 4.4.2

QT版本: 5.12.6

二、FFMPEG下载

ubuntu系统下编译安装ffmpeg:  https://blog.csdn.net/xiaolong1126626497/article/details/104919095

windos系统下安装ffmpeg: https://blog.csdn.net/xiaolong1126626497/article/details/105412560

三、去掉视频原声再添加新的音频

(1)去掉视频原声:
C:\FFMPEG\ffmpeg_x86_4.2.2\bin>ffmpeg.exe -i 123.mp4 -c:v copy -an out1.mp4

(2)合并音频到视频:
C:\FFMPEG\ffmpeg_x86_4.2.2\bin>ffmpeg.exe -i out1.mp4 -i 花僮-笑纳.mp3 out2.mp4

可以指定合成时间:
C:\FFMPEG\ffmpeg_x86_4.2.2\bin>ffmpeg.exe -i out1.mp4 -i 花僮-笑纳.mp3 -t 30 out3.mp4
其中-t参数是指定时间.单位是秒.

四、保留视频原生添加新的音频

ffmpeg -i 花僮-笑纳.mp3 -i 123.mp4 -filter_complex amix=inputs=2 output.mp4

猜你喜欢

转载自blog.csdn.net/xiaolong1126626497/article/details/113469950