FFMPEG -F Concat Video, Audio Sycn Issue

血红的双手。 提交于 2019-12-01 11:51:21

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.

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.

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.

best regards

some other solution for syncing audio & video

use -bsf:v h264_mp4toannexb in your input files

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

and same for 2nd file

ffmpeg.exe -i "2.avi" -af apad -vf scale=1280:720 -crf 15.0 -vcodec libx264 -acodec aac -bsf:v h264_mp4toannexb -ar 48000 -b:a 192k -coder 1 -rc_lookahead 60 -threads 0 -shortest -avoid_negative_ts make_zero -fflags +genpts output2.flv

then files can be joined together

ffmpeg -f concat -safe 0 -i concat.txt -c copy -bsf:a aac_adtstoasc final.flv

where concat.txt file contains

file 'output1.flv'
file 'output2.flv'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!