반응형

Onvif Rtsp Server를 사용하여 동영상 파일을 RTSP 스트리밍하는 방법을 다루고 있습니다. 



2022. 11. 17  최초작성 





1. 아래 링크에서 Onvif Rtsp Server for Windows X64를 다운로드 합니다. 

https://www.happytimesoft.com/download.html



2. 압축을 풀은 후, 원하는 동영상 파일을 폴더에 복사해줍니다. 



3. OnvifRtspServer.exe를 실행합니다. 

 

명령 프롬프트 창이 뜨면서 다음처럼 사용 가능한 RTSP 주소를 보여줍니다.

여기에선 동영상 파일을 사용할 것이기 때문에 아래 표시된 주소를 다음처럼 수정해주면 됩니다.

 

rtsp://192.168.25.16/<filename>

 

rtsp://admin:admin@192.168.25.16/1.mp4

 

admin:admin@는 접근 권한때문에 추가해준 것이고 1.mp4는 폴더에 추가했던 동영상 파일 이름입니다.

유튜브에서 영상을 다운로드했다면 인코딩을 다시 해줘야 스트리밍이 가능할 수도 있습니다. 

 

Happytime onvif server version V9.8
Onvif server running at http://192.168.25.16:8000
Happytime rtsp server V6.4
Play streams from this server using the URL:
        rtsp://192.168.25.16/<filename>
where <filename> is a file present in the current directory.
        rtsp://192.168.25.16/screenlive
stream from live screen.
        rtsp://192.168.25.16/videodevice
stream from camera device.
        rtsp://192.168.25.16/audiodevice
stream from audio device.
        rtsp://192.168.25.16/screenlive+audiodevice
stream from live screen and audio device
        rtsp://192.168.25.16/videodevice+audiodevice
stream from camera device and audio device.
        rtsp://192.168.25.16/window=[window title]
stream from application window.

See the log file onvifrtspserver.log for additional information.



4. 아래 링크에 있는 OpenCV 코드를 사용하여 테스트를 해볼 수 있습니다.

 

OpenCV Python – fps 출력하는 Webcam/Video File 기본 예제 코드

https://webnautes.tistory.com/1901 

 

fps 표시 및 동영상 파일 저장하며 webcam 영상 보여주는 OpenCV C++ 예제 코드

https://webnautes.tistory.com/1920 



0으로 된 부분을 RTSP 주소로 변경해주면 됩니다.

 

Python

cap = cv2.VideoCapture(0)

 

C++

cv::VideoCapture cap(0);



cap1 = cv::VideoCapture cap('rtsp://admin:admin@192.168.25.16/1.mp4');



무료버전에서는 동시에 동영상 파일 4개를 스트리밍 할 수 있습니다. 

간혹 스트리밍된 동영상이 뭉개지는 현상이 발생할 수도 있습니다. 



반응형

문제 발생시 지나치지 마시고 댓글 남겨주시면 가능한 빨리 답장드립니다.

도움이 되셨다면 토스아이디로 후원해주세요.
https://toss.me/momo2024


제가 쓴 책도 한번 검토해보세요 ^^

+ Recent posts