Message ID | 20220208110240.4179-2-qyot27@gmail.com |
---|---|
State | Accepted |
Commit | 05c492eeb0866537d051531afe30b29d76d80383 |
Headers | show |
Series | avformat/avisynth: support frame properties | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | success | Make fate finished |
On 2/8/22 6:02 AM, Stephen Hutchinson wrote: > From: emcodem <emcodem@ffastrans.com> > > AviSynth works on frame-based video by default, which can > be either progressive or interlaced. Some filters can break > frames into half-height fields, at which point it considers > the clip to be field-based (avs_is_field_based can be used > to check for this situation). > > To properly detect the field order of a typical video clip, > the frame needs to have been weaved back together already, > so avs_is_field_based should actually report 'false' when > checked. > > Signed-off-by: Stephen Hutchinson <qyot27@gmail.com> > --- > libavformat/avisynth.c | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) > > diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c > index 350ac6d11d..1e862a6a85 100644 > --- a/libavformat/avisynth.c > +++ b/libavformat/avisynth.c > @@ -250,15 +250,12 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) > st->nb_frames = avs->vi->num_frames; > avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); > > - av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); > - av_log(s, AV_LOG_TRACE, "avs_is_parity_known: %d\n", avs_is_parity_known(avs->vi)); > > - /* The following typically only works when assumetff (-bff) and > - * assumefieldbased is used in-script. Additional > - * logic using GetParity() could deliver more accurate results > - * but also decodes a frame which we want to avoid. */ > st->codecpar->field_order = AV_FIELD_UNKNOWN; > - if (avs_is_field_based(avs->vi)) { > + /* AviSynth works with frame-based video, detecting field order can > + * only work when avs_is_field_based returns 'false'. */ > + av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); > + if (avs_is_field_based(avs->vi) == 0) { > if (avs_is_tff(avs->vi)) { > st->codecpar->field_order = AV_FIELD_TT; > } Pushed.
diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 350ac6d11d..1e862a6a85 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -250,15 +250,12 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->nb_frames = avs->vi->num_frames; avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); - av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); - av_log(s, AV_LOG_TRACE, "avs_is_parity_known: %d\n", avs_is_parity_known(avs->vi)); - /* The following typically only works when assumetff (-bff) and - * assumefieldbased is used in-script. Additional - * logic using GetParity() could deliver more accurate results - * but also decodes a frame which we want to avoid. */ st->codecpar->field_order = AV_FIELD_UNKNOWN; - if (avs_is_field_based(avs->vi)) { + /* AviSynth works with frame-based video, detecting field order can + * only work when avs_is_field_based returns 'false'. */ + av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); + if (avs_is_field_based(avs->vi) == 0) { if (avs_is_tff(avs->vi)) { st->codecpar->field_order = AV_FIELD_TT; }