从 FFmpeg 流式传输 RTSP 需要哪些步骤? [英] What steps are needed to stream RTSP from FFmpeg?
问题描述
从 FFmpeg 流式传输 RTSP 需要哪些步骤?
What steps are needed to stream RTSP from FFmpeg?
流式传输 UDP 不是问题,但由于我想流式传输到可以本机读取 RTSP 流的移动设备,我找不到任何可以说明确切需要什么的设置.我需要像 LIVE555 这样的 RTSP 流媒体服务器还是只能使用 FFmpeg?
Streaming UDP is not a problem, but as I want to stream to mobile devices which can natively read RTSP streams, I couldn't find any setup which tells what exactly is needed. Do I need an RTSP streaming server like LIVE555 or can I use FFmpeg only?
我的命令:
ffmpeg -i space.mp4 -vcodec libx264 -tune zerolatency -crf 18 -f rtsp -muxdelay 0.1 rtsp://192.168.1.200:1234
我收到输入/输出错误.
I get an Input/Output error.
我是否需要 SDP 描述才能使用 RTSP?如果是,我必须把它放在哪里?
Do I need a SDP description to use RTSP? And if yes where do I have to put it?
推荐答案
您可以使用 FFserver 使用 RTSP 流式传输视频.
You can use FFserver to stream a video using RTSP.
只需将控制台语法更改为如下所示:
Just change console syntax to something like this:
ffmpeg -i space.mp4 -vcodec libx264 -tune zerolatency -crf 18 http://localhost:1234/feed1.ffm
创建一个 ffserver.config
文件 (sample),您在其中声明 HTTPPort
、RTSPPort
和 SDP 流.您的配置文件可能如下所示(可能缺少一些重要内容):
Create a ffserver.config
file (sample) where you declare HTTPPort
, RTSPPort
and SDP stream. Your config file could look like this (some important stuff might be missing):
HTTPPort 1234
RTSPPort 1235
<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 2M
ACL allow 127.0.0.1
</Feed>
<Stream test1.sdp>
Feed feed1.ffm
Format rtp
Noaudio
VideoCodec libx264
AVOptionVideo flags +global_header
AVOptionVideo me_range 16
AVOptionVideo qdiff 4
AVOptionVideo qmin 10
AVOptionVideo qmax 51
ACL allow 192.168.0.0 192.168.255.255
</Stream>
通过这样的设置,您可以通过键入以下内容使用 VLC 观看流:
With such setup you can watch the stream with i.e. VLC by typing:
rtsp://192.168.0.xxx:1235/test1.sdp
这是 FFserver 文档.
这篇关于从 FFmpeg 流式传输 RTSP 需要哪些步骤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!