--- doc/examples/transcode.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c index 81a88dd577..3c57fb36c9 100644 --- a/doc/examples/transcode.c +++ b/doc/examples/transcode.c @@ -82,6 +82,7 @@ static int open_input_file(const char *filename) AVStream *stream = ifmt_ctx->streams[i]; const AVCodec *dec = avcodec_find_decoder(stream->codecpar->codec_id); AVCodecContext *codec_ctx; + enum AVMediaType codec_type; if (!dec) { av_log(NULL, AV_LOG_ERROR, "Failed to find decoder for stream #%u\n", i); @@ -105,11 +106,13 @@ static int open_input_file(const char *filename) /* Inform the decoder about the timebase for the packet timestamps. * This is highly recommended, but not mandatory. */ codec_ctx->pkt_timebase = stream->time_base; + codec_type = codec_ctx->codec_type; /* Reencode video & audio and remux subtitles etc. */ - if (codec_ctx->codec_type == AVMEDIA_TYPE_VIDEO || codec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) { - if (codec_ctx->codec_type == AVMEDIA_TYPE_VIDEO) + if (codec_type == AVMEDIA_TYPE_VIDEO || codec_type == AVMEDIA_TYPE_AUDIO) { + if (codec_type == AVMEDIA_TYPE_VIDEO) codec_ctx->framerate = av_guess_frame_rate(ifmt_ctx, stream, NULL); + /* Open decoder */ ret = avcodec_open2(codec_ctx, dec, NULL); if (ret < 0) { -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".