Linux

如何在 Linux 下為 BOSCH AutoDome Junior HD IVA 攝影機播放 RTSP 流?

  • January 9, 2022

我有一台 AutoDome Junior 高畫質 IVA 攝影機。如何在我的 Linux 發行版中播放 RTSP 流?我嘗試了 VLC,但它失敗了。還有其他可靠的工具嗎?

跟進

嘗試1:失敗

$ mplayer rtsp://192.168.1.10:554
MPlayer SVN-r33251-4.6.0 (C) 2000-2011 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing rtsp://192.168.1.10:554.
Connecting to server 192.168.1.10[192.168.1.10]: 554...

rtsp_session: unsupported RTSP server. Server type is 'unknown'.
STREAM_LIVE555, URL: rtsp://192.168.1.10:554
Stream not seekable!
file format detected.
Initiated "video/H264" RTP subsession on port 43230
demux_rtp: Failed to guess the video frame rate
VIDEO:  [H264]  0x0  0bpp  0.000 fps    0.0 kbps ( 0.0 kbyte/s)
FPS not specified in the header or invalid, use the -fps option.
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
[vdpau] Error when calling vdp_device_create_x11: 1
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Audio: no sound
Starting playback...
V:   0.0   0/  0 ??% ??% ??,?% 0 0                                    


Exiting... (End of file)

嘗試2:失敗

$ mplayer mms://192.168.1.10:554
MPlayer SVN-r33251-4.6.0 (C) 2000-2011 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing mms://192.168.1.10:554.
STREAM_ASF, URL: mms://192.168.1.10:554
Connecting to server 192.168.1.10[192.168.1.10]: 554...

Connected
read error:: Resource temporarily unavailable
pre-header read failed
Connecting to server 192.168.1.10[192.168.1.10]: 554...

unknown ASF streaming type
Failed, exiting.
Connecting to server 192.168.1.10[192.168.1.10]: 554...

Cache size set to 320 KBytes
Cache fill:  0.00% (0 bytes)   nop_streaming_read error : Resource temporarily unavailable
Stream not seekable!
Cache fill:  0.00% (0 bytes)   nop_streaming_read error : Resource temporarily unavailable
Cache fill:  0.00% (0 bytes)   

Cache not filling, consider increasing -cache and/or -cache-min!
nop_streaming_read error : Resource temporarily unavailable
Cache not filling, consider increasing -cache and/or -cache-min!
nop_streaming_read error : Resource temporarily unavailable
Cache not filling, consider increasing -cache and/or -cache-min!
nop_streaming_read error : Resource temporarily unavailable
Cache not filling, consider increasing -cache and/or -cache-min!
nop_streaming_read error : Resource temporarily unavailable
Cache not filling, consider increasing -cache and/or -cache-min!
Invalid seek to negative position!


Exiting... (End of file)

試試mplayer,它通常是支持最廣泛格式的音影片播放器。

如果您有一個所謂的 RTSP 源,它實際上是一個 HTTP URL,請首先檢索 URL 的內容;這次你會得到一個只包含另一個 URL 的文件rtsp://(有時你會得到另一個你需要遵循的 HTTP URL)。在命令行上將 URL傳遞rtsp://給 mplayer。

那裡有伺服器(據我所知,還有硬體設備),它們rtsp://通過 HTTP 提供包含 URL 的文件,然後以MMS協議提供內容¹。這是為了與一些較舊的 Microsoft 播放器兼容(我的記憶模糊不清),但它打破了認為 RTSP 是 RTSP 而 MMS 是 MMS 的客戶端。如果您獲得的rtsp://URL 根本不起作用,請嘗試將方案替換為mms://.

¹與多媒體消息服務(又稱影片簡訊)無關。

我發現ffmpeg實用程序通常更可靠。嘗試:

$ ffplay 'rtsp://username:password@ip_address:port/url'

另請注意,IP 攝影機 RTSP 流經常需要使用者名和密碼

Foscam 兼容相機的預設值:88urlvideoMain, videoSub, 或audio.

更多詳細資訊可在ffmpeg 手冊中找到。有趣的是,ffmpeg 指令似乎不包含有關包含使用者名密碼欄位的文件,這些都是受支持的。

引用自:https://unix.stackexchange.com/questions/25368