diff mbox

[FFmpeg-devel,RFC] ffmpeg: reverse logic for interlaced field ordering heuristic

Message ID 20170901190254.30401-1-timo@rothenpieler.org
State New
Headers show

Commit Message

Timo Rothenpieler Sept. 1, 2017, 7:02 p.m. UTC
When re-encoding for example interlaced h264 from mkv into mkv, the
field ordering type switches from TT to TB, confusing some players.
Same happens on a lot of other cases as well.

I have no idea if this is the correct fix for it, but something is
definitely going wrong.
---
 ffmpeg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Marton Balint Sept. 5, 2017, 6:49 p.m. UTC | #1
On Fri, 1 Sep 2017, Timo Rothenpieler wrote:

> When re-encoding for example interlaced h264 from mkv into mkv, the
> field ordering type switches from TT to TB, confusing some players.
> Same happens on a lot of other cases as well.
>
> I have no idea if this is the correct fix for it, but something is
> definitely going wrong.

Before applying fixes in the field order code, I think we should first 
decide if we should apply the patch in

https://patchwork.ffmpeg.org/patch/4699/

Regards,
Marton
James Almer Sept. 5, 2017, 6:55 p.m. UTC | #2
On 9/5/2017 3:49 PM, Marton Balint wrote:
> 
> On Fri, 1 Sep 2017, Timo Rothenpieler wrote:
> 
>> When re-encoding for example interlaced h264 from mkv into mkv, the
>> field ordering type switches from TT to TB, confusing some players.
>> Same happens on a lot of other cases as well.
>>
>> I have no idea if this is the correct fix for it, but something is
>> definitely going wrong.
> 
> Before applying fixes in the field order code, I think we should first
> decide if we should apply the patch in

Or alternatively, consider the suggestion from Jerome Martinez.

> 
> https://patchwork.ffmpeg.org/patch/4699/
> 
> Regards,
> Marton
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
diff mbox

Patch

diff --git a/ffmpeg.c b/ffmpeg.c
index ccb6638e0a..41f9bc4fb7 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_TT:AV_FIELD_BB;
         else
             mux_par->field_order = AV_FIELD_PROGRESSIVE;
         pkt.data   = (uint8_t *)in_picture;
@@ -1226,7 +1226,7 @@  static void do_video_out(OutputFile *of,
             in_picture->top_field_first = !!ost->top_field_first;
 
         if (in_picture->interlaced_frame) {
-            if (enc->codec->id == AV_CODEC_ID_MJPEG)
+            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;