linuxvideovideo-streamingvideo-capturevideo4linux

Does a video have to be encoded before output on screen?


I've got a task to show video in console mode without X11, captured from a USB camera. I'm totally new to the video capturing/encoding/decoding stuff. I figured out that USB cameras supporting Video4linux can capture video in YUV 4:2:2 format. As far as I understood this is the uncompressed format. So, I'm wondering if I have to compress this video to show it on screen or not?

PS I've got the Odroid XU4 dev board with Mali t628 GPU if it can help somehow..


Solution

  • Your understanding is not correct. USB cameras will give image data in whatever format their firmware damn well pleases, in whatever binary stream the developers might have thought of. It's the job of camera drivers to convert that binary data into something that V4L understands, which can be YUV 4:2:2, but not necessarily so.

    Now, what "you can show on screen" is the inverse of that: Graphic cards take various image formats, and it's up to the driver to define these formats, and offer an API to X11 and applications trying to display stuff.

    What kind of formats directly are supported by the display driver depends on the device and the driver. For embedded GPUs, it's sometimes even possible to say "hey, here's an MPEG2 stream, display that in this and that rectangle", and let the silicon do the decoding, rendering and displaying. However, usually, you'd just get a frame that you want your video displayed in, and write the pixels that should be displayed by software.

    Now, usually computer graphics are RGB-based, but many drivers/GPUs support a few YUV formats, too. For historical reasons, there's also numerous different interfaces with which an application might draw onto a buffer -- be it classical X11 buffers, DRI, opengl-accelerated acces, opengl texture access, XVideo, vendor-specific extensions (VDPAU etc), or, and that's kind of typical for embedded devices, simply a memory range mapping to the display which can be selectively blitted onto screen.