Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
This repository was archived by the owner on May 22, 2025. It is now read-only.

when ffmpeg Event use 'end' cannot be monitor rtsp URL,only the fs local video file end stream event? #1315

@fengjiewen1997

Description

@fengjiewen1997

const ffmpegCommand = ffmpeg(url)
.addInputOption("-rtsp_transport", "tcp")
.addInputOption("-analyzeduration", "50000", "-max_delay", "500000")
.addInputOption("-fflags", "nobuffer")
.addInputOption("-flags", "low_delay")
.on("start", () => {
console.log("Stream started.");
logger.info("Stream started.");
})
.on("codecData", (data) => {
console.log("Stream codecData:", data);
logger.info(Stream codecData: ${JSON.stringify(data)});
})
.on("stderr", (stderrLine) => {
console.error("FFmpeg stderr:", stderrLine);
logger.error(FFmpeg stderr: ${stderrLine});
// setTimeout(()=>{
// stream.end();
// },33000)
})
.on("error", (err) => {
console.error("An error occurred:", err.message);
logger.error(An error occurred: ${err.message});
stream.end();
})
.on("end", (stdout, stderr) => {
console.log("Stream ended.",stdout);
logger.info("Stream ended.");
stream.end();
})
.outputFormat("flv")
.videoCodec("copy") // 这里使用 copy 以支持原始编码(H264 或 H265)
.noAudio()
// .withDuration(33)
.pipe(stream, { end: true })

When I want to transcode an rtsp playback stream address, I cannot listen for the end event, only the fs local video file end stream event

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions