Skip to content

Commit b5378f3

Browse files
uses CBR
1 parent 8ed2c1f commit b5378f3

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

3_transcoding.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,20 @@ int prepare_encoder(StreamingContext *sc, AVCodecContext *decoder_ctx, AVRationa
8181
if (!sc->video_avcc) {logging("could not allocated memory for codec context"); return -1;}
8282

8383
av_opt_set(sc->video_avcc->priv_data, "preset", "slow", 0);
84-
av_opt_set(sc->video_avcc->priv_data, "x264opts", "keyint=60:min-keyint=60:scenecut=-1", 0);
84+
av_opt_set(sc->video_avcc->priv_data, "x264opts", "keyint=60:min-keyint=60:scenecut=-1:force-cfr=1", 0);
8585

8686
sc->video_avcc->height = decoder_ctx->height;
8787
sc->video_avcc->width = decoder_ctx->width;
8888
if (sc->video_avc->pix_fmts)
8989
sc->video_avcc->pix_fmt = sc->video_avc->pix_fmts[0];
9090
else
9191
sc->video_avcc->pix_fmt = decoder_ctx->pix_fmt;
92+
93+
sc->video_avcc->bit_rate = 2 * 1000 * 1000;
94+
sc->video_avcc->rc_buffer_size = 4 * 1000 * 1000;
95+
sc->video_avcc->rc_max_rate = 2 * 1000 * 1000;
96+
sc->video_avcc->rc_min_rate = 2.5 * 1000 * 1000;
97+
9298
sc->video_avcc->time_base = av_inv_q(input_framerate);
9399
sc->video_avs->time_base = sc->video_avcc->time_base;
94100

0 commit comments

Comments
 (0)