Message ID | 20180318190909.31057-1-cus@passwd.hu |
---|---|
State | Superseded |
Headers | show |
On Sun, Mar 18, 2018 at 08:09:08PM +0100, Marton Balint wrote: > Fixes ticket #6854 and the following simpler case: > > ffmpeg -f lavfi -i testsrc=d=1 -f lavfi -i testsrc=d=0 -filter_complex overlay -f null none this could be usefull as a fate test [...]
On Sun, 18 Mar 2018 20:09:08 +0100 Marton Balint <cus@passwd.hu> wrote: > Fixes ticket #6854 and the following simpler case: > > ffmpeg -f lavfi -i testsrc=d=1 -f lavfi -i testsrc=d=0 -filter_complex overlay -f null none > > Signed-off-by: Marton Balint <cus@passwd.hu> > --- > fftools/ffmpeg.c | 33 ++++++++++++++++----------------- > 1 file changed, 16 insertions(+), 17 deletions(-) > > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c > index ee7258fcd1..8876c99560 100644 > --- a/fftools/ffmpeg.c > +++ b/fftools/ffmpeg.c > @@ -1855,23 +1855,6 @@ static void flush_encoders(void) > ost->file_index, ost->st->index); > > if (ost->filter && !fg->graph) { > - int x; > - for (x = 0; x < fg->nb_inputs; x++) { > - InputFilter *ifilter = fg->inputs[x]; > - if (ifilter->format < 0) { > - AVCodecParameters *par = ifilter->ist->st->codecpar; > - // We never got any input. Set a fake format, which will > - // come from libavformat. > - ifilter->format = par->format; > - ifilter->sample_rate = par->sample_rate; > - ifilter->channels = par->channels; > - ifilter->channel_layout = par->channel_layout; > - ifilter->width = par->width; > - ifilter->height = par->height; > - ifilter->sample_aspect_ratio = par->sample_aspect_ratio; > - } > - } > - > if (!ifilter_has_all_input_formats(fg)) > continue; > > @@ -2214,6 +2197,22 @@ static int ifilter_send_eof(InputFilter *ifilter, int64_t pts) > } else { > // the filtergraph was never configured > FilterGraph *fg = ifilter->graph; > + if (ifilter->format < 0) { > + AVCodecParameters *par = ifilter->ist->st->codecpar; > + // We never got any input. Set a fake format, which will > + // come from libavformat. > + ifilter->format = par->format; > + ifilter->sample_rate = par->sample_rate; > + ifilter->channels = par->channels; > + ifilter->channel_layout = par->channel_layout; > + ifilter->width = par->width; > + ifilter->height = par->height; > + ifilter->sample_aspect_ratio = par->sample_aspect_ratio; > + } > + if (ifilter->format < 0 && (ifilter->type == AVMEDIA_TYPE_AUDIO || ifilter->type == AVMEDIA_TYPE_VIDEO)) { > + av_log(NULL, AV_LOG_ERROR, "Cannot determine format of input %d, stream %d after EOF\n", ifilter->ist->file_index, ifilter->ist->st->index); > + return AVERROR_INVALIDDATA; > + } > for (i = 0; i < fg->nb_inputs; i++) > if (!fg->inputs[i]->eof) > break; Does it make sense to mux audio or video without packets? And why?
On Mon, 19 Mar 2018, wm4 wrote: > On Sun, 18 Mar 2018 20:09:08 +0100 > Marton Balint <cus@passwd.hu> wrote: > >> Fixes ticket #6854 and the following simpler case: >> >> ffmpeg -f lavfi -i testsrc=d=1 -f lavfi -i testsrc=d=0 -filter_complex overlay -f null none >> >> Signed-off-by: Marton Balint <cus@passwd.hu> >> --- >> fftools/ffmpeg.c | 33 ++++++++++++++++----------------- >> 1 file changed, 16 insertions(+), 17 deletions(-) >> >> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c >> index ee7258fcd1..8876c99560 100644 >> --- a/fftools/ffmpeg.c >> +++ b/fftools/ffmpeg.c >> @@ -1855,23 +1855,6 @@ static void flush_encoders(void) >> ost->file_index, ost->st->index); >> >> if (ost->filter && !fg->graph) { >> - int x; >> - for (x = 0; x < fg->nb_inputs; x++) { >> - InputFilter *ifilter = fg->inputs[x]; >> - if (ifilter->format < 0) { >> - AVCodecParameters *par = ifilter->ist->st->codecpar; >> - // We never got any input. Set a fake format, which will >> - // come from libavformat. >> - ifilter->format = par->format; >> - ifilter->sample_rate = par->sample_rate; >> - ifilter->channels = par->channels; >> - ifilter->channel_layout = par->channel_layout; >> - ifilter->width = par->width; >> - ifilter->height = par->height; >> - ifilter->sample_aspect_ratio = par->sample_aspect_ratio; >> - } >> - } >> - >> if (!ifilter_has_all_input_formats(fg)) >> continue; >> >> @@ -2214,6 +2197,22 @@ static int ifilter_send_eof(InputFilter *ifilter, int64_t pts) >> } else { >> // the filtergraph was never configured >> FilterGraph *fg = ifilter->graph; >> + if (ifilter->format < 0) { >> + AVCodecParameters *par = ifilter->ist->st->codecpar; >> + // We never got any input. Set a fake format, which will >> + // come from libavformat. >> + ifilter->format = par->format; >> + ifilter->sample_rate = par->sample_rate; >> + ifilter->channels = par->channels; >> + ifilter->channel_layout = par->channel_layout; >> + ifilter->width = par->width; >> + ifilter->height = par->height; >> + ifilter->sample_aspect_ratio = par->sample_aspect_ratio; >> + } >> + if (ifilter->format < 0 && (ifilter->type == AVMEDIA_TYPE_AUDIO || ifilter->type == AVMEDIA_TYPE_VIDEO)) { >> + av_log(NULL, AV_LOG_ERROR, "Cannot determine format of input %d, stream %d after EOF\n", ifilter->ist->file_index, ifilter->ist->st->index); >> + return AVERROR_INVALIDDATA; >> + } >> for (i = 0; i < fg->nb_inputs; i++) >> if (!fg->inputs[i]->eof) >> break; > > Does it make sense to mux audio or video without packets? And why? Because filters may generate packets on output even if no packets are received on some input. Regards, Marton
On Mon, 19 Mar 2018, Marton Balint wrote: > > > On Mon, 19 Mar 2018, wm4 wrote: > >> On Sun, 18 Mar 2018 20:09:08 +0100 >> Marton Balint <cus@passwd.hu> wrote: >> >>> Fixes ticket #6854 and the following simpler case: >>> >>> ffmpeg -f lavfi -i testsrc=d=1 -f lavfi -i testsrc=d=0 -filter_complex > overlay -f null none >>> [...] >>> for (i = 0; i < fg->nb_inputs; i++) >>> if (!fg->inputs[i]->eof) >>> break; >> >> Does it make sense to mux audio or video without packets? And why? > > Because filters may generate packets on output even if no packets are > received on some input. > Will apply the series soon. Regards, Marton
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index ee7258fcd1..8876c99560 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1855,23 +1855,6 @@ static void flush_encoders(void) ost->file_index, ost->st->index); if (ost->filter && !fg->graph) { - int x; - for (x = 0; x < fg->nb_inputs; x++) { - InputFilter *ifilter = fg->inputs[x]; - if (ifilter->format < 0) { - AVCodecParameters *par = ifilter->ist->st->codecpar; - // We never got any input. Set a fake format, which will - // come from libavformat. - ifilter->format = par->format; - ifilter->sample_rate = par->sample_rate; - ifilter->channels = par->channels; - ifilter->channel_layout = par->channel_layout; - ifilter->width = par->width; - ifilter->height = par->height; - ifilter->sample_aspect_ratio = par->sample_aspect_ratio; - } - } - if (!ifilter_has_all_input_formats(fg)) continue; @@ -2214,6 +2197,22 @@ static int ifilter_send_eof(InputFilter *ifilter, int64_t pts) } else { // the filtergraph was never configured FilterGraph *fg = ifilter->graph; + if (ifilter->format < 0) { + AVCodecParameters *par = ifilter->ist->st->codecpar; + // We never got any input. Set a fake format, which will + // come from libavformat. + ifilter->format = par->format; + ifilter->sample_rate = par->sample_rate; + ifilter->channels = par->channels; + ifilter->channel_layout = par->channel_layout; + ifilter->width = par->width; + ifilter->height = par->height; + ifilter->sample_aspect_ratio = par->sample_aspect_ratio; + } + if (ifilter->format < 0 && (ifilter->type == AVMEDIA_TYPE_AUDIO || ifilter->type == AVMEDIA_TYPE_VIDEO)) { + av_log(NULL, AV_LOG_ERROR, "Cannot determine format of input %d, stream %d after EOF\n", ifilter->ist->file_index, ifilter->ist->st->index); + return AVERROR_INVALIDDATA; + } for (i = 0; i < fg->nb_inputs; i++) if (!fg->inputs[i]->eof) break;
Fixes ticket #6854 and the following simpler case: ffmpeg -f lavfi -i testsrc=d=1 -f lavfi -i testsrc=d=0 -filter_complex overlay -f null none Signed-off-by: Marton Balint <cus@passwd.hu> --- fftools/ffmpeg.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)