Michel Bardiaux wrote:
Cool_Zer0 wrote:
Hi there,
I'm facing a low quality
Define 'low quality' (or is my guess below right?)
encoding and I don't know why... So...
I have the original frames on BGR24... I want to compress them to send via RTP... I do the following:
void video_encode(unsigned char* frame_rgb, int frame_rgb_size, unsigned char* enc_frame, int buf_size, int &enc_frame_size) { int hr; /* Feed uncompressed_frame with the raw RGB data */ AVPicture uncompressed_frame; uncompressed_frame.data[0] = frame_rgb; uncompressed_frame.data[1] = uncompressed_frame.data[2] = 0x00; uncompressed_frame.linesize[0] = 176*3; uncompressed_frame.linesize[1] = uncompressed_frame.linesize[2] = 0;
/* Convert from RGB24 to YUV420P */ hr = img_convert((AVPicture*)yuv420_frame, PIX_FMT_YUV420P, &uncompressed_frame, PIX_FMT_BGR24, 176, 144);
/* Encode the YUV420P frame to H.263 */ hr = avcodec_encode_video(enc_context, enc_frame, buf_size, yuv420_frame); if (hr>0) { enc_frame_size = hr; } else { enc_frame_size = -1; }
}
Quality depends on what you put in enc_context. If you keep the defaults, that will be 200kbits, which by my seat-of-the-pants-o-meter should be roughly equivalent to a 400kbits MPEG1, ie a little worse than long-play VCR.
I have always found it useful to tune codec parameters in a file-to-file encoding using the ffmpeg command line.
Hi. I'll take that suggestion :) Tell me something... I have my frames on a BMP format... Can I create a video with the bitmap sequence using ffmpeg? So that I can adjust the quality? Thanks