How to know if a video is interlaced or progressive?

Hi there, as per title, I was wondering if there is a scientific way to determine whether source footage is interlaced, progressive, or something else, especially older digital footage.

Yes. you can use MediaInfo tool to see if your video is Interlaced or Progressive Scan.

But you should also have a look in player with deinterlacing/image enhancements deactivated for combing artifacts when you deal with old PAL/NTSC material that has been tampered with before - as unfortunately such sometimes wasn’t properly deinterlaced but just mp4-compressed but still saved as “progressive”.

For such material you then should choose the “Interlaced progressive” setting in TVAI.

1 Like

If you are familiar with FFmpeg, you can use FFmpeg’s interlace detection (idet) tool, which doesn’t look just at metadata tags but looks at the actual video frames. This is pretty close to your “scientific” goal.

$ ffmpeg -an -sn -dn -i "${infile}" -filter:v 'idet' -f null -

…where ${infile} is your input file. The idet filter produces a report at the end like the following. It is ugly to read, it requires interpretation, but the idet filter is the barebones for auto-interlace detection.

[Parsed_idet_0 @ 0x600001a08000] Repeated Fields: Neither:  2471 Top:   111 Bottom:   114
[Parsed_idet_0 @ 0x600001a08000] Single frame detection: TFF:     3 BFF:  1611 Progressive:   374 Undetermined:   708
[Parsed_idet_0 @ 0x600001a08000] Multi frame detection: TFF:     0 BFF:  2417 Progressive:   277 Undetermined:     2

In the above case, the file is likely to be BFF. The analysis is not perfect, so you will get static frames being reported a progressive and a proportion of misdetected frames. Repeated fields are a sign of telecine.

If you are not familiar with the command line, idet is included in QCTools (you have to enable it in settings/preferences and restart). QCTools

Another method is to look at the interlace metadata tags (assuming that the interlace tags have been set, which many assets are not - which is why just looking at metadata tags may not be enough).

[Parsed_showinfo_0 @ 0x600002ea4000] color_range:tv color_space:smpte170m color_primaries:unknown color_trc:unknown
[Parsed_showinfo_0 @ 0x600002ea4000] n: 779 pts: 779779 pts_time:25.9926 duration:   1001 duration_time:0.0333667 fmt:yuv422p10le cl:unspecified sar:10/11 s:720x486 i:B iskey:1 type:I checksum:A3AFA649 plane_checksum:[9B846ED5 B5D43A21 C0CAFD44] mean:[294 511 535] stdev:[180.1 30.4 33.5]
[Parsed_showinfo_0 @ 0x600002ea4000] color_range:tv color_space:smpte170m color_primaries:unknown color_trc:unknown
[Parsed_showinfo_0 @ 0x600002ea4000] n: 780 pts: 780780 pts_time:26.026  duration:   1001 duration_time:0.0333667 fmt:yuv422p10le cl:unspecified sar:10/11 s:720x486 i:B iskey:1 type:I checksum:5BC52B74 plane_checksum:[7188C2CD 5CF1D702 EA449187] mean:[294 511 535] stdev:[180.5 30.5 33.5]
[Parsed_showinfo_0 @ 0x600002ea4000] color_range:tv color_space:smpte170m color_primaries:unknown color_trc:unknown
[Parsed_showinfo_0 @ 0x600002ea4000] n: 781 pts: 781781 pts_time:26.0594 duration:   1001 duration_time:0.0333667 fmt:yuv422p10le cl:unspecified sar:10/11 s:720x486 i:B iskey:1 type:I checksum:8FAEE3F3 plane_checksum:[AD2D9172 7D8EC0F3 6700917F] mean:[294 511 535] stdev:[181.7 30.0 33.3]
[Parsed_showinfo_0 @ 0x600002ea4000] color_range:tv color_space:smpte170m color_primaries:unknown color_trc:unknown
[Parsed_showinfo_0 @ 0x600002ea4000] n: 782 pts: 782782 pts_time:26.0927 duration:   1001 duration_time:0.0333667 fmt:yuv422p10le cl:unspecified sar:10/11 s:720x486 i:B iskey:1 type:I checksum:345E1578 plane_checksum:[CEF2A4F3 CDF5F8BB 234F77AC] mean:[292 510 535] stdev:[181.8 29.5 33.2]

The i:B indicates that the frame is BFF. This is similar to how mediainfo & FFprobe determine whether a file is interlaced - but only works if the metadata tags have been set in the input.

