Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th January 2026, 13:19   #1  |  Link
jaa101
Registered User
 
Join Date: Feb 2021
Posts: 2
Reading 4:2:0 (PAL) interlaced video with ffmpeg

I have an MKV file with MPEG2 content from a PAL DVD, so it's 4:2:0. I can read it into AviSynth+ using FFMPEGSource2, so ffmpeg is used. Each interlaced field is a separate image, with two images per frame.

Some scenes cut in the middle of a frame, so the first field of that frame is from one scene and the second field from the next. It looks like ffmpeg is decoding both 4:2:0 fields and combining them into a 4:2:0 frame. 4:2:0 Chroma subsampling shares the colour information across two rows, so now the even and odd rows share their colours, and there's no way to cleanly separate the fields. In the source file, each field is separate so they don't have this issue, but I can't make ffmpeg avoid this problem. I've tried:

ffmpeg -i src.mkv -flags +ilme+ildct -pix_fmt yuv422p10le src-422.mp4

to upgrade to 4:2:2 subsampling (which doesn't share chroma across rows) but it still has the same problem. Seems like ffmpeg has no way read interlaced 4:2:0 content without smudging the chroma across the fields. Any suggestions?

My current work-around is to re-encode the file into a 4:2:2 format using the Adobe Media Encoder, and this works fine, but it's harder to automate. I've tried using VirtualDub2 but, of course, it has the same problem as AviSynth+.
jaa101 is offline   Reply With Quote
Old 19th January 2026, 13:29   #2  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,812
You say "looks like"; what is your complete script, and how are you viewing the result?
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 19th January 2026, 16:32   #3  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,853
Quote:
Any suggestions?
configure the encoder, by default x264 is used and unless you configure it to encode interlaced, it will create progressive output.
try:
Code:
-flags +ilme+ildct -x264opts tff=1
tff=1 if it's tff, tff=0 if it's bff
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Old 19th January 2026, 17:42   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,406
Is this not the type of thing where DGIndex/DgDecode.dll::[ Mpeg2Source() ] + Tfm() is of use,

Code:
VideoFileName=".\test.mpg"
Video = Mpeg2Source(VideoFileName)
Video = Video.TFM(d2v=VideoFileName)  # + other TFM args.
I personally would prefer to use DgDecode (Mpeg2Source) pretty much all of the time for MPG/VOB.

EDIT: And LSmashVideoSource all of the time for ISO files eg x264 mp4.

EDIT: From TIVTC::TFM docs.
Code:
A.)  GENERAL INFO:


      Supports 8-16 bit Y, planar YUV (4:1:1, 4:2:0, 4:2:2, 4:4:4) and YUY2 colorspaces.

      TFM is a field matching filter that recovers the original progressive frames from a
   telecined stream.  It does not decimate the resulting duplicate frames though, so to
   achieve an ivtc you must follow TFM with a decimation filter such as TDecimate(), which
   is also included in the TIVTC dll.


   syntax=>

       TFM(int order, int field, int mode, int PP. string ovr, string input, string output,
            string outputC, bool debug, bool display, int slow, bool mChroma, int cNum,
            int cthresh, int MI, bool chroma, int blockx, int blocky, int y0, int y1,
            int mthresh, PClip clip2, string d2v, int ovrDefault, int flags, double scthresh,
            int micout, int micmatching, string trimIn, int hint, int metric, bool batch,
            bool ubsco, bool mmsco, int opt)


      While TFM does have quite a few parameters, I have tried to categorize the settings so
   they are easier to manage.  Really there are only 3 parameters most users should be
   concerned about knowing or ever setting.  They are "order", "mode", and "PP" and are
   described under the "BASIC PARAMETERS" sections.  The other settings are described under
   the other various sections which should be pretty easy to figure out from the names.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 19th January 2026 at 17:53.
StainlessS is offline   Reply With Quote
Reply

Tags
ffmpeg, interlaced, interlaced video, pal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:07.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.