We now see the video, from the camera data collection to the last display frequency display, the preliminary induction through the following several links: Camera capture image data, compression image data, compressed image data encapsulated into a video format. Video format file--Remove Video format package---uncompressed image data--Displays an image of the display with the data of a frame image.
This is only a collection of camera data and some operations to compress the collected data into a video stream.
Camera output three types of data: Yuv,rgb,jpeg. YUV is the data format required for most video encoding, such as the X264 Encoder encoded H264 video format, which requires independent separation of data on the Y,u,v three components. RGB data can be sent directly to the display display, through R (Red), G (green), B (blue), three colors can be combined into a variety of other colors. The display finally displays the colors in RGB data format. JPEG is a compressed image format, in order to reduce the amount of data, in some cameras inside it can be compressed image, a frame of JPEG data directly saved as a file is a JPG image, a series of JPEG images to follow the storage is the MJPEG format of the video format. High MJPEG encoding compared to x264 encoding, but large data volume (low compression rate and low distortion rate)
Three types of data:
camera output YUV data
There are many kinds of YUV data, such as yuv420,yuv422,yuv422p and so on, for some video encoding, it can only input YUV data. For example, X264 Encoder encoding h264 video format data, it needs to input y,u,v three components of the specific data. The YUV data of a frame image cannot be viewed as a picture, and a special YUV viewing software is required to view it, such as PYUV. YUV data specific definitions on-line there is a lot of information is not introduced here, the following is the specific use of YUV data.
V4l2 video capture and H264 encoding-v4l2 capture YUV data
V4l2 video capture and H264 encoding-x264 encoding H264 video
V4L2 acquisition YUYV Data-x264 encoding H264 video Instance
camera output RGB data
RGB data is the original color data collected by the camera, which is mainly provided to the image processor for image processing of the ISP effect, there is time to study later.
camera output JPEG data
JPEG data is a compression process in the camera sensor once the image data has been captured by the camera. Saves a frame of JPEG data from the camera output to a file, which is a picture. The collected data can be directly packaged into a video format, which can be played directly using a video player. Compared with h264 encoding, h264 Although the compressed data Billy is very large, but its image distortion is more obvious. Use MJPEG encapsulated video for high definition but large data volumes.
V4l2 video capture and H264 encoding-V4L2 capturing JPEG data
Application examples of MJPEG data using Avilib encapsulation
Data Format Conversion
In the actual use of the process, due to the limitations of the device, some cameras may only support JPEG format output, some cameras may only support YUV422 format output, here will involve a conversion of data data format. If it is on a PC or mobile phone, this is very good processing, directly installed ffmpeg can solve the problem, because FFmpeg provides and a lot of interfaces that can be used. However, in the embedded device, may not install ffmpeg, then you need to design the program for the conversion of data format.
Application example of JPEG data transfer YUV data
YUV422 Conversion YUV420 Application Example
Device porting
Finally provide an example of a device migration
V4l2 video capture and H264 coding-x264 porting