I'm trying to burn in subtitles into a video. This command works perfectly from command line:
ffmpeg -i in.mp4 -vf subtitles=sub.srt:force_style='Fontsize=20' out.mp4
My code on server side doesn't seem to do much (it creates test.mp4 though)
ffmpeg('temp/subtitleVideos/qTWVbM5pkKms_pJbE8OAvH3N.mp4')
.outputOptions(
'-vf subtitles=temp/subtitleVideos/qTWVbM5pkKms_pJbE8OAvH3N.srt'
)
.on('error', function(err) {
console.log('Error: ' + err.message);
})
.save(path + 'test.mp4');
and I get the following error: Error: ffmpeg exited with code 1: Error opening filters!
Ok, I've found our problem. It was incorrect format of .srt
file.
To compare, this is our incorrect file (=timing is important):
1
00:00:00 --> 00:00:03
kitty cat
2
00:00:03,372 --> 00:00:05,674
is sitting
3
00:00:05,795 --> 00:00:08,905
on a pad
and this one is correct:
1
00:00:00,828 --> 00:00:03,130
kitty cat
2
00:00:03,372 --> 00:00:05,674
is sitting
3
00:00:05,795 --> 00:00:08,905
on a pad
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With