[常用工具] live555的搭建

live555是一個爲流媒體提供解決方案的跨平臺的C++開源項目,它實現了對標準流媒體傳輸協議如RTP/RTCP、RTSP、SIP等的支持。使用live555可以播放rtsp流。本文主要是在linux下搭建使用live555搭建rtsp server,主要步驟如下:

  1. 下載源碼並編譯http://www.live555.com/liveMedia/public/live555-latest.tar.gz,linux命令行輸入如下代碼

    cdd /app
    wget  http://www.live555.com/liveMedia/public/live555-latest.tar.gz
    tar xzf live555-latest.tar.gz
    cd live
    ./genMakefiles linux-64bit    #注意後面這個參數是根據當前文件夾下config.<後綴>獲取得到的
    make #編譯
    
  2. 編譯完成後在當前目錄下生成mediaServer文件夾,進入該文件夾運行live555MediaServer文件。命令行代碼如下:

    cd mediaServer
    ./live555MediaServer
    

執行live555MediaServer文件後結果如下:

LIVE555 Media Server
	version 1.00 (LIVE555 Streaming Media library version 2020.04.24).
Play streams from this server using the URL
	rtsp://192.21.11.140/<filename>
where <filename> is a file present in the current directory.
Each file's type is inferred from its name suffix:
	".264" => a H.264 Video Elementary Stream file
	".265" => a H.265 Video Elementary Stream file
	".aac" => an AAC Audio (ADTS format) file
	".ac3" => an AC-3 Audio file
	".amr" => an AMR Audio file
	".dv" => a DV Video file
	".m4e" => a MPEG-4 Video Elementary Stream file
	".mkv" => a Matroska audio+video+(optional)subtitles file
	".mp3" => a MPEG-1 or 2 Audio file
	".mpg" => a MPEG-1 or 2 Program Stream (audio+video) file
	".ogg" or ".ogv" or ".opus" => an Ogg audio and/or video file
	".ts" => a MPEG Transport Stream file
		(a ".tsx" index file - if present - provides server 'trick play' support)
	".vob" => a VOB (MPEG-2 video with AC-3 audio) file
	".wav" => a WAV Audio file
	".webm" => a WebM audio(Vorbis)+video(VP8) file
See http://www.live555.com/mediaServer/ for additional documentation.
(We use port 8000 for optional RTSP-over-HTTP tunneling, or for HTTP live streaming (for indexed Transport Stream files only).)

結果中的rtsp://192.21.11.140/就是rtsp路徑。將1.264文件放入mediaServer/test文件夾下。在瀏覽器中調用rtsp://192.21.11.140/test/1.264便能夠遠程播放該視頻。
如果是編程調用該rtsp,則需要使用端口號也就是port 8000
此外如果要本機調用,可以使用下列方式編寫本地rtsp路徑

rtsp://127.0.0.1:554/1.264

  1. 關閉命令行後,live555MediaServer就會關閉。如果想關閉命令行後繼續運行,執行下述命令,在關閉命令行後服務會繼續運行。

nohup ./live555MediaServer &

文章備份
https://luohenyueji.gitee.io

參考

LIVE555學習1:Linux下live555的編譯及測試
使用live555 在linux下搭建 rtsp server

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章