How to stream rawvideo via RTSP? (Or, how to transcode rawvideo to H264?)
Posted: 12 Jun 2019 15:08
Hello! I'm trying to stream images from OpenCV to RTSP. The solution I'm working on right now creates the frames, then writes them to a fifo. VLC reads from the fifo, converts it from rawvid, and streams using `sout`. Here's the command:
When `output` is `#display`, it works and I can see it. However, if I'm trying to stream to RTSP, nothing appears on the other end.
Playing video files, as well as RTSP streams, allows me to stream to RTSP without a target. But going through OpenCV forces rawvideo. I tried different transcoding strings, but none of them worked. Some examples:
No video transcoding:
With video transcoding:
Does anyone have any suggestions?
Also, I tried using `python-vlc` instead of using `subprocess`, but I wasn't sure where to start. [url=https://www.olivieraubert.net/vlc/python-ctypes/doc/]The API[/url] is huge. Does anyone have resources or examples, I might be able to use it more effectively.
Thanks!
Code: Select all
cvlc --demux=rawvid --rawvid-width={width:.0f} --rawvid-height={height:.0f} --rawvid-fps={fps:.1f} --rawvid-chroma=RV24 {path_in} --sout-keep --no-sout-all --sout {output!r}
Playing video files, as well as RTSP streams, allows me to stream to RTSP without a target. But going through OpenCV forces rawvideo. I tried different transcoding strings, but none of them worked. Some examples:
No video transcoding:
Code: Select all
[00007f350c000e80] main stream output error: stream chain failed for `transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:#display'
[00007f3514000c40] main input error: cannot start stream output instance, aborting
Code: Select all
[00007f149c000e60] main stream output error: stream chain failed for `transcode{vcodec=h264,width=640,height=480,fps=30,vcodec=rawvideo}:#display'
[00007f14a4000c40] main input error: cannot start stream output instance, aborting
Also, I tried using `python-vlc` instead of using `subprocess`, but I wasn't sure where to start. [url=https://www.olivieraubert.net/vlc/python-ctypes/doc/]The API[/url] is huge. Does anyone have resources or examples, I might be able to use it more effectively.
Thanks!