eZo*_*eZo 5 video ffmpeg subtitle node.js fluent-ffmpeg
我正在尝试将字幕刻录到视频中。此命令从命令行完美运行:
ffmpeg -i in.mp4 -vf subtitles=sub.srt:force_style='Fontsize=20' out.mp4
我在服务器端的代码似乎没有做太多(虽然它创建了 test.mp4)
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');
Run Code Online (Sandbox Code Playgroud)
我收到以下错误: Error: ffmpeg exited with code 1: Error opening filters!
好的,我找到了我们的问题。文件格式不正确.srt。相比之下,这是我们不正确的文件(=时机很重要):
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
Run Code Online (Sandbox Code Playgroud)
这是正确的:
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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1401 次 |
| 最近记录: |