Opened 3 years ago

Closed 7 months ago

#9339 closed defect (fixed)

tff interlaced encode from progressive not working

Reported by: daren Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: tff interlaced progressive
Cc: daren Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by daren)

Summary of the bug:
tff interlaced encodes of wrongly (progressive) encoded interlaced footage used to work. It now seems to always wrongly encode as bff but label (mediainfo) it as tff no matter if -top 0 or -top 1 is supplied.

How to reproduce:

% ffmpeg -i input -c:v libx264 -flags +ilme+ildct -top 1 output
ffmpeg version n4.4
built with GCC 11.1.0 (Arch Linux repository)

Tried a few ffmpeg-static versions out, it breaks at 4.4-static and works up to 4.2.2-static (4.3.x branches were missing)
It broke fairly recently though, couple weeks/months ago, guessing with ffmpeg 4.4.

Attached a file that works with

ffmpeg -i progressive_interlaced_footage.mkv -pix_fmt yuv420p -c:v libx264 -flags +ilme+ildct -top 1 interlaced.mkv

on 4.2.2-static and lower versions but not with n4.4/4.4-static.

Attachments (3)

progressive_interlaced_footage.mkv (2.2 MB ) - added by daren 3 years ago.
progressive encode of interlaced footage
test_ffmpeg_interlace.sh (491 bytes ) - added by daren 3 years ago.
reproduce_ffmpeg_interlacing_issue.sh (1.8 KB ) - added by daren 2 years ago.

Change History (18)

by daren, 3 years ago

progressive encode of interlaced footage

comment:1 by daren, 3 years ago

Description: modified (diff)

comment:2 by daren, 3 years ago

Keywords: tff added; bff removed
Summary: bff interlaced encode from progressive not workingtff interlaced encode from progressive not working

comment:3 by daren, 3 years ago

Description: modified (diff)

comment:4 by daren, 3 years ago

Description: modified (diff)

comment:5 by daren, 3 years ago

Description: modified (diff)

comment:6 by jeeb, 3 years ago

Can you check with -field_order tb, or any other of the non-progressive field orders?

"progressive",
"tt",
"bb",
"tb",
"bt",

comment:7 by daren, 3 years ago

I tried it just now, it sets the field order for mediainfo to read, but it's still botched for playback.

Attaching another script test_ffmpeg_interlace.sh for reproduction.

ffmpeg 4.4 produces all output with choppy (wrong field order) deinterlaced playback with vlc and mpv while 4.2.2-static deinterlaces properly .

by daren, 3 years ago

Attachment: test_ffmpeg_interlace.sh added

comment:8 by jeeb, 3 years ago

That's interesting since while I have found the issue (auto-detection after override was handled and not the other way around in ffmpeg.c), the "top" option when specified for an output does not do anything else than set that value to either "bb" (0) or "tt" (1).

So if those two do not work... then there's something else at play as well.

comment:9 by daren, 2 years ago

ffmpeg-static released a couple more versions up to the latest one, can somewhat backtrack where this went buggy.

It happened between releases 4.3.2 and 4.4 and is still an issue with 5.0, if someone could try reproduce this with commits that could be the culprit here.

Attaching another script that quickly tries to reproduce this with all the ffmpeg-static versions available.

comment:10 by elenril, 7 months ago

Resolution: fixed
Status: newclosed

Should have been fixed 2 years ago in 4c694093be68d401c60819e5171817c62afef8b2, cannot reproduce the bug in my tests.
Please reopen and comment if it's still broken for you.

comment:11 by daren, 7 months ago

Resolution: fixed
Status: closedreopened

No, still the case in ffmpeg 6.0 even, just checked.

I'll bisect between tags 4.3.2 and 4.4 and find the culprit commit that botched this.

comment:13 by elenril, 7 months ago

Okay, I see the problem in the handling of the -top option. The thing is also that it is badly named, underdocumented, and entirely redundant with the setfield filter - transcoding your video with -vf setfield=tff produces correctly-looking output. I'm thinking the option should be removed and everyone should switch to using the filter.

comment:14 by daren, 7 months ago

That seems to do the trick and controls whether it's tff or bff, didn't read about it earlier.

If the -top option is that undocumented and unused as barely anyone complained about it not working properly for over 2 years, might as well deprecate and/or remove it.

comment:15 by elenril, 7 months ago

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.