MediaArea / MediaInfo

Convenient unified display of the most relevant technical and tag data for video and audio files.
https://MediaArea.net/MediaInfo
BSD 2-Clause "Simplified" License
1.41k stars 160 forks source link

Scan type: Interlaced/Progressive wrong? #541

Closed RalphMichel closed 1 month ago

RalphMichel commented 3 years ago

I have a DV video in a MOV container which is interlaced. When I create an x264 in an MP4 container with FFMPEG, Mediainfo shows me that the video is progressive. If I play the video on the VLC player, it is interlaced. If I do the same with an x265 in an MP4 container, Mediainfo shows me the correct scan-type and plays correctly as interlaced. Is this a problem with Mediainfo scan-type?

FFMPEG command for x264: ffmpeg -i 01_Kreis_.mov -c:v libx264 -preset veryslow -crf 18 -pix_fmt yuv420p -c:a aac out_EC_x264.mp4

Mediainfo output x264:

General
Complete name                            : /Volumes/32gb/x264_Interlaces_Issue/out_EC_x264.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 81.9 KiB
Duration                                 : 18 s 22 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 37.2 kb/s
Writing application                      : Lavf58.45.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings                          : CABAC / 16 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 16 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 18 s 0 ms
Bit rate                                 : 28.7 kb/s
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 4:3
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Standard                                 : PAL
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.003
Stream size                              : 63.0 KiB (77%)
Title                                    : Apple Video Mediensteuerung
Writing library                          : x264 core 160 r3011 cde9a93
Encoding settings                        : cabac=1 / ref=16 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=18.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Language                                 : English
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 18 s 22 ms
Duration_LastFrame                       : -5 ms
Bit rate mode                            : Variable
Bit rate                                 : 2 280 b/s
Maximum bit rate                         : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 5.02 KiB (6%)
Title                                    : Apple Ton Mediensteuerung
Language                                 : English
Default                                  : Yes
Alternate group                          : 1

Other
ID                                       : 3
Type                                     : Time code
Format                                   : QuickTime TC
Duration                                 : 18 s 0 ms
Frame rate                               : 25.000 FPS
Time code of first frame                 : 10:00:00:00
Time code, striped                       : Yes
Title                                    : Apple Video Mediensteuerung
Language                                 : English
Default                                  : No

FFMPEG command for x265: ffmpeg -i 01_Kreis_.mov -c:v libx265 -preset veryslow -crf 18 -pix_fmt yuv420p -c:a aac out_EC_x265.mp4

Mediainfo output x265:

General
Complete name                            : /Users/ralph/Desktop/out_EC_x265.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/mp41)
File size                                : 100 KiB
Duration                                 : 18 s 0 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 45.5 kb/s
Writing application                      : Lavf58.76.100

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L3@Main
Codec ID                                 : hev1
Codec ID/Info                            : High Efficiency Video Coding
Duration                                 : 18 s 0 ms
Bit rate                                 : 35.5 kb/s
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 4:3
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Standard                                 : PAL
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan type, store method                  : Interleaved fields
Scan order                               : Bottom Field First
Bits/(Pixel*Frame)                       : 0.003
Stream size                              : 78.1 KiB (78%)
Title                                    : Apple Video Mediensteuerung
Writing library                          : x265 3.4+31-6722fce1f:[Mac OS X][clang 12.0.0][32 bit][noasm] 8bit+10bit+12bit
Encoding settings                        : cpuid=0 / frame-threads=3 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=720x576 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=5 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-hrd / info / hash=0 / no-temporal-layers / open-gop / min-keyint=25 / keyint=250 / gop-lookahead=0 / bframes=8 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=40 / lookahead-slices=0 / scenecut=40 / hist-scenecut=0 / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / rect / amp / max-tu-size=32 / tu-inter-depth=3 / tu-intra-depth=3 / limit-tu=0 / rdoq-level=2 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=5 / limit-refs=0 / no-limit-modes / me=3 / subme=4 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=6 / selective-sao=4 / no-early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=1.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=18.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=255 / sar-width / : / sar-height=59:54 / overscan=0 / videoformat=5 / range=0 / colorprim=5 / transfer=1 / colormatrix=6 / chromaloc=0 / display-window=0 / cll=0,0 / min-luma=0 / max-luma=255 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / hist-threshold=0.03 / no-opt-cu-delta-qp / no-aq-motion / no-hdr10 / no-hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / scenecut-aware-qp=0conformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0 / no-vbv-live-multi-pass
Language                                 : English
Color range                              : Limited
Color primaries                          : BT.601 PAL
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.601
Codec configuration box                  : hvcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 18 s 0 ms
Source duration                          : 18 s 21 ms
Source_Duration_LastFrame                : -5 ms
Bit rate mode                            : Variable
Bit rate                                 : 2 282 b/s
Maximum bit rate                         : 128 kb/s / 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 5.02 KiB (5%)
Source stream size                       : 5.02 KiB (5%)
Title                                    : Apple Ton Mediensteuerung
Language                                 : English
Default                                  : Yes
Alternate group                          : 1
mdhd_Duration                            : 18000

