Revision 7a11c82f ffmpeg.c

View differences:

ffmpeg.c
344 344
    AVCodecContext *codec = ost->st->codec;
345 345
    AVCodecContext *icodec = ist->st->codec;
346 346
    FFSinkContext ffsink_ctx = { .pix_fmt = codec->pix_fmt };
347
    AVRational sample_aspect_ratio;
347 348
    char args[255];
348 349
    int ret;
349 350

  
350 351
    graph = avfilter_graph_alloc();
351 352

  
352
    snprintf(args, 255, "%d:%d:%d:%d:%d", ist->st->codec->width,
353
             ist->st->codec->height, ist->st->codec->pix_fmt, 1, AV_TIME_BASE);
353
    if (ist->st->sample_aspect_ratio.num){
354
        sample_aspect_ratio = ist->st->sample_aspect_ratio;
355
    }else
356
        sample_aspect_ratio = ist->st->codec->sample_aspect_ratio;
357

  
358
    snprintf(args, 255, "%d:%d:%d:%d:%d:%d:%d", ist->st->codec->width,
359
             ist->st->codec->height, ist->st->codec->pix_fmt, 1, AV_TIME_BASE,
360
             sample_aspect_ratio.num, sample_aspect_ratio.den);
361

  
354 362
    ret = avfilter_graph_create_filter(&ist->input_video_filter, avfilter_get_by_name("buffer"),
355 363
                                       "src", args, NULL, graph);
356 364
    if (ret < 0)
......
404 412

  
405 413
    codec->width  = ist->output_video_filter->inputs[0]->w;
406 414
    codec->height = ist->output_video_filter->inputs[0]->h;
415
    codec->sample_aspect_ratio = ost->st->sample_aspect_ratio =
416
        ist->output_video_filter->inputs[0]->sample_aspect_ratio;
407 417

  
408 418
    return 0;
409 419
}
......
2784 2794
        ffmpeg_exit(1);
2785 2795
    }
2786 2796
    frame_aspect_ratio = ar;
2797

  
2798
    x = vfilters ? strlen(vfilters) : 0;
2799
    vfilters = av_realloc(vfilters, x+100);
2800
    snprintf(vfilters+x, x+100, "%csetdar=%f\n", x?',':' ', ar);
2787 2801
}
2788 2802

  
2789 2803
static int opt_metadata(const char *opt, const char *arg)

Also available in: Unified diff