Skip to content

Commit

Permalink
uses CBR
Browse files Browse the repository at this point in the history
  • Loading branch information
leandromoreira committed Jan 3, 2020
1 parent 8ed2c1f commit b5378f3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion 3_transcoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,20 @@ int prepare_encoder(StreamingContext *sc, AVCodecContext *decoder_ctx, AVRationa
if (!sc->video_avcc) {logging("could not allocated memory for codec context"); return -1;}

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

sc->video_avcc->height = decoder_ctx->height;
sc->video_avcc->width = decoder_ctx->width;
if (sc->video_avc->pix_fmts)
sc->video_avcc->pix_fmt = sc->video_avc->pix_fmts[0];
else
sc->video_avcc->pix_fmt = decoder_ctx->pix_fmt;

sc->video_avcc->bit_rate = 2 * 1000 * 1000;
sc->video_avcc->rc_buffer_size = 4 * 1000 * 1000;
sc->video_avcc->rc_max_rate = 2 * 1000 * 1000;
sc->video_avcc->rc_min_rate = 2.5 * 1000 * 1000;

sc->video_avcc->time_base = av_inv_q(input_framerate);
sc->video_avs->time_base = sc->video_avcc->time_base;

Expand Down

0 comments on commit b5378f3

Please sign in to comment.