如何将原始 RTSP 流转储到文件? [英] How to dump raw RTSP stream to file?

查看:28
本文介绍了如何将原始 RTSP 流转储到文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将原始 RTSP 流转储到文件中,然后再将文件解码为可播放的内容?

Is it possible to dump a raw RTSP stream to file and then later decode the file to something playable?

目前我使用 FFmpeg 来接收和解码流,将其保存为 mp4 文件.这工作得很好,但会占用大量 CPU,并且会严重限制我可以在我的服务器上同时接收的 RTSP 流的数量.

Currently I'm using FFmpeg to receive and decode the stream, saving it to an mp4 file. This works perfectly, but is CPU intensive, and will severely limit the number of RTSP streams I can receive simultaneously on my server.

我想将流保存到文件而不解码它,并将解码部分延迟到需要打开文件时.

I would like to save the stream to file without decoding it, and delay the decoding part to when the file needs to be opened.

这可能吗?

我尝试过 VLC,它比 FFmpeg 更占用 CPU.我还查看了这个问题,其中的答案是将 RTSP 转储到文件没有用,并且这个问题,其中问题下方的评论说Raw RTSP content is not well适合保存和重播...",这似乎表明有办法.

I have tried VLC, which is even more CPU intensive than FFmpeg. I've also looked at this question where the answer says dumping RTSP to file is not useful, and this question, where the comment below the question says "Raw RTSP content is not well suited for save and replay...", which seems to indicate that there is way.

提前致谢!

编辑这是我用于 FFmpeg 的命令:

EDIT Here is the command I'm using for FFmpeg:

ffmpeg -i rtsp://@192.168.241.1:62159 -r 15 C:/DB_Videos/2013-04-30 17_18_34.703.mp4

推荐答案

如果您在 ffmpeg 命令行中重新编码,这可能是 CPU 密集型的原因.您只需将流复制到单个容器即可.因为我没有你的命令行,所以我不能在这里建议具体的改进.我只能说你的 acodec 和 vcodec 应该设置为复制.

If you are reencoding in your ffmpeg command line, that may be the reason why it is CPU intensive. You need to simply copy the streams to the single container. Since I do not have your command line I cannot suggest a specific improvement here. Your acodec and vcodec should be set to copy is all I can say.

看到您的命令行并且您已经尝试过,这是为了其他遇到相同问题的人的利益.命令:

On seeing your command line and given you have already tried it, this is for the benefit of others who come across the same question. The command:

ffmpeg -i rtsp://@192.168.241.1:62156 -acodec copy -vcodec copy c:/abc.mp4

不会进行转码并将文件转储到 mp4 中.当然,这是假设流式内容与 mp4 兼容(它们很可能是).

will not do transcoding and dump the file for you in an mp4. Of course this is assuming the streamed contents are compatible with an mp4 (which in all probability they are).

这篇关于如何将原始 RTSP 流转储到文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