[FFmpeg-user] How to interpret the result of idet filter?

Wesley Wen delbin.wen at gmail.com
Wed Mar 11 17:19:23 CET 2015


Hi,

We're using idet filter to detect interlaced video. Here are the command
and output.

00:08 $ ffmpeg -vf idet -frames:v 1000 -an -f rawvideo -y /dev/null -i
~/Downloads/clip.mpg
ffmpeg version git-2015-02-12-cac2295 Copyright (c) 2000-2015 the FFmpeg
developers
  built with Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared
--enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables
--enable-avresample --cc=clang --host-cflags= --host-ldflags=
--enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid
--enable-libfaac --enable-ffplay --enable-libfdk-aac --enable-libx265
--enable-nonfree --enable-vda
  libavutil      54. 18.100 / 54. 18.100
  libavcodec     56. 21.102 / 56. 21.102
  libavformat    56. 19.101 / 56. 19.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 10.100 /  5. 10.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mpeg, from '/Users/wesleywen/Downloads/clip.mpg':
  Duration: 00:46:02.66, start: 0.239800, bitrate: 9240 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR
8:9 DAR 4:3], 8000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s
Output #0, rawvideo, to '/dev/null':
  Metadata:
    encoder         : Lavf56.19.101
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x480 [SAR
8:9 DAR 4:3], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc56.21.102 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> rawvideo (native))
Press [q] to stop, [?] for help
frame= 1000 fps=736 q=0.0 Lsize=  506250kB time=00:00:33.36
bitrate=124291.7kbits/s
video:506250kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.000000%
[Parsed_idet_0 @ 0x7fd6bb422560] Repeated Fields: Neither:  1001 Top:     0
Bottom:     0
[Parsed_idet_0 @ 0x7fd6bb422560] Single frame detection: TFF:    58 BFF:
 42 Progressive:   463 Undetermined:   438
[Parsed_idet_0 @ 0x7fd6bb422560] Multi frame detection: TFF:     9 BFF:
0 Progressive:   991 Undetermined:     1

If the number of TFF or BFF (of Multi frame detection) is larger than
Progressive, we think the target video is interlaced. Is this correct?

The above criterion worked quite well on most case. But today we
mis-interpret a video as progressive. If you look at above numbers, 991 is
larger than 9, and therefore we think the video is progressive, but it's
not.

Here are the output if we increase vframes to 2000 and 5000.
00:08 $ ffmpeg -vf idet -frames:v 2000 -an -f rawvideo -y /dev/null -i
~/Downloads/clip.mpg
ffmpeg version git-2015-02-12-cac2295 Copyright (c) 2000-2015 the FFmpeg
developers
  built with Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared
--enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables
--enable-avresample --cc=clang --host-cflags= --host-ldflags=
--enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid
--enable-libfaac --enable-ffplay --enable-libfdk-aac --enable-libx265
--enable-nonfree --enable-vda
  libavutil      54. 18.100 / 54. 18.100
  libavcodec     56. 21.102 / 56. 21.102
  libavformat    56. 19.101 / 56. 19.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 10.100 /  5. 10.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mpeg, from '/Users/wesleywen/Downloads/clip.mpg':
  Duration: 00:46:02.66, start: 0.239800, bitrate: 9240 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR
8:9 DAR 4:3], 8000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s
Output #0, rawvideo, to '/dev/null':
  Metadata:
    encoder         : Lavf56.19.101
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x480 [SAR
8:9 DAR 4:3], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc56.21.102 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> rawvideo (native))
Press [q] to stop, [?] for help
frame= 2000 fps=653 q=0.0 Lsize= 1012500kB time=00:01:06.73
bitrate=124291.7kbits/s
video:1012500kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.000000%
[Parsed_idet_0 @ 0x7fad4bd004e0] Repeated Fields: Neither:  1820 Top:    95
Bottom:    86
[Parsed_idet_0 @ 0x7fad4bd004e0] Single frame detection: TFF:   662 BFF:
 42 Progressive:   617 Undetermined:   680
[Parsed_idet_0 @ 0x7fad4bd004e0] Multi frame detection: TFF:   963 BFF:
0 Progressive:  1037 Undetermined:     1

00:13 $ ffmpeg -vf idet -frames:v 5000 -an -f rawvideo -y /dev/null -i
~/Downloads/clip.mpg
ffmpeg version git-2015-02-12-cac2295 Copyright (c) 2000-2015 the FFmpeg
developers
  built with Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared
--enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables
--enable-avresample --cc=clang --host-cflags= --host-ldflags=
--enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid
--enable-libfaac --enable-ffplay --enable-libfdk-aac --enable-libx265
--enable-nonfree --enable-vda
  libavutil      54. 18.100 / 54. 18.100
  libavcodec     56. 21.102 / 56. 21.102
  libavformat    56. 19.101 / 56. 19.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 10.100 /  5. 10.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mpeg, from '/Users/wesleywen/Downloads/clip.mpg':
  Duration: 00:46:02.66, start: 0.239800, bitrate: 9240 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR
8:9 DAR 4:3], 8000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s
Output #0, rawvideo, to '/dev/null':
  Metadata:
    encoder         : Lavf56.19.101
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x480 [SAR
8:9 DAR 4:3], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc56.21.102 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> rawvideo (native))
Press [q] to stop, [?] for help
frame= 5000 fps=706 q=0.0 Lsize= 2531250kB time=00:02:46.83
bitrate=124291.7kbits/s
video:2531250kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.000000%
[Parsed_idet_0 @ 0x7fa230e13ae0] Repeated Fields: Neither:  4405 Top:   314
Bottom:   282
[Parsed_idet_0 @ 0x7fa230e13ae0] Single frame detection: TFF:  2698 BFF:
 46 Progressive:  1014 Undetermined:  1243
[Parsed_idet_0 @ 0x7fa230e13ae0] Multi frame detection: TFF:  3963 BFF:
0 Progressive:  1037 Undetermined:     1

If you look at the result of them, we could conclude the video is
interlaced. What I'm interested is -frames:v 2000 and 5000 both report 1037
progressive frames, does it mean the content is progressive/interlaced
mixed? I did not get a chance to look at the frames with video analyzer
yet. But I believe the video is interlaced by viewing it with VLC; there is
combing noise if deinterlacer is turned off.

Thanks,
Wesley


More information about the ffmpeg-user mailing list