使用node-rtsp-stream调用FFmpeg报错:No such file or directory
Let's break down what's causing this error and how to fix it quickly.
The root issue here is duplicate input source configuration in your node-rtsp-stream setup. The package already handles passing the RTSP stream as FFmpeg's input via the streamUrl parameter (it automatically adds the -i flag for you). But you've also manually included '-i': 'rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov' in your ffmpegOptions—this creates conflicting input commands for FFmpeg.
When FFmpeg runs, it ends up with two -i arguments, and the extra parameters get misinterpreted as an output file path that doesn't exist, hence the "No such file or directory" error.
Corrected Code
Remove the redundant -i entry from ffmpegOptions, and your setup will work as expected:
Stream = require('node-rtsp-stream'); stream = new Stream({ name: 'name', streamUrl: 'rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov', wsPort: 9999, ffmpegOptions: { '-stats': '', '-force_fps': 30, } });
Quick Tip
When using node-rtsp-stream, you never need to manually add the -i flag to ffmpegOptions—the package handles input source management through the streamUrl parameter. Use ffmpegOptions only for additional flags like -stats, -force_fps, or codec adjustments.
内容的提问来源于stack exchange,提问作者Gorka Sanz Monllor

