[Libav-user] encoding h264
Edimartin
edimartin at gmail.com
Mon Feb 17 17:24:00 CET 2014
You can encode a frame with x264
(http://www.videolan.org/developers/x264.html) folowing this example
(https://github.com/hiccupzhu/x264-example/blob/master/yuv2h264/yuv2h264.c).
The encoder receive a YV12 image (not RGB) with is 50% the size of a RGB
image (width*height*1.5). You will write the frame in the lines:
memcpy(pic_in.img.plane[0], data, widthXheight);
memcpy(pic_in.img.plane[1], data + widthXheight, widthXheight >> 2);
memcpy(pic_in.img.plane[2], data + widthXheight + (widthXheight >> 2),
widthXheight >> 2);
The plane[0] receive a image width*height. The plane[1] and [2] receive 1/4
the size of the Y.
You get the encoded frame in "nal[0].p_payload" and "i_frame_size".
--
View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-encoding-h264-tp4658906p4659276.html
Sent from the libav-users mailing list archive at Nabble.com.
More information about the Libav-user
mailing list