Summary of MPEG's Technical Summary Report Summation Report SUN Gang, 2003-11-21
1. Overview FFMPEG is an excellent LGPL-based video / audio converter. There are already many multimedia applications that use it as an encoder, such as Xine, MPlayer, Xbox Media Player, et al. It can also be used for video / The audio source to capture the data saved as a video audio file. The inffmpeg can also start switching from various sampling rates, and can achieve an enlargement reduction and frequency domain transformation through high-quality multi-phase filtering techniques. Here, we use Ffmpeg mpeg encoding process to achieve a second video capture cameras call instructions (i.e., the image acquired using Video4Linux API call specification) #include
1. Open the device int dev = open ("/ dev / video0", o_rdwr);
2. Get relevant parameters ioctl (dev, vidioccap, & vid_caps); IOCTL (dev, vidiocwin, & vid_win); ioctl (dev, vidiocgpict, & vid_pic);
// Check to see if we can use mmapif (0 == ioctl (dev, vidiocmbuf, & mbuf) ...
// Check to see if this Camera Uses MJPEGIF (VID_CAPS.TYPE & VID_TYPE_MJPEG_ENCODER) ...
3. Set related parameters ioctl (dev, vidiocspict, & vid_pic); ioctl (dev, vidiocswin, & vid_win);
4. Get image data read (dev, picbuff, size); // to this, the image data is stored in Picbuff. QRecord encoded interface description (encoded as MPEG1 System Format, where the video adopts MPEG1VIDEO, audio adoption MP2) defined as follows class QRecord {public: // encode mpeg1 file with ffmpeg library static int audio_input_frame_size; static AVOutputFormat * fmt; static AVFormatContext * oc; static AVStream * audio_st, * video_st; static int Open (const char * filename, int width, int height, INT FRAME_RATE, BOOL AUDIO_ON = false; static int addVideoFrame (uint8_t * y, uint8_t * u, uint8_t * v); static int address; static int close ();
// for decompress Jpeg static int DecompressJpeg (const char * input, unsigned char * rgbbuffer); // for rgb2yuv convert static int count; static float RGBYUV02990 [256], RGBYUV05870 [256], RGBYUV01140 [256]; static float RGBYUV01684 [ 256], RGBYUV03316 [256]; static float RGBYUV04187 [256], RGBYUV00813 [256]; static void InitRGB2YUVLookupTable (); static int RGB2YUV (int x_dim, int y_dim, void * bmp, void * y_out, void * u_out, void * v_out, int flip); static int address_to_rgbbuffer (unsigned char * linebuffer, int length);}; Several important interface functions, QRecord :: open () opens to store files, and initialize each parameter QRecord :: addVideoFrame () Add a frame of video data, format YUV420P, QRecord :: addAudioFrame () Add a frame of audio data, 44.1kHz, 16bits, 2Channels PCM DataQrecord :: Close () Close the file, release memory, etc. Four The code speed test report test data is 25 sheets of 320x240, RGB24 image file, and the respective required time of encoding 1000 frames is as follows: VIA Cyrix 1G, 96M RAM is 39-42 second Intel PIII-M 800M, 128M RAM is 6 second Intel PIII 550M, 128M RAM is 10 seconds.