我需要一个可以在配置的端口(例如 8554)上监听的 RTSP 服务器,然后,例如,如果我运行 FFmpeg:
ffmpeg -f v4l2 -i /dev/video0 -c:v libx264 -intra -an -f rtsp -rtsp_transport tcp rtsp://192.168.1.10:8554/test
然后 RTSP 服务器将记录视频,并播放它,我只需要运行它:
ffplay -i rtsp://192.168.1.10:8554/test
我需要 RTSP 服务器来支持 TCP 运输和 H264 视频编码器和 作品 来自 的音频编码器和流视频直播 (不是来自文件)+ 程序应该是 无牌 .
对支持上述所有要求的 RTSP 服务器有什么建议吗?
编辑:
我已经尝试过 Gstreamer,它看起来很有希望,但我仍然没有成功。
但是,我很确定我走对了(也许我还不知道如何使用管道)。
./test-record "( decodebin name=depay0 ! videoconvert ! rtspsink )"
netstat -anp
我可以清楚地看到,服务器正在监听 tcp 端口 8554。Gstreamer
gst-launch-1.0 videotestsrc ! x264enc ! rtspclientsink location=rtsp://127.0.0.1:8554/test
FFmpeg
ffmpeg -f v4l2 -video_size 640x480 -i /dev/video0 -c:v libx264 -qp 10 -an -f rtsp -rtsp_transport tcp rtsp://127.0.0.1:8554/test
在这两种情况下,我都可以在wireshark中看到RTP数据包,
并再次调用
netstat -anp
, 我懂了:tcp 0 0 0.0.0.0:8554 0.0.0.0:* LISTEN 14386/test-record
tcp 0 0 127.0.0.1:8554 127.0.0.1:46754 ESTABLISHED 14386/test-record
tcp 0 0 127.0.0.1:46754 127.0.0.1:8554 ESTABLISHED 19479/ffmpeg
所以我可以粗暴地理解我正在流式传输(或流式传输......)。但是,当我尝试播放视频时,我遇到了失败(我尝试使用 Gstreamer、FFplay 和 VLC 播放 - 都失败了......):
Gstreamer
gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:8554/test latency=300 ! decodebin ! autovideoconvert ! autovideosink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://127.0.0.1:8554/test
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not get/set settings from/on resource.
Additional debug info:
gstrtspsrc.c(7507): gst_rtspsrc_retrieve_sdp (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Server can not provide an SDP.
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
FFplay
ffplay -i rtsp://127.0.0.1:8554/test
[rtsp @ 0x7fb140000b80] method DESCRIBE failed: 405 Method Not Allowed
rtsp://127.0.0.1:8554/test: Server returned 4XX Client Error, but not one of 40{0,1,3,4}
VLC
vlc rtsp://127.0.0.1:8554/test
VLC media player 3.0.8 Vetinari (revision 3.0.8-0-gf350b6b)
[0000000000857f10] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
Qt: Session management error: None of the authentication protocols specified are supported
[00007f9fdc000ea0] live555 demux error: Failed to connect with rtsp://127.0.0.1:8554/test
[00007f9fdc001d10] satip stream error: Failed to setup RTSP session
任何想法我做错了什么?
最佳答案
Wowza SE 与 H264、Opus、VP8 一起工作,因为它支持 WebRTC。
这个插件为使用 WebRTC、RTMP、RTSP 槽 Wowza SE 直播 channel 提供了一个交 key 设置。还可以处理所有流类型,包括带有 FFMPEG 的 RTSP,用于按需自适应转码(例如在 WebRTC 和 HLS 之间)。
https://wordpress.org/plugins/videowhisper-live-streaming-integration/
关于ffmpeg - 拼命寻找可以从实时源(而不是文件)流式传输的 RTSP 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59458505/