用新的视频音频替换现有的视频音频并循环播放音频直到视频结束 [FFMPEG]
Replacing existing video audio with a new one and loop the audio until video finish [FFMPEG]
我想用新的音频替换视频中的现有音频,更新后的音频将循环播放直到视频结束[因为音频持续时间可能比视频持续时间短]。我已尝试使用以下命令并且循环正常,但如何替换现有音频?
String[] command = new String[]{"-y", "-i", videoPath ,"-filter_complex", "amovie="+audioPath+":loop=0,asetpts=N/SR/TB[aud];[0:a][aud]amix[a]", "-map", "0:v" ,"-map", "[a]", "-c:v", "copy", "-c:a", "aac", "-shortest","-preset", "ultrafast", videoOutputDestination};
简单地省略 amix 过滤器。
替换:
amovie="+audioPath+":loop=0,asetpts=N/SR/TB[aud];[0:a][aud]amix[a]
与:
amovie="+audioPath+":loop=0,asetpts=N/SR/TB[a]
我想用新的音频替换视频中的现有音频,更新后的音频将循环播放直到视频结束[因为音频持续时间可能比视频持续时间短]。我已尝试使用以下命令并且循环正常,但如何替换现有音频?
String[] command = new String[]{"-y", "-i", videoPath ,"-filter_complex", "amovie="+audioPath+":loop=0,asetpts=N/SR/TB[aud];[0:a][aud]amix[a]", "-map", "0:v" ,"-map", "[a]", "-c:v", "copy", "-c:a", "aac", "-shortest","-preset", "ultrafast", videoOutputDestination};
简单地省略 amix 过滤器。
替换:
amovie="+audioPath+":loop=0,asetpts=N/SR/TB[aud];[0:a][aud]amix[a]
与:
amovie="+audioPath+":loop=0,asetpts=N/SR/TB[a]