[FFmpeg-cvslog] avisynth: populate field order

emcodem git at videolan.org
Thu Mar 11 21:22:39 EET 2021


ffmpeg | branch: master | emcodem <emcodem at ffastrans.com> | Thu Jan 21 18:59:45 2021 +0100| [8b74458d9303454fcbe9869a00df0c08461dfd4c] | committer: Stephen Hutchinson

avisynth: populate field order

Fixes Trac ticket #8757

Signed-off-by: Stephen Hutchinson <qyot27 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b74458d9303454fcbe9869a00df0c08461dfd4c
---

 libavformat/avisynth.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 5756aea0b6..64fb6cc98f 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -243,6 +243,23 @@ 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)) {
+        if (avs_is_tff(avs->vi)) {
+            st->codecpar->field_order = AV_FIELD_TT;
+        }
+        else if (avs_is_bff(avs->vi)) {
+            st->codecpar->field_order = AV_FIELD_BB;
+        }
+    }
+
     switch (avs->vi->pixel_type) {
     /* 10~16-bit YUV pix_fmts (AviSynth+) */
     case AVS_CS_YUV444P10:



More information about the ffmpeg-cvslog mailing list