[Libav-user] MPEG-2 video encoding with ffmpeg API: bigger filesize than ffmpeg.exe
michi_1111 at yahoo.de
michi_1111 at yahoo.de
Wed Jun 22 09:15:23 CEST 2011
Hi all,
I am trying to encode a video from raw YUV to MPEG-2 using the ffmpeg API.
My problem is that the API-generated file is approx. 1.7 times bigger than the
equivalent files generated by ffmpeg itself.
I use the quantization parameter (via qmin and qmax) instead of the bitrate.
The API-version is basically:
//...
pCodecCtx->pix_fmt = PIX_FMT_YUV420P;
pCodecCtx->qmin = 3;
pCodecCtx->qmax = 3;
pCodecCtx->time_base.num = 1;
pCodecCtx->time_base.den = 30;
avcodec_open(pCodecCtx, avcodec_find_encoder(CODEC_ID_MPEG2VIDEO));
//...
while(/*...*/) {
avcodec_encode_video(pCodecCtx, pOutbuf, outbufSize, pPicture);
//..
}
//...
For ffmpeg.exe itself, I use the command:
ffmpeg -s 352x288 -r 30 -i foreman_352x288.yuv -f mpeg2video -vcodec
mpeg2video -r 30 -pix_fmt yuv420p -qmin 3 -qmax 3 foreman.m2v
Why does the API-generate file achieve a bitrate of 5212 kb/s and the file
generated by ffmpeg for the same qp a bitrate of 3047 kb/s??
(Even more puzzling is that the smaller ffmpeg version has a slightly higher
PSNR, 40.49 dB vs. 40.02 dB).
Are there any other relevant parameters that I missed? Does the ffmpeg actually
respect the quantization parameter?
Thanks for any advice,
MyKey_
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20110622/8aeff019/attachment.html>
More information about the Libav-user
mailing list