2016-03-07 1 views
2

J'essaie de graver des sous-titres dans une vidéo. Cette commande fonctionne parfaitement depuis la ligne de commande: ffmpeg -i in.mp4 -vf subtitles=sub.srt:force_style='Fontsize=20' out.mp4Ajout de sous-titres avec fluent-ffmpeg

Mon code côté serveur ne semble pas faire beaucoup (il crée test.mp4 bien)

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'); 

et je reçois l'erreur suivante: Error: ffmpeg exited with code 1: Error opening filters!

Répondre

3

Ok, j'ai trouvé notre problème. C'était le format incorrect du fichier .srt. Pour comparer, c'est notre fichier incorrect (= timing est 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 

et celui-ci est correcte:

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