使用ffmpeg三方:https://github.com/abyuthup/mobile-ffmpeg
兼容处理android10的不能操作二进制文件流问题;
1、添加字幕
主要命令:-i videoPath.mp4 -q 5 -vf ass=subtitle.ass -y outPath.mp4
其中-q 5命令是为了生成的视频不会很模糊

2、添加字幕和配音
主要命令:ffmpeg -y -i video1.mp4 -i audio1.mp3 -i audio2.mp3 -filter_complex "[1]atrim=0:5,adelay=3000|3000[aud1];[2]atrim=0:6,adelay=10000|10000[aud2];[aud1][aud2]amix=2,apad,atrim=0:20[a]" -map 0:v -map "[a]" -c:v copy -ac 2 output.mp4

网友评论