[Libav-user] Changing bit rate while encoding produces a short skip in the video
blood_elves88 at yahoo.com.sg
Thu Mar 30 11:00:28 EEST 2017
Following the encode_video.c example on github
I have managed to change the bit rate of the encoded video in the
However, I have noticed that the video has a short lag or skip when the
bit rate is changed. Is this behavior expected? I am doing real-time
live streaming and having this short skip is undesirable.
More details on how I changed bit rate on the fly:
In the encoding loop, I basically called "avcodec_free_context(&c);",
followed by "c = avcodec_alloc_context3(codec);", setting the other
parameters (e.g. c->bit_rate, c->width, etc.), and then
"avcodec_open2(c, codec, NULL)". In short, I called line 66 to 98 in
encode_video.c once during the encoding loop (line 122 onwards) to
change the bit rate.
Did I do it correctly? Perhaps I did something unnecessary which
introduced the skip in the video.
Thanks for the help.
More information about the Libav-user