fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)
MIT License
7.94k stars 880 forks source link

Saving rtmp stream to mp4 file problem #1219

Open michalslime opened 1 year ago

michalslime commented 1 year ago

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

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

lanayalouisforever commented 11 months ago

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.