[FFmpeg-devel] [PATCH] ffmpeg: fix setting field_order during muxing

James Almer jamrial at gmail.com
Thu Aug 10 05:43:36 EEST 2017


AVFrame.top_field_first doxy states

"If the content is interlaced, is top field displayed first."

And AVFieldOrder doxy defines:
    AV_FIELD_TB,          //< Top coded first, bottom displayed first
    AV_FIELD_BT,          //< Bottom coded first, top displayed first

Fixes ticket #6577

Signed-off-by: James Almer <jamrial at gmail.com>
---
 ffmpeg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 888d19a647..a08db61ea3 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1206,7 +1206,7 @@ static void do_video_out(OutputFile *of,
            avoid any copies. We support temporarily the older
            method. */
         if (in_picture->interlaced_frame)
-            mux_par->field_order = in_picture->top_field_first ? AV_FIELD_TB:AV_FIELD_BT;
+            mux_par->field_order = in_picture->top_field_first ? AV_FIELD_BT:AV_FIELD_TB;
         else
             mux_par->field_order = AV_FIELD_PROGRESSIVE;
         pkt.data   = (uint8_t *)in_picture;
@@ -1229,7 +1229,7 @@ static void do_video_out(OutputFile *of,
             if (enc->codec->id == AV_CODEC_ID_MJPEG)
                 mux_par->field_order = in_picture->top_field_first ? AV_FIELD_TT:AV_FIELD_BB;
             else
-                mux_par->field_order = in_picture->top_field_first ? AV_FIELD_TB:AV_FIELD_BT;
+                mux_par->field_order = in_picture->top_field_first ? AV_FIELD_BT:AV_FIELD_TB;
         } else
             mux_par->field_order = AV_FIELD_PROGRESSIVE;
 
-- 
2.13.3



More information about the ffmpeg-devel mailing list