victor kulichkin
victor kulichkin

Reputation: 433

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?

Upvotes: 2

Views: 2182

Answers (1)

Nishant Rajput
Nishant Rajput

Reputation: 2063

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);

Upvotes: 1

Related Questions