[英]Add audio (with an offset) to video with FFMPEG
I have a 10 minute video and a 50 minute audio mp3. 我有一个10分钟的视频和50分钟的音频mp3。 The video starts at 500 seconds into the audio. 视频从音频开始500秒开始。 Using FFMPEG, how can I add the the audio to the video but specify a 500 seconds audio offset (So that they sync up)? 使用FFMPEG,如何将音频添加到视频中,但指定500秒的音频偏移 (以便它们同步)?
EDIT: 编辑:
Down the bottom of this page it suggests how to specify an offset. 在本页底部,它建议如何指定偏移量。
$ ffmpeg -i video_source -itsoffet delay -i audio_source -map 0:x -map 1:y .......
However, when I apply this, it still starts the audio from the start. 但是,当我应用它时,它仍然从一开始就启动音频。
I couldn't get audio to offset properly either, and some searching suggests that -itsoffset
is currently broken . 我无法正确地补偿音频,有些搜索表明-itsoffset
目前已被破坏 。
You could try and get/compile an old version of ffmpeg before it broke (which doesn't sound like much fun). 你可以尝试在它崩溃之前获取/编译旧版本的ffmpeg(听起来不是很有趣)。
Alternately, you could pad your audio with the necessary silence using something like sox and then combine: 或者,您可以使用sox之类的必要静音填充音频,然后组合:
sox -null silence.mp3 trim 0 500 # use -r to adjust sample-rate if necessary
sox silence.mp3 input.mp3 padded_input.mp3
ffmpeg -i in.avi -i padded_input.mp3 out.avi
We are 8 years later, and the -itsoffset
does work. 我们是8年后, -itsoffset
确实有效。
Exactly as in your linked page : 与链接页面完全一样:
ffmpeg -i input_1 -itsoffset 00:00:03 -i input_2
Note that you place the -itsoffset
switch before the input you want to delay , in this case input_2
will be delayed. 请注意, 在要延迟的输入之前放置-itsoffset
开关,在这种情况下, input_2
将被延迟。
So in your case that the video starts later, you would add -itsoffset 00:08:20
before the video input. 因此,在您的情况下,视频稍后启动,您将在视频输入之前添加-itsoffset 00:08:20
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.