[FFmpeg-devel] encoding/decoding h.264
Peter Wilkes
pwilkes
Thu Dec 13 18:23:16 CET 2007
hello,
i am trying to build a project using ffmpeg that will encode/decode h.
264 data.
we have an RGB24 image and we would like a decoded RGB24 image on the
ouput
i am trying to setup ffmpeg to do this for me and i am having
difficulty getting the parameters correct.
i know i need to do a RGB24->YUV420 conversion which i do using
sws_scale before encoding
i know i need to do a YUV420->RGB24 conversion which i do using
sws_scale after decoding.
i know that the sws_scale before the encode and after the decode work
because if i comment out the encode/decode the original image shows
(minus conversion differences)
for encoding i have set up the following parameters
encoder = avcodec_alloc_context();
encoder->bit_rate = 16 * 1000;
encoder->rc_max_rate = 16 * 1000;
encoder->width = 160;
encoder->height = 120;
encoder->time_base.num = 1;
encoder->time_base.den = 30;
encoder->gop_size = 10;
encoder->max_b_frames = 1;
encoder->pix_fmt = PIX_FMT_YUV420P;
my decoder settings are
decoder = avcodec_alloc_context();
decoder->width = 160;
decoder->height = 120;
decoder->pix_fmt = PIX_FMT_YUV420P;
i do get a picture out but it looks nothing like my original picture.
any assistance anyone can provide would very much be appreciated.
Peter Wilkes
More information about the ffmpeg-devel
mailing list