Revision 7b3ea550 ffmpeg.c

View differences:

ffmpeg.c
355 355
    AVCodecContext *codec = ost->st->codec;
356 356
    AVCodecContext *icodec = ist->st->codec;
357 357
    FFSinkContext ffsink_ctx = { .pix_fmt = codec->pix_fmt };
358
    AVRational sample_aspect_ratio;
358 359
    char args[255];
359 360
    int ret;
360 361

  
361 362
    graph = avfilter_graph_alloc();
362 363

  
363
    snprintf(args, 255, "%d:%d:%d:%d:%d", ist->st->codec->width,
364
             ist->st->codec->height, ist->st->codec->pix_fmt, 1, AV_TIME_BASE);
364
    if (ist->st->sample_aspect_ratio.num){
365
        sample_aspect_ratio = ist->st->sample_aspect_ratio;
366
    }else
367
        sample_aspect_ratio = ist->st->codec->sample_aspect_ratio;
368

  
369
    snprintf(args, 255, "%d:%d:%d:%d:%d:%d:%d", ist->st->codec->width,
370
             ist->st->codec->height, ist->st->codec->pix_fmt, 1, AV_TIME_BASE,
371
             sample_aspect_ratio.num, sample_aspect_ratio.den);
372

  
365 373
    ret = avfilter_graph_create_filter(&ist->input_video_filter, avfilter_get_by_name("buffer"),
366 374
                                       "src", args, NULL, graph);
367 375
    if (ret < 0)
......
415 423

  
416 424
    codec->width  = ist->output_video_filter->inputs[0]->w;
417 425
    codec->height = ist->output_video_filter->inputs[0]->h;
426
    codec->sample_aspect_ratio = ost->st->sample_aspect_ratio =
427
        ist->output_video_filter->inputs[0]->sample_aspect_ratio;
418 428

  
419 429
    return 0;
420 430
}
......
2845 2855
        ffmpeg_exit(1);
2846 2856
    }
2847 2857
    frame_aspect_ratio = ar;
2858

  
2859
    x = vfilters ? strlen(vfilters) : 0;
2860
    vfilters = av_realloc(vfilters, x+100);
2861
    snprintf(vfilters+x, x+100, "%csetdar=%f\n", x?',':' ', ar);
2848 2862
}
2849 2863

  
2850 2864
static int opt_metadata(const char *opt, const char *arg)

Also available in: Unified diff