{
 "title": "Deinterlacing and field order: measured on a synthetic 25i clip with a moving marker",
 "ffmpeg_version": "ffmpeg version 8.1.1-full_build-www.gyan.dev Copyright (c) 2000-2026 the FFmpeg developers",
 "machine": "One Windows 11 laptop; FFmpeg run with -threads 4",
 "scope": "One synthetic 640x360 source. Real camcorder or broadcast footage, other deinterlacers (QTGMC, hardware, NLE built-ins) and playback devices were not tested.",
 "source_commands": {
  "src50p.mkv (ground truth, 300 frames)": "ffmpeg -threads 4 -f lavfi -i testsrc2=s=640x360:r=50:d=6 -f lavfi -i color=c=white:s=12x40:r=50:d=6 -filter_complex \"[0]drawbox=x=0:y=304:w=640:h=56:color=black:t=fill[bg];[bg][1]overlay=x='mod(8*n,620)':y=312:eval=frame,format=yuv420p\" -c:v ffv1 src50p.mkv",
  "tff25i.mkv (150 frames)": "ffmpeg -threads 4 -i src50p.mkv -vf \"tinterlace=mode=interleave_top,setfield=tff\" -c:v libx264 -qp 0 -preset medium -flags +ildct+ilme -x264-params tff=1 -r 25 tff25i.mkv",
  "bff25i.mkv (150 frames)": "ffmpeg -threads 4 -i src50p.mkv -vf \"tinterlace=mode=interleave_bottom,setfield=bff\" -c:v libx264 -qp 0 -preset medium -flags +ildct+ilme -x264-params bff=1 -r 25 bff25i.mkv",
  "prog25p.mkv (150 frames)": "ffmpeg -threads 4 -i src50p.mkv -vf \"select='not(mod(n,2))',setpts=N/25/TB,setfield=prog\" -r 25 -c:v libx264 -qp 0 prog25p.mkv"
 },
 "note_on_tags": "ffprobe reported the MKV field_order as tb/bt while the decoded frames carried the expected flags (TFF master: interlaced=1, top_field_first=1; BFF master: top_field_first=0). The MP4 stream copy reports tt. Not investigated further.",
 "idet_command": "ffmpeg -i X.mkv -vf idet -an -f null -",
 "idet_output_full_frame": [
  "== tff25i",
  "Repeated Fields: Neither:     0 Top:     0 Bottom:     0",
  "Single frame detection: TFF:     0 BFF:     0 Progressive:     0 Undetermined:     0",
  "Multi frame detection: TFF:     0 BFF:     0 Progressive:     0 Undetermined:     0",
  "Repeated Fields: Neither:   150 Top:     0 Bottom:     0",
  "Single frame detection: TFF:   150 BFF:     0 Progressive:     0 Undetermined:     0",
  "Multi frame detection: TFF:   150 BFF:     0 Progressive:     0 Undetermined:     0",
  "== bff25i",
  "Repeated Fields: Neither:     0 Top:     0 Bottom:     0",
  "Single frame detection: TFF:     0 BFF:     0 Progressive:     0 Undetermined:     0",
  "Multi frame detection: TFF:     0 BFF:     0 Progressive:     0 Undetermined:     0",
  "Repeated Fields: Neither:   150 Top:     0 Bottom:     0",
  "Single frame detection: TFF:     0 BFF:   150 Progressive:     0 Undetermined:     0",
  "Multi frame detection: TFF:     0 BFF:   150 Progressive:     0 Undetermined:     0",
  "== prog25p",
  "Repeated Fields: Neither:     0 Top:     0 Bottom:     0",
  "Single frame detection: TFF:     0 BFF:     0 Progressive:     0 Undetermined:     0",
  "Multi frame detection: TFF:     0 BFF:     0 Progressive:     0 Undetermined:     0",
  "Repeated Fields: Neither:   150 Top:     0 Bottom:     0",
  "Single frame detection: TFF:    82 BFF:    48 Progressive:    20 Undetermined:     0",
  "Multi frame detection: TFF:    85 BFF:    45 Progressive:    20 Undetermined:     0"
 ],
 "idet_extra": {
  "prog25p_marker_band_only": {
   "command": "ffmpeg -hide_banner -threads 4 -i prog25p.mkv -vf crop=640:56:0:304,idet -an -f null -",
   "idet_summary": [
    "Repeated Fields: Neither:     0 Top:     0 Bottom:     0",
    "Single frame detection: TFF:     0 BFF:     0 Progressive:     0 Undetermined:     0",
    "Multi frame detection: TFF:     0 BFF:     0 Progressive:     0 Undetermined:     0",
    "Repeated Fields: Neither:   150 Top:     0 Bottom:     0",
    "Single frame detection: TFF:     0 BFF:     0 Progressive:   150 Undetermined:     0",
    "Multi frame detection: TFF:     0 BFF:     0 Progressive:   150 Undetermined:     0"
   ]
  },
  "tff25i_marker_band_only": {
   "command": "ffmpeg -hide_banner -threads 4 -i tff25i.mkv -vf crop=640:56:0:304,idet -an -f null -",
   "idet_summary": [
    "Repeated Fields: Neither:     0 Top:     0 Bottom:     0",
    "Single frame detection: TFF:     0 BFF:     0 Progressive:     0 Undetermined:     0",
    "Multi frame detection: TFF:     0 BFF:     0 Progressive:     0 Undetermined:     0",
    "Repeated Fields: Neither:   150 Top:     0 Bottom:     0",
    "Single frame detection: TFF:   150 BFF:     0 Progressive:     0 Undetermined:     0",
    "Multi frame detection: TFF:   150 BFF:     0 Progressive:     0 Undetermined:     0"
   ]
  },
  "src50p_full_frame": {
   "command": "ffmpeg -hide_banner -threads 4 -i src50p.mkv -vf idet -an -f null -",
   "idet_summary": [
    "Repeated Fields: Neither:     0 Top:     0 Bottom:     0",
    "Single frame detection: TFF:     0 BFF:     0 Progressive:     0 Undetermined:     0",
    "Multi frame detection: TFF:     0 BFF:     0 Progressive:     0 Undetermined:     0",
    "Repeated Fields: Neither:   300 Top:     0 Bottom:     0",
    "Single frame detection: TFF:   169 BFF:   104 Progressive:    25 Undetermined:     2",
    "Multi frame detection: TFF:   172 BFF:   101 Progressive:    27 Undetermined:     0"
   ]
  }
 },
 "variant_command": "ffmpeg -threads 4 -i INPUT.mkv -vf FILTER -c:v ffv1 out/VARIANT.mkv (no -vf for the no-filter rows)",
 "measurement_definitions": {
  "marker_x": "mean over rows 312-351 of the luma-weighted column centroid of pixels > 128",
  "step": "difference of marker_x between consecutive output frames, wrapped into (-310, 310] (marker wraps every 620 px); source moves 8 px per 20 ms",
  "field_split": "|centroid of even rows - centroid of odd rows| in the marker rows",
  "comb": "mean |Y[y] - (Y[y-1]+Y[y+1])/2| in 8-bit levels, full frame and rows 305-358",
  "psnr": "luma PSNR, MSE pooled over all frames, against the matching 50p source frames"
 },
 "variants": [
  {
   "variant": "interlaced_tff_no_filter",
   "input": "tff25i.mkv",
   "filter": "(none)",
   "output_frames": 150,
   "output_frame_rate": "25/1",
   "output_field_order_tag": "tb",
   "step_px_mean": 11.839,
   "step_px_std": 35.674,
   "step_px_min": -294.0,
   "step_px_max": 16.0,
   "backward_steps": 2,
   "marker_field_split_px_mean": 12.027,
   "comb_full_frame": 3.162,
   "comb_marker_band_rows_305_358": 4.797,
   "reference_comb_full_frame": 1.566,
   "reference_comb_marker_band": 0.177,
   "psnr_luma_db_vs_matching_source_frames": 26.09,
   "first_8_marker_x": [
    17.5,
    33.5,
    49.5,
    65.5,
    81.5,
    97.5,
    113.5,
    129.5
   ]
  },
  {
   "variant": "tff_yadif_mode0",
   "input": "tff25i.mkv",
   "filter": "yadif=mode=0",
   "output_frames": 150,
   "output_frame_rate": "25/1",
   "output_field_order_tag": "progressive",
   "step_px_mean": 16.0,
   "step_px_std": 0.0,
   "step_px_min": 16.0,
   "step_px_max": 16.0,
   "backward_steps": 0,
   "marker_field_split_px_mean": 0.0,
   "comb_full_frame": 1.24,
   "comb_marker_band_rows_305_358": 0.118,
   "reference_comb_full_frame": 1.566,
   "reference_comb_marker_band": 0.177,
   "psnr_luma_db_vs_matching_source_frames": 33.82,
   "first_8_marker_x": [
    13.5,
    29.5,
    45.5,
    61.5,
    77.5,
    93.5,
    109.5,
    125.5
   ]
  },
  {
   "variant": "tff_yadif_mode1",
   "input": "tff25i.mkv",
   "filter": "yadif=mode=1",
   "output_frames": 300,
   "output_frame_rate": "50/1",
   "output_field_order_tag": "progressive",
   "step_px_mean": 8.0,
   "step_px_std": 0.0,
   "step_px_min": 8.0,
   "step_px_max": 8.0,
   "backward_steps": 0,
   "marker_field_split_px_mean": 0.0,
   "comb_full_frame": 1.241,
   "comb_marker_band_rows_305_358": 0.138,
   "reference_comb_full_frame": 1.564,
   "reference_comb_marker_band": 0.177,
   "psnr_luma_db_vs_matching_source_frames": 33.85,
   "first_8_marker_x": [
    13.5,
    21.5,
    29.5,
    37.5,
    45.5,
    53.5,
    61.5,
    69.5
   ]
  },
  {
   "variant": "tff_bwdif_mode0",
   "input": "tff25i.mkv",
   "filter": "bwdif=mode=0",
   "output_frames": 150,
   "output_frame_rate": "25/1",
   "output_field_order_tag": "progressive",
   "step_px_mean": 16.0,
   "step_px_std": 0.0,
   "step_px_min": 16.0,
   "step_px_max": 16.0,
   "backward_steps": 0,
   "marker_field_split_px_mean": 0.0,
   "comb_full_frame": 1.124,
   "comb_marker_band_rows_305_358": 0.094,
   "reference_comb_full_frame": 1.566,
   "reference_comb_marker_band": 0.177,
   "psnr_luma_db_vs_matching_source_frames": 34.53,
   "first_8_marker_x": [
    13.5,
    29.5,
    45.5,
    61.5,
    77.5,
    93.5,
    109.5,
    125.5
   ]
  },
  {
   "variant": "tff_bwdif_mode1",
   "input": "tff25i.mkv",
   "filter": "bwdif=mode=1",
   "output_frames": 300,
   "output_frame_rate": "50/1",
   "output_field_order_tag": "progressive",
   "step_px_mean": 8.0,
   "step_px_std": 0.0,
   "step_px_min": 8.0,
   "step_px_max": 8.0,
   "backward_steps": 0,
   "marker_field_split_px_mean": 0.0,
   "comb_full_frame": 1.125,
   "comb_marker_band_rows_305_358": 0.113,
   "reference_comb_full_frame": 1.564,
   "reference_comb_marker_band": 0.177,
   "psnr_luma_db_vs_matching_source_frames": 34.52,
   "first_8_marker_x": [
    13.5,
    21.5,
    29.5,
    37.5,
    45.5,
    53.5,
    61.5,
    69.5
   ]
  },
  {
   "variant": "tff_yadif_mode1_wrong_parity_bff",
   "input": "tff25i.mkv",
   "filter": "yadif=mode=1:parity=bff",
   "output_frames": 300,
   "output_frame_rate": "50/1",
   "output_field_order_tag": "progressive",
   "step_px_mean": 7.946,
   "step_px_std": 16.0,
   "step_px_min": -8.0,
   "step_px_max": 24.0,
   "backward_steps": 150,
   "marker_field_split_px_mean": 0.0,
   "comb_full_frame": 1.202,
   "comb_marker_band_rows_305_358": 0.138,
   "reference_comb_full_frame": 1.564,
   "reference_comb_marker_band": 0.177,
   "psnr_luma_db_vs_matching_source_frames": 23.23,
   "first_8_marker_x": [
    21.5,
    13.5,
    37.5,
    29.5,
    53.5,
    45.5,
    69.5,
    61.5
   ]
  },
  {
   "variant": "tff_bwdif_mode1_wrong_parity_bff",
   "input": "tff25i.mkv",
   "filter": "bwdif=mode=1:parity=bff",
   "output_frames": 300,
   "output_frame_rate": "50/1",
   "output_field_order_tag": "progressive",
   "step_px_mean": 7.946,
   "step_px_std": 16.0,
   "step_px_min": -8.0,
   "step_px_max": 24.0,
   "backward_steps": 150,
   "marker_field_split_px_mean": 0.0,
   "comb_full_frame": 1.092,
   "comb_marker_band_rows_305_358": 0.111,
   "reference_comb_full_frame": 1.564,
   "reference_comb_marker_band": 0.177,
   "psnr_luma_db_vs_matching_source_frames": 23.2,
   "first_8_marker_x": [
    21.5,
    13.5,
    37.5,
    29.5,
    53.5,
    45.5,
    69.5,
    61.5
   ]
  },
  {
   "variant": "bff_yadif_mode1_auto",
   "input": "bff25i.mkv",
   "filter": "yadif=mode=1",
   "output_frames": 300,
   "output_frame_rate": "50/1",
   "output_field_order_tag": "progressive",
   "step_px_mean": 8.0,
   "step_px_std": 0.0,
   "step_px_min": 8.0,
   "step_px_max": 8.0,
   "backward_steps": 0,
   "marker_field_split_px_mean": 0.0,
   "comb_full_frame": 1.241,
   "comb_marker_band_rows_305_358": 0.138,
   "reference_comb_full_frame": 1.564,
   "reference_comb_marker_band": 0.177,
   "psnr_luma_db_vs_matching_source_frames": 33.87,
   "first_8_marker_x": [
    13.5,
    21.5,
    29.5,
    37.5,
    45.5,
    53.5,
    61.5,
    69.5
   ]
  },
  {
   "variant": "progressive_no_filter",
   "input": "prog25p.mkv",
   "filter": "(none)",
   "output_frames": 150,
   "output_frame_rate": "25/1",
   "output_field_order_tag": "progressive",
   "step_px_mean": 16.0,
   "step_px_std": 0.0,
   "step_px_min": 16.0,
   "step_px_max": 16.0,
   "backward_steps": 0,
   "marker_field_split_px_mean": 0.0,
   "comb_full_frame": 1.566,
   "comb_marker_band_rows_305_358": 0.177,
   "reference_comb_full_frame": 1.566,
   "reference_comb_marker_band": 0.177,
   "psnr_luma_db_vs_matching_source_frames": "identical",
   "first_8_marker_x": [
    13.5,
    29.5,
    45.5,
    61.5,
    77.5,
    93.5,
    109.5,
    125.5
   ]
  },
  {
   "variant": "progressive_yadif_mode0_deint_all",
   "input": "prog25p.mkv",
   "filter": "yadif=mode=0",
   "output_frames": 150,
   "output_frame_rate": "25/1",
   "output_field_order_tag": "progressive",
   "step_px_mean": 16.0,
   "step_px_std": 0.0,
   "step_px_min": 16.0,
   "step_px_max": 16.0,
   "backward_steps": 0,
   "marker_field_split_px_mean": 0.0,
   "comb_full_frame": 1.226,
   "comb_marker_band_rows_305_358": 0.118,
   "reference_comb_full_frame": 1.566,
   "reference_comb_marker_band": 0.177,
   "psnr_luma_db_vs_matching_source_frames": 34.58,
   "first_8_marker_x": [
    13.5,
    29.5,
    45.5,
    61.5,
    77.5,
    93.5,
    109.5,
    125.5
   ]
  },
  {
   "variant": "progressive_bwdif_mode0_deint_all",
   "input": "prog25p.mkv",
   "filter": "bwdif=mode=0",
   "output_frames": 150,
   "output_frame_rate": "25/1",
   "output_field_order_tag": "progressive",
   "step_px_mean": 16.0,
   "step_px_std": 0.0,
   "step_px_min": 16.0,
   "step_px_max": 16.0,
   "backward_steps": 0,
   "marker_field_split_px_mean": 0.0,
   "comb_full_frame": 1.134,
   "comb_marker_band_rows_305_358": 0.096,
   "reference_comb_full_frame": 1.566,
   "reference_comb_marker_band": 0.177,
   "psnr_luma_db_vs_matching_source_frames": 35.34,
   "first_8_marker_x": [
    13.5,
    29.5,
    45.5,
    61.5,
    77.5,
    93.5,
    109.5,
    125.5
   ]
  },
  {
   "variant": "progressive_yadif_mode0_deint_interlaced",
   "input": "prog25p.mkv",
   "filter": "yadif=mode=0:deint=interlaced",
   "output_frames": 150,
   "output_frame_rate": "25/1",
   "output_field_order_tag": "progressive",
   "step_px_mean": 16.0,
   "step_px_std": 0.0,
   "step_px_min": 16.0,
   "step_px_max": 16.0,
   "backward_steps": 0,
   "marker_field_split_px_mean": 0.0,
   "comb_full_frame": 1.566,
   "comb_marker_band_rows_305_358": 0.177,
   "reference_comb_full_frame": 1.566,
   "reference_comb_marker_band": 0.177,
   "psnr_luma_db_vs_matching_source_frames": "identical",
   "first_8_marker_x": [
    13.5,
    29.5,
    45.5,
    61.5,
    77.5,
    93.5,
    109.5,
    125.5
   ]
  },
  {
   "variant": "progressive_yadif_mode1_deint_all",
   "input": "prog25p.mkv",
   "filter": "yadif=mode=1",
   "output_frames": 300,
   "output_frame_rate": "50/1",
   "output_field_order_tag": "progressive",
   "step_px_mean": 7.973,
   "step_px_std": 8.0,
   "step_px_min": 0.0,
   "step_px_max": 16.0,
   "backward_steps": 0,
   "marker_field_split_px_mean": 0.0,
   "comb_full_frame": 1.227,
   "comb_marker_band_rows_305_358": 0.137,
   "reference_comb_full_frame": 1.566,
   "reference_comb_marker_band": 0.177,
   "psnr_luma_db_vs_matching_source_frames": 34.61,
   "first_8_marker_x": [
    13.5,
    13.5,
    29.5,
    29.5,
    45.5,
    45.5,
    61.5,
    61.5
   ]
  }
 ],
 "published_sample_commands": [
  {
   "file": "deint-tff-25i-lossless.mp4",
   "command": "ffmpeg -hide_banner -loglevel error -y -threads 4 -i tff25i.mkv -c copy -movflags +faststart C:/Users/VINAYS~1/AppData/Local/Temp/claude/ff9c4ba2d603118b/d7d5255a-edd7-4c18-a052-ec2693b2f5b4/scratchpad/aac-deint\\pub\\deint-tff-25i-lossless.mp4"
  },
  {
   "file": "deint-bwdif-send-field-50p.mp4",
   "command": "ffmpeg -hide_banner -loglevel error -y -threads 4 -i tff25i.mkv -vf bwdif=mode=1 -c:v libx264 -preset medium -crf 20 -pix_fmt yuv420p -movflags +faststart C:/Users/VINAYS~1/AppData/Local/Temp/claude/ff9c4ba2d603118b/d7d5255a-edd7-4c18-a052-ec2693b2f5b4/scratchpad/aac-deint\\pub\\deint-bwdif-send-field-50p.mp4"
  },
  {
   "file": "deint-wrong-field-order-50p.mp4",
   "command": "ffmpeg -hide_banner -loglevel error -y -threads 4 -i tff25i.mkv -vf yadif=mode=1:parity=bff -c:v libx264 -preset medium -crf 20 -pix_fmt yuv420p -movflags +faststart C:/Users/VINAYS~1/AppData/Local/Temp/claude/ff9c4ba2d603118b/d7d5255a-edd7-4c18-a052-ec2693b2f5b4/scratchpad/aac-deint\\pub\\deint-wrong-field-order-50p.mp4"
  }
 ],
 "published_sample_note": "The two 50p MP4 downloads are re-encoded at CRF 20 so they stay small. All measurements were made on the lossless FFV1 outputs, not on these MP4s.",
 "figures": {
  "deint-crops": "3x nearest-neighbour crops, x 120-344, y 246-358: interlaced frame 12; yadif mode=1, bwdif mode=1 and wrong-parity yadif output frame 24 (deint_figures.py)",
  "deint-marker-steps": "measured marker_x for the first 16 output frames (deint_figures.py)"
 },
 "scripts": [
  "deint_measure.py",
  "deint_figures.py"
 ],
 "published_files": [
  {
   "file": "deint-tff-25i-lossless.mp4",
   "url": "/assets/deint-tff-25i-lossless.mp4",
   "bytes": 2286035,
   "sha256": "e9e8b2c996ddd2524a4ffc3103b7e2543672ea5835817b4cf83e54f2120d6f4b"
  },
  {
   "file": "deint-bwdif-send-field-50p.mp4",
   "url": "/assets/deint-bwdif-send-field-50p.mp4",
   "bytes": 1244151,
   "sha256": "47514c433fb6b9193049f84afa267ec4559f407b0247f8e096d4a9f0b0e69c21"
  },
  {
   "file": "deint-wrong-field-order-50p.mp4",
   "url": "/assets/deint-wrong-field-order-50p.mp4",
   "bytes": 1314652,
   "sha256": "c7dd8964406cd487594ea2a9208f7f29bedfb3410b7153e47a3289e0377b723d"
  },
  {
   "file": "deint-crops.webp",
   "url": "/assets/deint-crops.webp",
   "bytes": 19520,
   "sha256": "b48a306b5833e6b89425a6089ee53bfdf09395c2315c41ba5d5c6f119d68904a"
  },
  {
   "file": "deint-crops.png",
   "url": "/assets/deint-crops.png",
   "bytes": 18553,
   "sha256": "1d94f8a8031f8838b85c7a53db8403f5acee2ecae0d5d321fa3861c9c9f77d5e"
  },
  {
   "file": "deint-marker-steps.webp",
   "url": "/assets/deint-marker-steps.webp",
   "bytes": 56208,
   "sha256": "786d13d54ebc5fd9c14bb5e8c4ba90116e6e1d67f58a0e00c6c9868a49fe1f2c"
  },
  {
   "file": "deint-marker-steps.png",
   "url": "/assets/deint-marker-steps.png",
   "bytes": 110322,
   "sha256": "711f0fd013d3af791cdb6ac78075a6aceb6223900a945e625a342f94fcf85462"
  }
 ]
}