fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Saving rtmp stream to mp4 file problem

michalslime opened this issue · comments

Hi Team,

Im trying to write ffmpeg command, that takes rtmp stream and saves it to mp4 file. The following command works:
ffmpeg -i rtmp://rtmp.global.cdn.vindral.com/publish/sk_b75a2aa5-9d18-4f44-8d38-cb33ac31c84b -vcodec copy -acodec copy -f mp4 output.mp4

But my command written in fluent-ffmpeg doesnt work. I guess it's because of wrong options that i used.

Thank you in advance for checking my code below!

Version information

  • fluent-ffmpeg version: 2.1.2
  • ffmpeg version: 4.4.2
  • OS: Ubuntu 22.04.1

Code to reproduce

const ffmpegStatic = require('ffmpeg-static');
const ffmpeg = require('fluent-ffmpeg');

ffmpeg.setFfmpegPath(ffmpegStatic);

ffmpeg()
.input('rtmp://rtmp.global.cdn.vindral.com/publish/sk_b75a2aa5-9d18-4f44-8d38-cb33ac31c84b')
.addOptions([
'-vcodec', 'copy',
'-acodec', 'copy',
'-f', 'mp4'
])
.output('output.mp4')
.on('error', (error) => {
console.error(error);
});

Expected results

File with recorded stream

Observed results

Not even an error message

Same problem.
use command.kill('SIGINT') to stop. but no MP4 file.
use cmd ffmpeg -i xxx -c copy -y -f mp4 output.mp4 and ctrl-c
mp4 file can save.