FFMPEG -F Concat视频,音频同步问题 [英] FFMPEG -F Concat Video, Audio Sync Issue

查看:507
本文介绍了FFMPEG -F Concat视频,音频同步问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了问题,要合并视频,它会失去音频同步,并且会从以前的视频开始播放音频。

i am having issue, to concat video, it looses the audio sync and audio started from previous video.

我尝试了以下两个链接,所以Mulvya回答了,但它们都不起作用:(

i have tried below two link/so answer by Mulvya, but none of them work :(

这是我正在尝试的代码:

here is the code i am trying:

1:编码文件a(1):

1: re-encode file a (1):

ffmpeg.exe -i "f:\1.avi" -af apad -vf scale=1280:720 -crf 15.0 -vcodec libx264 -acodec aac -ar 48000 -b:a 192k -coder 1 -rc_lookahead 60 -threads 0 -shortest -avoid_negative_ts make_zero -fflags +genpts 01.mp4

2:重新编码文件b(2):

2: re-encode file b (2):

ffmpeg.exe -i "f:\2.mp4" -af apad -vf scale=1280:720 -crf 15.0 -vcodec libx264 -acodec aac -ar 48000 -b:a 192k -coder 1 -rc_lookahead 60 -threads 0 -shortest -avoid_negative_ts make_zero -fflags +genpts 02.mp4

3:现在使用以下命令联系:

3: Now contact using following command:

ffmpeg.exe -f concat -safe 0 -i "f:\files.txt" -c copy test.mp4

,但音频未与视频同步;(

but audio is not synced with video ;(

我也同时上传了视频(以及输出)在保管箱上:

i also uploaded both video (and also the output) on dropbox:

视频同步问题的源文件和结果文件

所以,任何帮助,如何使音频完美同步带有视频的效果会很棒:)

so, any help, how to make audio perfectly sync with video would be great :)

推荐答案

另一个论坛上的其他人帮助我找到了问题。因此,我在这里将其发布为答案,以便其他人可以得到帮助。

Some one else on another forum helped me to find the issue. So, i post it as answer here so that someone else may can get help.

我担心相同的帧大小,音频和视频编解码器能否正确连接,但我忘记了帧速率

I was concerned about same frame size, audio and video codec to concat properly, but i forgot about frame rate.

第一个示例视频(在我的问题中提到)的帧速率是12,而第二个视频帧速率是25;这就是造成同步问题的原因。

That first sample video (mentioned in my question) frame rate was 12, while 2nd video frame rate was 25; and that's what make the sync problem.

现在,我已将这两个视频的帧频设置为25(-r 25),它的工作方式就像是超级按钮:)

Now, i have set frame rate 25 to those two video (-r 25) and it's works like charms :)

下面是完整的转换代码:

below is the full conversion code:

ffmpeg.exe -i "f:\1.avi" -r 25 -af apad -vf scale=1280:720 -crf 15.0 -vcodec libx264 -acodec aac -ar 48000 -b:a 192k -coder 1 -rc_lookahead 60 -threads 0 -shortest -avoid_negative_ts make_zero -fflags +genpts 01.mp4

希望不久后对像我这样的人有所帮助。

hope it may help some one like me in near future.

最诚挚的问候

这篇关于FFMPEG -F Concat视频,音频同步问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