I have 3 videos : 1387432825.avi, 1387435884.avi, 1387436066.avi and 3 subtitles for videos: part1.ass, part2.ass, part3.ass I try to add subtitle to each videos with commands:
ffmpeg -i 1387432825.avi -vf 'ass=part1.ass' -preset ultrafast -y part1.mp4
ffmpeg -i 1387435884.avi -vf 'ass=part2.ass' -preset ultrafast -y part2.mp4
ffmpeg -i 1387436066.avi -vf 'ass=part3.ass' -preset ultrafast -y part3.mp4
Then, I concat 3 output with commands:
ffmpeg -i part1.mp4 -i part2.mp4 -i part3.mp4 -filter_complex 'concat=n=3' -preset ultrafast -y total.mp4
Finally, I have total.mp4 with subtiles!!! But I have 4 commands for 3 video files. I want to do it with 1 command. Any help?
P/S: I try to using this command:
ffmpeg -i 1387432825.avi -i 1387435884.avi -i 1387436066.avi -filter_complex 'concat=n=3[join];[join]ass=total.ass' -preset ultrafast -y final.mp4
But I think it’s not good for my works.
Answer:
ffmpeg -threads 0 -i 1387432825.avi -i 1387436066.avi -i 1387435884.avi -filter_complex 'ass=part1.ass[1];ass=part2.ass[2];ass=part3.ass[3];[1][2][3]concat=n=3' -preset ultrafast -y final.mp4
Categories: Uncategorized
[…] How to add subtitle and concat video file in a line with ffmpeg?. […]