From 33ff943f70f04035942a68c725f6cf3426df0677 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 8 May 2013 23:43:19 +0200 Subject: ffmpeg: add -apad option which injects a apad filter only in the presence of video streams Signed-off-by: Michael Niedermayer --- ffmpeg_filter.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ffmpeg_filter.c') diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c index 58581c20d7..4b5c6768af 100644 --- a/ffmpeg_filter.c +++ b/ffmpeg_filter.c @@ -424,6 +424,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, OutputStream *ost = ofilter->ost; AVCodecContext *codec = ost->st->codec; AVFilterContext *last_filter = out->filter_ctx; + OutputFile *of = output_files[ost->file_index]; int pad_idx = out->pad_idx; char *sample_fmts, *sample_rates, *channel_layouts; char name[255]; @@ -519,6 +520,20 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, AUTO_INSERT_FILTER("-vol", "volume", args); } + if (ost->apad && of->shortest) { + char args[256]; + int i; + + for (i=0; ictx->nb_streams; i++) + if (of->ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) + break; + + if (ictx->nb_streams) { + snprintf(args, sizeof(args), "%s", ost->apad); + AUTO_INSERT_FILTER("-apad", "apad", args); + } + } + ret = insert_trim(ost, &last_filter, &pad_idx); if (ret < 0) return ret; -- cgit v1.2.1