UVC camera video recording and encoding implementation
-
Hi, I am currently trying to implement video recording of UVC camera. My initial approach was to use OMX in the voxl-uvc-server to try to encode the NV12 raw frames to h264/h265 and then pass them to a modal pipe so that I could have voxl-mavcam-manager read from the encoded pipe and save the frames to a file. I was looking at how the voxl-camera-server was using OMX and HAL3 library to do the encoding but it seems pretty complex. As an alternative I was also considering using ffmpeg to do the encoding since its a simpler more high-level library but I am worried that ffmpeg won't be able to do hardware acceleration. I was wondering if any of the developers could give me some pointers or point me to any documentation resources to help me with the implementation.
Thanks.
-
@AndriiHlyvko You can look at voxl-streamer. That is based on GStreamer. You could modify that to save video to a file. https://gitlab.com/voxl-public/voxl-sdk/services/voxl-streamer
-
Just to add, the voxl-streamer (gstreamer) does use the OMX API for the hardware encoder under the hood, so the only extra overhead you will see is from sending YUVs over MPA (encoding should be very fast and efficient).
If resolution is 1080p or smaller, you should not see a large performance hit from sending YUVs over MPA. Sending 4K YUV frames over MPA (from uvc server to voxl-streamer) would consume significant resources (cpu), but would still work (you could try it).
Alex
-
@Eric-Katzfey @Alex-Kushleyev not exactly what I was looking for. I already implemented it using ffmpeg library. Basically I wanted to use voxl-send-command utility to send start/stop recording commands while also have the ability to save snapshots. I didn't like the idea of using gstreamer pipes for implementing this so I chose ffmpeg. I think my solution is good enough for now. I am able to start/stop recordings do snapshots and embed xmp metadata into the snapshots. Although I might come back to using OMX library if I decide I need the hardware encoding.