Other
ID                                       : 3
Type                                     : Time code
Format                                   : QuickTime TC
Duration                                 : 18 s 0 ms
Frame rate                               : 25.000 FPS
Time code of first frame                 : 10:00:00:00
Time code, striped                       : Yes
Title                                    : Apple Video Mediensteuerung
Language                                 : English
Default                                  : No
JeromeMartinez commented 3 years ago

Please provide (in private if needed) few seconds of the h264 version, so I can say why it is flagged this way.

RalphMichel commented 3 years ago

Here the h264 file.

https://user-images.githubusercontent.com/33529884/119133110-cff97100-ba3b-11eb-85bb-ede48d265458.mp4

RalphMichel commented 2 years ago

I have now tried the same commands with ffmpeg 5.0 and get the same result as above. if you could try this for me with the last build, much appreciated. i send the file via mail as it is too big.

RalphMichel commented 2 years ago

Ok, but now I am even more confused. If I use the following command as before: ffmpeg -i 01_Kreis_.mov -c:v libx264 -preset veryslow -crf 18 -pix_fmt yuv420p -c:a aac out_EC_x264.mp4

It's in MediaInfo under Scan type Scan type: Progressive .However, when I play the video on the VLC player, the video plays interlaced.

out_EC_x264

If I use the following command: ffmpeg -i 01_Kreis_original_DV.mov -c:v libx264 -preset veryslow -crf 20 -flags +ildct+ilme -top 1 -c:a aac out_EC_x264_flags.mp4

It say the following under MediaInfo: Scan type: MBAFF; Scan type, store method: Interleaved fields; Scan order: Top Field First.

If I play the video via VLC Player, it plays progressiv. out_EC_x264_flags

From that I still can't be sure what is in Mediainfo and what finally the video player shows.

RalphMichel commented 2 years ago

However, when I play the video on the VLC player, the video plays interlaced.

This plays as progressive.

With which player does the video play progressive? With VLC, MPV and ffplay the video always plays interlaced for me.

If I play the video via VLC Player, it plays progressive.

This plays as interlaced. I suppose your display is not interlaced, so it deinterlaces it by default. ffplay will not do it, for example.

True. If I play this video with ffplay and mpv player, the video plays interlaced. Also saw that under VLC there is an option to turn off automatic deinterlacing. Thank you.

cjee21 commented 2 months ago

Ok, but now I am even more confused.

I'll explain this since I am not confused and this issue is still open.

If I use the following command as before: ffmpeg -i 01_Kreis_.mov -c:v libx264 -preset veryslow -crf 18 -pix_fmt yuv420p -c:a aac out_EC_x264.mp4

It's in MediaInfo under Scan type Scan type: Progressive .However, when I play the video on the VLC player, the video plays interlaced.

out_EC_x264

When you encode an interlaced video without adding interlaced flags, you are encoding it as progressive. So MediaInfo will show progressive which is correct and all players will play it back as progressive. You are seeing interlaced lines when playing back because you did not deinterlace when 'converting' it to progressive and the player's deinterlacer is not activated since it is playing it as progressive.

If I use the following command: ffmpeg -i 01_Kreis_original_DV.mov -c:v libx264 -preset veryslow -crf 20 -flags +ildct+ilme -top 1 -c:a aac out_EC_x264_flags.mp4

It say the following under MediaInfo: Scan type: MBAFF; Scan type, store method: Interleaved fields; Scan order: Top Field First.

If I play the video via VLC Player, it plays progressiv. out_EC_x264_flags

When you add interlaced flags, the video is encoded as interlaced which is correctly shown by MediaInfo. When played on any decent player, it will be played back as interlaced. You don't see any interlaced lines because any decent player will have deinterlaced it before displaying on a progressive PC monitor. The deinterlacer is active because the player detects and plays back the video as interlaced.

RalphMichel commented 1 month ago

@cjee21: Thanks for the explanation!