[FFmpeg-devel] [PATCH] avisynth.c corrected interlace detection

emcodem emcodem at ffastrans.com
Mon May 24 18:03:49 EEST 2021


Sorry for the delay on this, should have corrected it much earlier.
There was some confusion in the interlaced analysis. From 3rdparty decoders perspective, a clip
can only be interlaced when it is NOT field_based. This is because in a field_based clip, the fields
are separate images, so it is actually progressive. In that case, avisynth still shows is_tff or bff because those
values are needed in case the script decides to weave the separated fields later on.

---
 libavformat/avisynth.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 350ac6d11d..ff6e6e1bfa 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)) {
+    /* separatefields makes field_based==true, weave makes field_based==false
+     * only non field_based clips can therefore be interlaced */
+    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;
         }
-- 
2.25.1



More information about the ffmpeg-devel mailing list