How to add subtitle and concat video file in a line with ffmpeg?

1

1

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.

nhanpt

Posted 2014-01-22T04:01:58.833

Reputation: 11

Please confirm that you want hardsubs (burned in) instead of softsubs, and include the complete ffmpeg console output from your ffmpeg command. – llogan – 2014-01-22T09:08:00.343

Answers

0

I use:

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

nhanpt

Posted 2014-01-22T04:01:58.833

Reputation: 11

2

I suppose i should be something like that:

fmpeg  -i 1387432825.avi -i 1387435884.avi -i 1387436066.avi\
-filter_complex \
"[0:v]ass=part1.ass[video0];[1:v]ass=part1.ass[video1];\
[2:v]ass=part1.ass[video2];\
[video0][video1][video2]concat=n=3[out]" \
-map [out] -preset ultrafast -y final.mp4

And if you need sound, you should also do the same concat and map for audio streams. Hope it helps.

ptQa

Posted 2014-01-22T04:01:58.833

Reputation: 1 599