1

I have setup a RTSP monitor with a Raspberry Pi 3, using this tutorial:

https://community.ubnt.com/t5/UniFi-Video/Tutorial-RTSP-Raspberry-Pi-B-Viewer-6-Cam-4-Cam/td-p/1536448

TLDR: it uses the screen command together with omxplayer to overlay, on the console, the RTSP streams from multiple IP cameras, in different areas of the monitor, pretty much like a quad mixer does with analog cameras inputs.

Now, without having to access the RTSP streams twice each (one to display it realtime, another to record it), I want to also have a recording made on the 128GB SD I'm using, and with practicality in mind I'd like to just record whatever is displaying on screen and sent to the HDMI monitor connected to the Rasberry Pi 3 (which is, the combined grid-view of the multiple streams that I can see on screen).

Now, the environment is console only, and x11grab is not an appropriate source, so I went with the framebuffer input, fbdev, and specifically the /dev/fb0 device, which targets the "raw" video output. So, to test it, I ran:

sudo ffmpeg -f fbdev -framerate 1 -i /dev/fb0 -frames:v 1 screenshot.jpeg

in order to get a screenshot and check whether the overlayed streams were displayed... but naturally they weren't (I just see a shot of the text console screen that appears right after boot, and soon after gets covered by the RTSP streams), and not because I see any apparent reason why they shouldn't, but just because it would have been too easy otherwise.

Now, since I cannnot use the framebuffer itself to capture "whatever is being sent to video", what else is left?

It could be a viable alternative to have ffmpeg directly access the RTSP streams, and "duplicate" them, one to be used as source by omxplayer, and the other to be recorded on the SD... even if it is in my opinion needlessly complicated, and defeats the practical aim I have, which is recording all the streams together in a grid view just like they are shown on the monitor.

2 Answers 2

1

UV4L offers a driver named "raspidisp" that captures the screen and offers a /dev/video device for use with ffmpeg or avconv.

1
  • Hence I should install this driver and point ffmpeg to a localhost service for recording, ingenious!
    – ephestione
    Commented Jul 22, 2018 at 8:04
0

For now, not exactly what I was looking for, but I found this screenshot tool that will capture in a JPEG file exactly what's being sent to HDMI output (there is also a PNG variant), and I've set that to run every second with watch together with this bash script to be run every minute on cron to remove oldest screenshots when SD is almost full (note there's an error in that script, where find type f should really be find -type f). I'd still prefer video recording though...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.