i am having issue, to concat video, it looses the audio sync and audio started from previous video.
i have tried below two link/so answer by Mulvya, but none of them work :(
here is the code i am trying:
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: 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: 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:
Video Sync Issue Source And Result Files
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.
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:
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 filesand same for 2nd file
then files can be joined together
where concat.txt file contains