Exported Video Not Interlaced

Trying to transcode 720 progressive or 1080 progressive to 1080 interlaced, TFF.

“Interlaced” and “Top Field First” are selected in “Video” box of advanced export settings.

MediaInfo reports the scan type of exported video is still Progressive.

FWIW, I’m told ffmpeg needs -vf tinterlace=4 to do proper interlacing, top field first.
-vf tinterlace=5 gives bottom field first.

When making this conversion the interlaced frame rate (2 fields) should be half the progressive frame rate, e.g. 59.94 frames progressive would be 29.97 frames interlaced.

I just made a test of 720p to 720i using the Export default without hardware encoder but making the changes to Scan mode and Field order, and it worked:

Scan type                                : MBAFF
Scan type, store method                  : Interleaved fields
Scan order                               : Top Field First

I just made another test, this time changing resolution in export from 1280x720 to 1920x1080, and that also succeeded.

What are your full export settings? I also need to know if you are changing the resolution, aspect ratio, or frame rate. Basically, upload the XML of the export job. It has been reported that ffmpeg does not write interlace correct using some combinations of container and codec, or at least not in a way that agrees with mediainfo and maybe some video players.

Shotcut is not a ffmpeg command line front-end except for Properties > Reverse/Convert/Extract. Those rules do not apply here.

That XML is missing the critical <consumer> element that I need to see because it was not taken from the export JOB. The consumer contains all of the export settings. Please right-click an export job and choose View XML.

This XML job code fails to deliver interlaced output according to MediaInfo:

<?xml version='1.0' encoding='utf-8'?>
<mlt parent="producer0" title="Shotcut version 19.04.30" out="00:02:57.174" in="00:00:00.000" root="C:\Program Files\Shotcut" version="6.15.0" LC_NUMERIC="en_US">
  <profile width="1280" description="HD 1080p 25 fps" sample_aspect_den="1" frame_rate_den="1001" display_aspect_num="16" height="720" sample_aspect_num="1" display_aspect_den="9" colorspace="709" progressive="1" frame_rate_num="60000"/>
  <consumer ab="192k" vcodec="mpeg2video" acodec="pcm_s16le" channels="2" target="D:/Videos/InterlaceTest.avi" height="720" bf="0" rescale="hyper" qscale="1" top_field_first="1" aspect="1.77778" width="1280" real_time="-4" g="1" deinterlace_method="yadif" threads="7" ar="48000" f="avi" progressive="0" mlt_service="avformat"/>
  <producer title="Shotcut version 19.04.30" id="producer0" out="00:02:57.174" in="00:00:00.000">
    <property name="length">00:02:57:11</property>
    <property name="eof">pause</property>
    <property name="resource">D:/Programs/ffmpeg/BroadcastVideo/C0008.MP4</property>
    <property name="audio_index">1</property>
    <property name="video_index">0</property>
    <property name="mute_on_pause">0</property>
    <property name="mlt_service">avformat-novalidate</property>
    <property name="seekable">1</property>
    <property name="aspect_ratio">1</property>
    <property name="creation_time">2018-09-19T22:31:52</property>
    <property name="shotcut:hash">2e3fb1c98410c3b5318df9ac43bff91a</property>
    <property name="ignore_points">0</property>
    <property name="shotcut:caption">C0008.MP4</property>
    <property name="shotcut:skipConvert">1</property>
    <property name="global_feed">1</property>
    <property name="xml">was here</property>
    <property name="shotcut:projectAudioChannels">2</property>
    <property name="shotcut:projectFolder">0</property>
  </producer>
</mlt>

Here is the output from MediaInfo:

