RTSP服務端轉發服務(live555庫中的testH264VideoStreamer.cpp和testOnDemandRTSPServer.cpp實例)


1、h264文件的推送

testH264VideoStreamer.cpp文件的開頭就定義了

char const* inputFileName = "test.264";

后面接着創建了會話

ServerMediaSession* sms
    = ServerMediaSession::createNew(*env, "testStream", inputFileName,
     "Session streamed by \"testH264VideoStreamer\"",
        True /*SSM*/);

也就是將test.264文件,取出一幀一幀的數據並推送到rtsp://host_ip:port/testStream

本實例運行如下

 

2、實時碼流的推送

實時流的推送只需要將如上h264文件的定義改成一個fifo

mkfifo /tmp/test.264

char const* inputFileName = "/tmp/test.264";


然后將camera采集的數據編碼成h264的格式存到這個緩存,testH264VideoStreamer就可以將緩存的h264視頻數據推送出去.

例如像樹梅派將camera數據編碼到test.264緩存.

raspivid -o /tmp/test.264 -t 0 -d

這里就不拿板子出來運行了,這里http://www.cnblogs.com/dong1/p/5095739.html,有個testOnDemandRTSPServer實例,

跟testH264VideoStreamer一樣的功能.

 

3、live555\testProgs里還有個testOnDemandRTSPServer.cpp 實例

參考

https://blog.csdn.net/firehood_/article/details/16844397

https://blog.csdn.net/caoshangpa/article/details/53200527

記得修改makefile

MEDIA_SERVER_OBJS = live555MediaServer.$(OBJ) DynamicRTSPServer.$(OBJ) WW_H264VideoSource.$(OBJ) WW_H264VideoServerMediaSubsession.$(OBJ)
live555MediaServer.$(CPP): DynamicRTSPServer.hh version.hh WW_H264VideoSource.hh WW_H264VideoServerMediaSubsession.hh
DynamicRTSPServer.$(CPP): DynamicRTSPServer.hh

 

MEDIA_SERVER_OBJS = live555MediaServer.$(OBJ) DynamicRTSPServer.$(OBJ) h264LiveFramedSource.$(OBJ) h264LiveVideoServerMediaSubssion.$(OBJ)
live555MediaServer.$(CPP): DynamicRTSPServer.hh version.hh h264LiveVideoServerMediaSubssion.hh h264LiveFramedSource.hh
DynamicRTSPServer.$(CPP): DynamicRTSPServer.hh


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM