Log in

View Full Version : Can't encode interlaced "separate fields" video


Bahamuth
11th December 2019, 17:41
Hi everyone,

I have several files ripped from a disc which are strangely interlaced.

Video
ID : 1
ID in the original source medium : 4113 (0x1011)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4
Format settings : CABAC / 2 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 2 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 1 min 5 s
Bit rate mode : Variable
Bit rate : 3 838 kb/s
Width : 720 pixels
Height : 480 pixels
Display aspect ratio : 4:3
Original display aspect ratio : 4:3
Frame rate mode : Variable
Frame rate : 59.940 (60000/1001) FPS
Original frame rate : 29.970 (30000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan type, store method : Separated fields
Scan order : Bottom Field First
Bits/(Pixel*Frame) : 0.185
Stream size : 29.8 MiB (95%)
Language : English
Default : No
Forced : No
Original source medium : Blu-ray

These separated fields kill me. No matter which deinterlacing I choose (TDeInt, YadifMod, QTGMC), no matter if using Avisynth or VapourSynt, no matter if I don't set any deinterlacer at all, no matter if I set x264 options to stay Interlaced, Bottom Field First, the output file ALWAYS plays the video only in half speed, sometimes giving me two green bars on the bottom of the video as well. Audio works flawlessly.

What could cause this? As this example is just an advertisement, I uploaded it here (https://silentstrider.net/example.mkv).

I usually encode with Staxrip, but no matter what I set up yet, the result is crap. Interestingly with Handbrake I don't have that problem, but I personally dislike the handling of Handbrakes GUI.

Where could be my problem here? Which filter could I use in Staxrip to achieve the same thing?

Here's part of a handbrake log, showing decomb/deinterlace settings it found I think:
[17:21:50] * video track
[17:21:50] + decoder: h264
[17:21:50] + filters
[17:21:50] + Detelecine (pullup) ()
[17:21:50] + Comb Detect (mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:block-thresh=40:block-width=16:block-height=16)
[17:21:50] + Decomb (mode=39)

[17:22:01] comb detect: heavy 91 | light 233 | uncombed 1623 | total 1947
[17:22:01] decomb: deinterlaced 91 | blended 233 | unfiltered 1623 | total 1947

Cary Knoop
11th December 2019, 17:46
It's simple, the video is not interlaced.

Bahamuth
11th December 2019, 19:35
and why does Mediainfo tells me it is?

Cary Knoop
11th December 2019, 20:04
Because it says it does not automatically make it so. :)

videoh
11th December 2019, 20:46
@Bahamuth

You have to distinguish between how the video is encoded versus the actual content. The actual content can be progressive but encoded as interlaced. Presumably, MediaInfo reports on how the video is encoded.

Bahamuth
11th December 2019, 20:47
And how does it explain, that, if not using any deinterlacer, the video is still crap?

I just found out, if I add a AssumeFPS(source) anywhere in the script, then the file seems to be normal. So is it "just" the source frame rate which somehow isn't correctly used?

So I wonder if I used a deinterlacer on things that don't need deinterlacing before. All Blade 1, 2 and 3 Bonus extras from the BluRays are with that Separate Fields tag.

videoh
11th December 2019, 21:05
And how does it explain, that, if not using any deinterlacer, the video is still crap? Maybe you are clueless. Maybe StaxRip is screwing up. I have no problem making great video from your sample. But I don't use GUIs; I'm a pedal to the metal guy. :D

loadplugin("dgdecodenv.dll")
dgsource("example.dgi")

Bahamuth
11th December 2019, 23:20
So I am clueless, because two programs (Mediainfo obviously telling me a progressive video is interlaced (besides, ffmpeg states interlaced as well) and Staxrip utilizing Avisynth and Vapoursynth in a wrong way for the video) don't work the way they probably should? Okay...

Cary Knoop
11th December 2019, 23:31
Not sure what the remaining problem is, just re-encode the video without any bells and whistles and you are ready to go:

Something like this:

ffmpeg example.mkv -c:v libx264 -a:c -crf 18 result.mp4

Bahamuth
11th December 2019, 23:32
with some ffmpeg filter I found the following information:
Season One Volume Two.mkv:
[Parsed_idet_0 @ 00000284a7698a40] Repeated Fields: Neither: 1922 Top: 2 Bottom: 27
[Parsed_idet_0 @ 00000284a7698a40] Single frame detection: TFF: 0 BFF: 0 Progressive: 652 Undetermined: 1299
[Parsed_idet_0 @ 00000284a7698a40] Multi frame detection: TFF: 0 BFF: 0 Progressive: 1922 Undetermined: 29

I guess, Mediainfo just found the very few frames being Top or Bottom and assumed, it was interlaced. Evil...

videoh
12th December 2019, 00:35
You totally ignored the point about the difference between how a video is encoded and what the content actually is. That's what makes you clueless -- even when we tell you what is going on you don't take it on board.

Bahamuth
12th December 2019, 07:39
How about telling me how I should check this on a video file instead of just telling me that I'm clueless? Would help me much more than such comments.

FranceBB
12th December 2019, 07:53
@Bahamuth just like Donald said: you can have videos flagged as interlaced but with frames inside instead of fields. I noticed that you live in Germany, so you're in a PAL region just like me. Have you ever watched movies on TV? I bet you did. Every time you watched a movie, it almost definitely was 25p progressive flagged as interlaced. Why do we do this? Because the standard is interlaced and video servers expect it to be that way, but we can literally send progressive materials instead as long as we FLAG them as interlaced. In other words, it's just a flag, you don't really have to deinterlace anything. What happens if you deinterlace it anyway? Like blindly bobbing it? Well, there are no fields, so each "field" correspond to the same frame; in other words, nothing will happen other than duplicating 25 frames every second to get a fake 50p full of dups.

That's it really.
In other words, media info is fine, but when it comes to interlacing always index your source and look at it frame by frame with your eyes via AVSPmod.

videoh
12th December 2019, 14:37
How about telling me how I should check this on a video file instead of just telling me that I'm clueless? Would help me much more than such comments. Happy to oblige:

http://rationalqm.us/faq.html

Bahamuth
13th December 2019, 01:26
Just an hour ago I found the problem for the slow video result. FFMS2 used from StaxRip2 was the reason. Using the latest official version makes everything right with my video.

@videoh: thanks for the link, will take a look at it.

One more question: I'm watching TV over cable. The signal is supposed to be 576i. But when I use ffmpeg with idet filter and check all frames, I get the following:
[Parsed_idet_0 @ 0000026d78ef87c0] Repeated Fields: Neither: 29573 Top: 7 Bottom: 38
[Parsed_idet_0 @ 0000026d78ef87c0] Single frame detection: TFF: 213 BFF: 8 Progressive: 10928 Undetermined: 18469
[Parsed_idet_0 @ 0000026d78ef87c0] Multi frame detection: TFF: 744 BFF: 0 Progressive: 28874 Undetermined: 0

Wouldn't that mean, that the video itself is rather progressive, when only like 2.5% of the video has interlaced frames?

nevcairiel
13th December 2019, 10:35
Wouldn't that mean, that the video itself is rather progressive, when only like 2.5% of the video has interlaced frames?

Its a progressive video, and the 2.5% are either misdetections or an interlaced overlay, which broadcast does sometimes do.

FranceBB
13th December 2019, 22:32
or interlaced overlay, which broadcast does sometimes do.

Yep, I hate when it happens, but most of the time it's really just that the main feed is progressive and it's the video mixer (like Vizrt in my case) (https://www.vizrt.com/products/viz-mosart) that overlays something interlaced like credits moving from a part to the other of the screen at the very bottom just before a program ends. In other words, we have no control over that. Most TVs handle it nicely though, so it's not a big deal.

Bahamuth
15th December 2019, 02:00
So I could use that way to automatically check (e.g. via batch file) if a video file is Interlaced or Progressive and might need Deinterlacing or not? Because Deinterlacing a progressive video is something bad I think.

A truely Interlaced video probably has high percentages in the TFF and BFF values.

Cary Knoop
15th December 2019, 03:34
Bahamuth, just put the video into something like VirtualDub and step through some frames. A simple visual inspection can tell you if you deal with progressive, interlaced or telecined footage.

videoh
15th December 2019, 18:24
I already suggested that to Bahamuth and gave a link to instructions for doing that. He seems uninterested and wants to put his faith in automated methods. This is misguided because 1) flagging does not necessarily match the content, and 2) if you actually look for combing you are relying on heuristics that are not always correct. I suppose hope springs eternal and one has to find things out the hard way.

Bahamuth
15th December 2019, 20:43
@videoh:
I started writing an answer like five times now and always had to delete it again. Your answers feel to me like the "Use Linux" answer, when someone has a Windows problem. It's not helping at all. Since November I encoded around 4000 video files. Who is giving me the time back I would need for every little file to check it manually about their interlacing? Right, nobody. Not you, not someone else. I'm already working for months at digitalizing all my DVDs and BluRays because I also rip any extras on the discs. And being a perfectionist, I absolutely hate doing things more than once, which I have to do when things are messing up.

I'm asking for an answer and not so I have to study video things for 20 years to answer it myself. Come down from your high horse.

videoh
16th December 2019, 01:33
Nobody can give you back time that you wasted. At least you can start doing things correctly going forward.

Come down from your high horse. Yeah, that will motivate me to help you. ;)

Taurus
16th December 2019, 12:25
@Bahamuth:
C'mon, there are people tying to help you and you put them into trash?!
The only reliable way to determine if a video is interlaced or progressive
is the one videoh is showing you.
Never ever trust mediainfo or any other tool (decoders, etc.) on this.
They just show you infos written somewhere in the stream.
Without manual inspection by eyesight you wont get anywhere (like in real life).
And make sure the field order is correct...on interlaced video.

Sharc
16th December 2019, 13:03
^^^
100% agree.