Log in

View Full Version : Reading 4:2:0 (PAL) interlaced video with ffmpeg


jaa101
19th January 2026, 13:19
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+.

wonkey_monkey
19th January 2026, 13:29
You say "looks like"; what is your complete script, and how are you viewing the result?

Selur
19th January 2026, 16:32
Any suggestions?
configure the encoder, by default x264 is used and unless you configure it to encode interlaced, it will create progressive output.
try: -flags +ilme+ildct -x264opts tff=1 tff=1 if it's tff, tff=0 if it's bff

StainlessS
19th January 2026, 17:42
Is this not the type of thing where DGIndex/DgDecode.dll::[ Mpeg2Source() ] + Tfm() is of use,


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.

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.