cvlc host synced MJPEG and RTSP streams from one MP4 file

About encoding, codec settings, muxers and filter usage
skpacman
New Cone
New Cone
Posts: 3
Joined: 22 Apr 2023 07:09

cvlc host synced MJPEG and RTSP streams from one MP4 file

Postby skpacman » 08 Oct 2024 20:30

I'm working on a test rig for a computer vision system and I need to take some pre-recorded footage from one of our on-site IP cameras and simulate the RTSP and MJPEG streams that the IP Camera would have produced with a Raspberry Pi (4 or 5, whichever one works better).

The source MP4 file is 720p Portrait, 30fps, Constant Bitrate (10kbps).
I need to duplicate then transcode each:
  • one to RTSP H.264 on Port 8554 at 30FPS and I/P frames every frame, 720p Portrait
  • the other to HTTP MJPEG with mimetypes or whatever needs to be set to be able to view it at 30fps in a browser or img tag in a webpage
I know, very specific requirements.

The below code runs perfectly fine on a AMD64 laptop running Ubuntu 18.04:

Code: Select all

cvlc --loop ./driver.mp4 --sout '#duplicate{dst="transcode{vcodec=h264,venc=x264{keyint=1,bframes=1,idrint=1},fps=30,scale=Auto,acodec=none,scodec=none}:rtp{sdp=rtsp://:8554/driver}",dst="transcode{vcodec=MJPG,fps=30,scale=Auto,acodec=none,scodec=none}:http{mux=mpjpeg,dst=:9000/driver.mpjpeg}"}' --no-sout-all --sout-keep --network-caching=1500

But, I keep getting the below error when I try to run it on any of the modern Raspberry Pi's (4B or 5):

Code: Select all

[0000007f880bdc50] avcodec encoder error: cannot open MJPG video encoder [0000007f880bdc50] main encoder error: Streaming / Transcoding failed [0000007f880bdc50] main encoder error: VLC could not open the MJPG video encoder. [0000007f784cf730] stream_out_transcode stream out error: cannot find video encoder (module:any fourcc:MJPG). Take a look few lines earlier to see possible reason.

I have tried uninstalling the standard VLC and replacing it with a version built from the github source code, tried to build from source using debuild, and installed just about every encoder codec library imaginable. I even read somewhere that there's not a MJPEG hardware encoder on the RPi5, so I spent yet another $80 to get a RPi4B just to have the exact same problem. Is MJPEG encoding just not an option at all on Raspberry Pi's?

I've been bashing my head against this for months trying to figure it out. Any help would be greatly appreciated.

Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 9 guests