[FFmpeg-devel] [PATCH 5/7] ffmpeg: add frame rate to the buffersrc arguments.
Nicolas George
nicolas.george at normalesup.org
Tue Jun 5 13:23:05 CEST 2012
The arguments now use the key=value syntax.
Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
ffmpeg.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/ffmpeg.c b/ffmpeg.c
index a897c9e..c761f71 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1137,21 +1137,28 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
AVRational tb = ist->framerate.num ? (AVRational){ist->framerate.den,
ist->framerate.num} :
ist->st->time_base;
+ AVRational fr = ist->framerate.num ? ist->framerate :
+ ist->st->r_frame_rate;
AVRational sar;
- char args[255];
+ AVBPrint args;
int pad_idx = in->pad_idx;
int ret;
sar = ist->st->sample_aspect_ratio.num ?
ist->st->sample_aspect_ratio :
ist->st->codec->sample_aspect_ratio;
- snprintf(args, sizeof(args), "%d:%d:%d:%d:%d:%d:%d:flags=%d", ist->st->codec->width,
+ av_bprint_init(&args, 0, 1);
+ av_bprintf(&args,
+ "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:"
+ "pixel_aspect=%d/%d:sws_param=flags=%d", ist->st->codec->width,
ist->st->codec->height, ist->st->codec->pix_fmt,
tb.num, tb.den, sar.num, sar.den,
SWS_BILINEAR + ((ist->st->codec->flags&CODEC_FLAG_BITEXACT) ? SWS_BITEXACT:0));
+ if (fr.num && fr.den)
+ av_bprintf(&args, ":frame_rate=%d/%d", fr.num, fr.den);
if ((ret = avfilter_graph_create_filter(&ifilter->filter, filter, in->name,
- args, NULL, fg->graph)) < 0)
+ args.str, NULL, fg->graph)) < 0)
return ret;
if (ist->framerate.num) {
--
1.7.10
More information about the ffmpeg-devel
mailing list