[Libav-user] avcodec_encode_video2

Steffen.Roeber at hella.com Steffen.Roeber at hella.com
Mon Jul 23 08:18:29 CEST 2012

Hi, tried using the avcodec_encode_video2 function. my problem is thhat if 
I call this function once per frame, the video has a small bitrate and 
looks bad.
If I call this function twice
    AVCodecContext *c;...
    c->me_method = ME_EPZS;
    c->width = img->getWidth();
    c->height = img->getHeight();
    c->time_base.num = 1;
    c->time_base.den = 25;
    c->gop_size = 10;
    c->max_b_frames = 1;
    c->pix_fmt = PIX_FMT_YUV420P;
    c->rc_max_rate = 750000;
    c->rc_buffer_size = 3000000;
    c->refs = 1;
    c->coder_type = FF_CODER_TYPE_VLC;

  avcodec_encode_video2(c, &avpkt, picture, &outbufMaxSize); 
//outbufMaxSize == 0
  avcodec_encode_video2(c, &avpkt, nullptr, &outbufMaxSize); //
outbufMaxSize == 1

then the video looks as expected. What goes wrong?

Hella Aglaia Mobile Vision GmbH
Steffen Roeber
Firmware & Tools
Treskowstr. 14, D-13089 Berlin
Amtsgericht Berlin-Charlottenburg HRB 66976 B
Geschäftsführer: Kay Talmi

Fon:  +49 30 200 04 29– 412
Fax:  +49 30 200 04 29– 109
Mail: Steffen.Roeber at hella.com
URL: www.aglaia-gmbh.de

URL: www.mobilevision.de

Dieses Dokument ist vertraulich zu behandeln. Die Weitergabe sowie 
Vervielfältigung, Verwertung und Mitteilung seines Inhalts ist nur mit 
unserer ausdrücklichen Genehmigung gestattet. Alle Rechte vorbehalten, 
insbesondere für den Fall der Schutzrechtsanmeldung.
This document has to be treated confidentially. Its contents are not to be 
passed on, duplicated, exploited or disclosed without our express 
permission. All rights reserved, especially the right to apply for 
protective rights.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120723/36ee8aee/attachment.html>

More information about the Libav-user mailing list