Skip to content

Commit 8ed2c1f

Browse files
fix variable framerate
1 parent a527920 commit 8ed2c1f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

3_transcoding.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ int prepare_encoder(StreamingContext *sc, AVCodecContext *decoder_ctx, AVRationa
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-
sc->video_avcc->time_base = input_framerate;
93-
sc->video_avs->time_base = input_framerate;
92+
sc->video_avcc->time_base = av_inv_q(input_framerate);
93+
sc->video_avs->time_base = sc->video_avcc->time_base;
9494

9595
if (avcodec_open2(sc->video_avcc, sc->video_avc, NULL) < 0) {logging("could not open the codec"); return -1;}
9696
avcodec_parameters_from_context(sc->video_avs->codecpar, sc->video_avcc);

0 commit comments

Comments
 (0)