idet is a very useful filter for interlace detection. It is not that great at detecting soft telecine (RFF) and needs a lot more care to avoid confusing interlaced footage with telecined footage. But it rarely fails me.

[ The MPV guys wrote a wrapper for idet that attempts to interpret the results of idet, attempts to deinterlace and compares the results before and after. This script is partially successful, but is considered a legacy / unsupported script by the MPV Team. mpv/TOOLS/idet.sh at master · mpv-player/mpv · GitHub. However, the same methodology could be used for inspiration by a developer to create a new auto interlace and telecine detection tool.]

If Topaz included a section in the input GUI where a user could run auto-interlace detection (idet) and interpret the results as a “analyze source” step, that would help users less familiar with a CLI.

There is a need across the industry for an Auto Interlace / Telecine Detection tool which first parses the metadata tags to see what was set in the original, then scans with -filter:v 'idet,metadata=mode=print', and finally interprets the results and produces a report. That is more “scientific” than just a single method. If an independent is interested in a fun little open source, cross-platform project, start a github repo and share the link.

The final method is to use your eyes and step through a scene frame by frame. QCTools and MVP are both good for frame-stepping previews.

3 Likes

Hold on it does? I never noticed. Since when?

This is very detailed, thank you

since always. at least 10 years.

I absolutely can’t see it, I must be stupid.

did you see my screenshots i posted on my original response?

I did but none of my videos display that information

@dgalimi Here are some test cases that you can use with FFmpeg to generate synthetic progressive/interlaced content for testing interlace detection:

  1. Progressive at 29.97. No interlacing. This is the control/datum for your experimentation.
$ ffmpeg -hide_banner -f 'lavfi' -i "testsrc2=size='hd1080':rate='ntsc':duration=60" -codec:v 'mpeg2video' -q:v 2 "testcase_progressive_2997.ts" -y
  1. Interlaced, with 59.94 fields per second in 29.97 frames per second. This command produces a file with the correct metadata tags, as per professionally encoded content. This would be considered interlaced TV content at the full temporal resolution of 59.94.
$ ffmpeg -hide_banner -f 'lavfi' -i "testsrc2=size='hd1080':rate='(60000/1001)':duration=60,tinterlace=mode='interleave_top',setparams=field_mode='tff'" -codec:v 'mpeg2video' -q:v 2 -flags '+ilme+ildct' "testcase_interlaced_tff.ts" -y

and to analyze it with idet:

$ ffmpeg -an -sn -dn -i "testcase_interlaced_tff.ts" -filter:v 'idet' -f null -
  • :white_check_mark: mediainfo identifies this file as interlaced-tff, because it is correctly tagged
  • :white_check_mark: ffprobe identifies this file as interlaced-tff, because it is correctly tagged
  • :white_check_mark: idet’s multiframe detection identifies this file as interlaced-tff.
  1. Interlaced, with 59.94 fields per second in 29.97 frames per second. This differs from example 2 in that the frames have not been tagged as interlaced and will therefore be assumed to be progressive by mediainfo and ffprobe. There is a high proportion of amateur and second-generation content on the web where the interlace tags were never included or were destroyed by a ham-fisted monster during a secondary transcode. This type of content is the scourge of web video.
$ ffmpeg -hide_banner -f 'lavfi' -i "testsrc2=size='hd1080':rate='(60000/1001)':duration=60,tinterlace=mode='interleave_top'" -codec:v 'mpeg2video' -q:v 2 "testcase_interlaced_tff_untagged.ts" -y

and to analyze it with idet:

$ ffmpeg -an -sn -dn -i "testcase_interlaced_tff_untagged.ts" -filter:v 'idet' -f null -
  • :negative_squared_cross_mark: mediainfo identifies this file as progressive, because it was not tagged correctly during encode.
  • :negative_squared_cross_mark: ffprobe identifies this file as progressive, because it was not tagged correctly during encode.
  • :white_check_mark: idet’s multiframe detection identifies this file as interlaced-tff, because it is analyzing the video itself, not just the tags.
  1. The workflow to produce soft-telecine 23.98 frames per second in 29.97 frames per second is a little more complex to produce, because it involves using FFmpeg and a legacy tool called dg-pulldown, so I’ll not include for the sake of brevity).
2 Likes

Thank you all for the detailed information - nt as easy as pressing a button ehe!