

* just the most convenient way if av_malloc() is to be used */ * the image can be allocated by any means and av_image_alloc() is If (avcodec_open2(c, codec, NULL) format = c->pix_fmt * resolution must be a multiple of two */Ĭ->gop_size = 10 /* emit one intra frame every ten frames */Īv_opt_set(c->priv_data, "preset", "ultrafast", 0) Ret = avcodec_encode_video2(c, &pkt, frame, &got_output) print_array(buffers.start,buffers.length) If (-1 = xioctl(fd, VIDIOC_DQBUF, &buf))Īssert (buf.index format, frame->width, frame->height) If (-1 = read (fd, buffers.start, buffers.length)) Each four bytes is two Y's, a Cb and a Cr.Įach Y goes to one of the pixels, and the Cb and Cr belong to both pixels. * In this format each four bytes is two pixels. Static void YUV422toRGB888(int width, int height, unsigned char *src, unsigned char *dst) #define CLEAR(x) memset (&(x), 0, sizeof (x))Ĭonvert from YUV422 format to RGB888. The output is not getting encoded and I am getting raw video. The issue that I am facing is that even after using avpicture_fill and assigning every buffer separatelyįrame->data = buffers.start įrame->data = (buffers.start)+1 įrame->data = (buffers.start)+3


I am working on encoding a raw yuv stream coming directly from webcam, using v4l2.
