简体   繁体   中英

FFMPEG: Dynamic change of bit_rate for Video

I use ffmpeg codes in my C++ app and would like to control the bit_rate parameter for VIDEO there. I tried to change its value in work (via ost->st->codec->codec->bit_rate), but ffmpeg did not wish to change it. Perhaps anybody knows how to make it?

Any ideas?

I have tried like this and its working for me.

     avcodec_init();

     avcodec_register_all();

     codec = avcodec_find_encoder(CODEC_ID_H263);

     c = avcodec_alloc_context();

     picture= avcodec_alloc_frame();

        c->bit_rate = bitrate;
        c->width = w;
        c->height = h;
        c->time_base= (AVRational){1,framerate};
        c->pix_fmt = PIX_FMT_YUV420P;

avcodec_close(c);

av_free(c);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM