Skip to content

Commit

Permalink
Fix time_base for video stream
Browse files Browse the repository at this point in the history
  • Loading branch information
bear101 committed Nov 2, 2024
1 parent 4734332 commit c59210e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Library/TeamTalkLib/avstream/FFmpegStreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ bool OpenInput(const ACE_TString& filename,
video_stream_index = av_find_best_stream(fmt_ctx, AVMEDIA_TYPE_VIDEO,
-1, -1, &vid_dec, 0);
if (video_stream_index >= 0) {
const AVCodecParameters* vidparms = fmt_ctx->streams[video_stream_index]->codecpar;
const AVStream* vidstream = fmt_ctx->streams[video_stream_index];
const AVCodecParameters* vidparms = vidstream->codecpar;
const AVCodec *vidcodec = avcodec_find_decoder(vidparms->codec_id);
if (vidcodec)
{
Expand Down Expand Up @@ -866,6 +867,7 @@ AVFilterGraph* createVideoFilterGraph(AVFormatContext *fmt_ctx,
const AVFilter *buffersink = avfilter_get_by_name("buffersink");
AVFilterInOut *outputs = avfilter_inout_alloc();
AVFilterInOut *inputs = avfilter_inout_alloc();
AVRational time_base = fmt_ctx->streams[video_stream_index]->time_base;
const enum AVPixelFormat pix_fmts[] = { output_pixfmt, AV_PIX_FMT_NONE };
char filters_descr[100];

Expand All @@ -878,7 +880,7 @@ AVFilterGraph* createVideoFilterGraph(AVFormatContext *fmt_ctx,
snprintf(args, sizeof(args),
"video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d",
vid_dec_ctx->width, vid_dec_ctx->height, vid_dec_ctx->pix_fmt,
vid_dec_ctx->time_base.num, vid_dec_ctx->time_base.den,
time_base.num, time_base.den,
vid_dec_ctx->sample_aspect_ratio.num, vid_dec_ctx->sample_aspect_ratio.den);

MYTRACE(ACE_TEXT("%s\n"), args);
Expand Down

0 comments on commit c59210e

Please sign in to comment.