gpt4 book ai didi

Ffmpeg 命令通过循环向视频添加更短的音频

转载 作者:行者123 更新时间:2023-12-04 23:31:36 32 4
gpt4 key购买 nike

Ffmpeg 命令通过循环向视频添加更短的音频

我正在使用此命令向视频添加音频,音频长 18 秒,视频长 3 分 29 秒,此命令添加音频但仅在前 18 秒,然后停止

"-y","-stream_loop","-1","-i", audio,"-i",j, "-filter_complex",
"[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a1];" +
"[1:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.8[a2];" +
" [a1][a2]amerge,pan=stereo:c0<c0+c2:c1<c1+c3[out]",
"-map","1:v","-map","[out]","-c:v","copy","-c:a","aac","-shortest","-preset", "ultrafast", out

我们如何在循环中添加音频并将其添加到视频中

编辑

对于时间问题,我做了以下更改
"-y","-i",video,"-filter_complex","amovie="+audio+":loop=999,asetpts=N/SR/TB,aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a1];" +[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.8[a2];" +"[a1][a2]amerge,pan=stereo:c0<c0+c2:c1<c1+c3[out]",
"-t", timetoedit,
"-map","0:v","-map","[out]","-c:v","copy","-c:a","aac","-shortest","-preset", "ultrafast", out

如果我们想在整个视频中添加音频,这很好用

现在,当我们尝试添加在特定时间开始并持续特定持续时间的音频时,它会失败
这里有两件事,
1) 创建一个包含特定持续时间的音频和视频的新剪辑
此命令不起作用
"-y","-i",video,,"ss",starttime,"-t", timetoedit,"-filter_complex","amovie="+audio+":loop=999,asetpts=N/SR/TB,aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a1];" +[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.8[a2];" +"[a1][a2]amerge,pan=stereo:c0<c0+c2:c1<c1+c3[out]",
"-ss", starttime,"-t", timetoedit,
"-map","0:v","-map","[out]","-c:v","copy","-c:a","aac","-shortest","-preset", "ultrafast", out

或者如果我们只想在特定时间添加音频

喜欢
"-y","-i",video,"-filter_complex","amovie="+audio+":loop=999,asetpts=N/SR/TB,aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a1];" +[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.8[a2];" +"[a1][a2]amerge,pan=stereo:c0<c0+c2:c1<c1+c3[out]",
"-ss", starttime,"-t", timetoedit,
"-map","0:v","-map","[out]","-c:v","copy","-c:a","aac","-shortest","-preset", "ultrafast", out

如何才能做到这一点

这很有用
https://superuser.com/questions/708125/add-audio-at-specific-time-in-video-using-ffmpeg

但是我们如何在特定的开始时间和持续时间使用它

最佳答案

利用

"-y","-i",j, "-filter_complex",
"amovie=audio:loop=999,asetpts=N/SR/TB,aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a1];" +
"[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.8[a2];" +
" [a1][a2]amerge,pan=stereo:c0<c0+c2:c1<c1+c3[out]",
"-map","0:v","-map","[out]","-c:v","copy","-c:a","aac","-shortest","-preset", "ultrafast", out
-stream_loop是 buggy 。请改用具有循环选项的电影过滤器。

关于Ffmpeg 命令通过循环向视频添加更短的音频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46542809/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com