Video
ID                                       : 0
Format                                   : MPEG Video
Format version                           : Version 2
Format profile                           : Main@High 1440
Format settings, BVOP                    : No
Format settings, Matrix                  : Default
Format settings, GOP                     : N=1
Format settings, picture structure       : Frame
Codec ID                                 : mpg2
Codec ID/Info                            : (MPEG-1/2) FFmpeg
Codec ID/Hint                            : Ffmpeg
Duration                                 : 2 min 57 s
Bit rate mode                            : Variable
Bit rate                                 : 170 Mb/s
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 59.940 (60000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Original scan type                       : Interlaced
Original scan order                      : Top Field First
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 3.070
Stream size                              : 3.50 GiB (99%)
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709




Is there a bug in Shotcut or MediaInfo? The scan type of the original is progressive according to the camcorder manufacturer (Sony) despite what MediaInfo says.

This code produces interlaced, according to MediaInfo:

<?xml version='1.0' encoding='utf-8'?>
<mlt parent="producer0" title="Shotcut version 19.04.30" out="00:02:57.174" in="00:00:00.000" root="C:\Program Files\Shotcut" version="6.15.0" LC_NUMERIC="en_US">
  <profile width="1280" description="HD 1080p 25 fps" sample_aspect_den="1" frame_rate_den="1001" display_aspect_num="16" height="720" sample_aspect_num="1" display_aspect_den="9" colorspace="709" progressive="1" frame_rate_num="60000"/>
  <consumer vcodec="mpeg2video" target="D:/Videos/InterlaceTest.avi" audio_off="1" height="1080" bf="3" rescale="hyper" an="1" vmaxrate="6M" vminrate="6M" top_field_first="1" aspect="1.77778" vbufsize="12288000" width="1920" real_time="-4" g="300" deinterlace_method="yadif" threads="7" sc_threshold="0" f="mxf" progressive="0" vb="6M" mlt_service="avformat"/>
  <producer title="Shotcut version 19.04.30" id="producer0" out="00:02:57.174" in="00:00:00.000">
    <property name="length">00:02:57:11</property>
    <property name="eof">pause</property>
    <property name="resource">D:/Programs/ffmpeg/BroadcastVideo/C0008.MP4</property>
    <property name="audio_index">1</property>
    <property name="video_index">0</property>
    <property name="mute_on_pause">0</property>
    <property name="mlt_service">avformat-novalidate</property>
    <property name="seekable">1</property>
    <property name="aspect_ratio">1</property>
    <property name="creation_time">2018-09-19T22:31:52</property>
    <property name="shotcut:hash">2e3fb1c98410c3b5318df9ac43bff91a</property>
    <property name="ignore_points">0</property>
    <property name="shotcut:caption">C0008.MP4</property>
    <property name="shotcut:skipConvert">1</property>
    <property name="global_feed">1</property>
    <property name="xml">was here</property>
    <property name="shotcut:projectAudioChannels">2</property>
    <property name="shotcut:projectFolder">0</property>
  </producer>
</mlt>

MediaInfo output:

Video
ID                                       : 2
Format                                   : MPEG Video
Format version                           : Version 2
Format profile                           : Main@High
Format settings                          : BVOP
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Default
Format settings, GOP                     : M=4, N=300
Format settings, picture structure       : Frame
Format settings, wrapping mode           : Frame
Codec ID                                 : 0D01030102046001-0401020201030300
Duration                                 : 2 min 57 s
Bit rate mode                            : Variable
Bit rate                                 : 6 000 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 59.940 (60000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan order                               : Top Field First
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.048
Time code of first frame                 : 00:00:00:00
Time code source                         : Group of pictures header
Stream size                              : 127 MiB (94%)
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Other #1
ID                                       : 1-Material
Type                                     : Time code
Format                                   : MXF TC
Time code of first frame                 : 00:00:00:00
Time code settings                       : Material Package
Time code, striped                       : Yes

Other #2
ID                                       : 1-Source
Type                                     : Time code
Format                                   : MXF TC
Time code of first frame                 : 00:00:00:00
Time code settings                       : Source Package
Time code, striped                       : Yes

Other #3
Type                                     : Time code
Format                                   : SMPTE TC
Muxing mode                              : SDTI
Time code of first frame                 : 00:00:00:01

MediaInfo is reporting “Original scan type: Interlaced” and Shotcut Properties reports the output AVI as interlaced (according to FFmpeg libs). An older version of MediaInfo that I have (v0.7.75) does not report two different scan types. I think you are mislead by what it is reporting. I think it is reporting that the video is coded as interlace but the AVI lacks some metadata indicating interlace, which would be a shortcoming of either the format or ffmpeg’s avi muxer.

https://sourceforge.net/p/mediainfo/discussion/297609/thread/ccb20cb7/

Thanks for the excellent detective work.

It looks like the video is interlaced after all.

http://www.aktau.be/2013/09/22/detecting-interlaced-video-with-ffmpeg/

Here is an ffmpeg command line to test interlace:

ffmpeg -i 60i.mp4 -filter:v idet -frames:v 30 -an -f rawvideo -y nul

@chris319

Just downloaded the latest version of ffmpeg and it does not work.
No matter if the clip is interlaced or progressive, it always reports:

Single frame detection: TFF:0 BFF: 0 Progressive: 101 Undetermined: 0
Multi frame detection: TFF: 0 BFF: 0 Progressive: 101 Undetermined: 0

I confirmed (with SC and Telestream) that the test interlaced video is indeed TFF.

Don’t know what version you used, perhaps the “ident” filter is broken in the latest version.

EDIT:

Results seem to vary depending on codec used.
Below a test of some footage from a Blu-ray which is correct, whilst my previous test
with a XDCAM (essentially mpeg2) video was completely wrong:

Single frame detection: TFF: 192 BFF: 0 Progressive: 0 Undetermined: 0
Multi frame detection: TFF: 192 BFF: 0 Progressive: 0 Undetermined: 0

Based on this, I would say that the ffmpeg method is very unreliable.

I’m getting the same results. It appears anything to do with interlace in ffmpeg is broken, or at least is too questionable to be trusted. I also tested all 7 modes of ffmpeg’s tinterlace filter and it reported them all “undetermined”.

I downloaded a test file from here:

https://www.acrovid.com/videodemos_download.htm

Both ffmpeg and MediaInfo report that the 60i file is interlaced.

I am thinking of purchasing the program. It’s only $129 and clearly ffmpeg isn’t working.

ffmpeg is broken as far as interlacing goes and MediaInfo does not actually check the frames/fields, it just relies on the flags being properly set and reports those.

I can tell you that exports with SC (still using 19.04), using XDCAM and DNxHD in mxf (not mov) are properly interlaced.
Have confirmed with Telestream, CineXtools and actually playing them out of our Omneon servers for broadcasts.

Shotcut exporting in H.265 seems to give interlaced, according to Shotcut Info.

Forget about using ffmpeg and MediaInfo to check.

Completely agree.

@chris319

Had a closer look at the acrovid software and I see they use not only MediaInfo.dll, but also
avcodec-58.dll, avformat-58.dll and avfilter-7.dll.
AFAIK they are from the ffmpeg family, even the LGPL.txt file is included in the installation.

This then poses two questions:

  1. If they are from ffmpeg and MediaInfo, how accurate are they?

  2. If somehow it is accurate, the API calls to these dll’s should be documented somewhere and hence making a pgm to interface to the libs and extracting codec/scan info from a clip should be do-able.

EDIT

Just checked, it does use the libs from ffmpeg and MediaInfo:

Screenshot%20(4)

Screenshot%20(5)

H.265 gives interlaced but only if it’s 1920 x 1080, AND the following line is present in “Other”

CRF=0

Also forget about Acrovid. Saves me $129.

Paul:

Would you mind testing H.264 and H.265 for interlace as exported by Shotcut using Telestream, CineXtools and your Omneon servers? You need to be in 1920 x 1080 and “CRF=0” must be present in the “Other” field.

This would be useful information if you must deliver to CBS, NBC or PBS.

@chris319

Sorry about the delay, had some shows to take care of.

OK, the results:
We don’t normally accept footage in H.264 or 265 but I tried it anyway.
The H.265 was rejected (could be a codec issue) and the H.264 was accepted but failed for a number of reasons.

  1. Even though my source was XDCAM 50i 4:2:2, the resulting chroma was 4:2:0
    I suspect that most broadcasters will not accept 4:2:0 as well.
    You may have to add a “pix_fmt …” option to SC.

  2. The output was “interlaced” but failed on the account that it was MBAFF.
    MBAFF = Macroblock-Adaptive Frame/Field Coding and although flagged as interlaced, there
    is no guarantee that the actual frames are interlaced.

  3. The resulting GOP was IPIPPPPPPBPPPPPPPB…Then only frame 125 was I again.
    We only accept all I frame or long GOP mpeg2 which is IBBPBBPBBPBBI,
    i.e. every 12th frame must be an I frame.
    Other broadcasters may have similar criteria.
    You will need to adjust the GOP length in SC to suit.
    I left the GOP length to the SC default which I only checked after the results and sure enough
    it was set to 125.

  4. The CRF=0 flag made no difference, the results were the same in both cases.

Hope it helps.

Thanks for testing, Paul.

So the safe option is XDCAM which is 4:2:2 and uses the mpeg-2 encoder. Do you agree?

“my source was XDCAM 50i 4:2:2”

Is that 50 fields per second which equals 25 frames per second?

In the U.S. some services are distributing in H.264.

Thanks again. I may have more later if you’re game, but so far this information is very useful.

I found I wasn’t getting interlace from Shotcut in H.265 without the CRF=0 line, but it’s kind of moot now.

It might be worthwhile to check some progressive-scan clips as well as interlace. Something tells me it’s not going to have an easy time with anything but mpeg-2. Those QC power tools are kind of pricey and we have determined that ffmpeg and MediaInfo aren’t of much use.