[FFmpeg-user] How can I use the fieldmatch filter to detelecine?

L. Lee llee040 at sbcglobal.net
Wed Apr 17 19:48:55 CEST 2013


I've developed a highly refined method for applying detelecine using
MEncoder's pullup filter methods. I get excellent results using that
method for the examples I'm including in this message. However, for
reasons that are probably obvious, I'm now trying to get comparable
results using ffmpeg.

How can I use the fieldmatch filter to detelecine these excerpts to get
better results using ffmpeg? This source (for both source 1 and source 2)
is 720P. I don't see any difference in my results whether or not I use
decimate in the filtergraph as shown in the 8.22.2 Examples
(http://ffmpeg.org/ffmpeg-filters.html#toc-Examples-3). I've also included
a slightly longer mpg-muxed version (source 2) which concludes with the
source 1 excerpt. I get different results when encoding the longer
mpg-muxed excerpt (detelecine seems correct, however some areas are
pixilated, but only when encoding the longer excerpt) Although the
included filtergraph for my source 2 command uses the shorter of the two
examples provided in the 8.22.2 section of the documentation, I've tried
both and can't observe any difference in the output.

Here's my source 1:

https://dl.dropboxusercontent.com/u/42718751/Blockyclip.zip

Here's my output 1:

https://dl.dropboxusercontent.com/u/42718751/Blockyclip_output.zip


Here's my source 2 (mpg):

https://dl.dropboxusercontent.com/u/42718751/Blockyclip_mpg.zip

Here's my output 2:

https://dl.dropboxusercontent.com/u/42718751/Blockyclip_output_mpg.zip

Here's the command used on source 1 and results (please find the command
used on source 2 below).

---------

ffmpeg -i 'blockyclip.mp4' -vf "fieldmatch=order=tff:combmatch=full,
yadif=deint=interlaced" -pix_fmt yuv420p -c:v libx264 -preset veryslow
-tune film -qp 22 -r 23.976 -s 1280x720 -aspect 16:9
'Blockyclip_output.mp4'
ffmpeg version N-37959-g20e99a9 Copyright (c) 2000-2013 the FFmpeg
developers
  built on Apr 16 2013 13:28:23 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --enable-filter=fieldmatch --enable-libmp3lame
--enable-gpl --enable-libfaac --enable-pthreads --enable-ffplay
--enable-nonfree --enable-libx264
  libavutil      52. 26.100 / 52. 26.100
  libavcodec     55.  2.100 / 55.  2.100
  libavformat    55.  2.100 / 55.  2.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 56.101 /  3. 56.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9701819400] stream 0, timescale not set
[h264 @ 0x7f9701830c00] mmco: unref short failure
    Last message repeated 1 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9701819400] Stream #2: not enough frames to
estimate rate; consider increasing probesize
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'blockyclip.mp4':
  Metadata:
    major_brand     : M4VH
    minor_version   : 1
    compatible_brands: M4VHmp42avc1isom
    creation_time   : 2013-04-17 15:28:37
    title           : blockyclip
    artist          : blockyclip
    media_type      : 10
    show            : blockyclip
    network         :
    genre           : TV Shows
    date            : 2013-04-13
  Duration: 00:00:15.46, start: 0.000000, bitrate: 7475 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], 7051 kb/s, 59.75 fps, 59.94 tbr, 59940 tbn,
119.88 tbc
    Metadata:
      creation_time   : 2013-04-17 15:28:37
      handler_name    : ?Apple Video Media Handler
    Stream #0:1(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side),
fltp, 384 kb/s
    Metadata:
      creation_time   : 2013-04-17 15:28:37
      handler_name    : ?Apple Sound Media Handler
    Stream #0:2: Video: mjpeg, yuvj420p, 512x512 [SAR 1:1 DAR 1:1], 90k
tbr, 90k tbn, 90k tbc
[libx264 @ 0x7f9701831800] using SAR=1/1
[libx264 @ 0x7f9701831800] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX
[libx264 @ 0x7f9701831800] profile High, level 5.0
[libx264 @ 0x7f9701831800] 264 - core 130 - H.264/MPEG-4 AVC codec -
Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1
ref=16 deblock=1:-1:-1 analyse=0x3:0x133 me=umh subme=9 psy=1
psy_rd=1.00:0.15 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-3 threads=12
lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=8 b_pyramid=2 b_adapt=2
b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23
scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=22 ip_ratio=1.40
pb_ratio=1.30 aq=0
Output #0, mp4, to 'Blockyclip_output.mp4':
  Metadata:
    major_brand     : M4VH
    minor_version   : 1
    compatible_brands: M4VHmp42avc1isom
    date            : 2013-04-13
    title           : blockyclip
    artist          : blockyclip
    media_type      : 10
    show            : blockyclip
    network         :
    genre           : TV Shows
    encoder         : Lavf55.2.100
    Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 11988 tbn, 23.98 tbc
    Metadata:
      creation_time   : 2013-04-17 15:28:37
      handler_name    : ?Apple Video Media Handler
    Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, 5.1,
s16, 128 kb/s
    Metadata:
      creation_time   : 2013-04-17 15:28:37
      handler_name    : ?Apple Sound Media Handler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (ac3 -> libfaac)
Press [q] to stop, [?] for help
[h264 @ 0x7f9702631400] mmco: unref short failure
[h264 @ 0x7f9702631a00] mmco: unref short failure
frame CRC mismatch1 q=24.0 size=     995kB time=00:00:14.46 bitrate=
563.7kbits/s dup=2 drop=527
frame=  372 fps= 20 q=-1.0 Lsize=    1219kB time=00:00:15.46 bitrate=
645.4kbits/s dup=2 drop=550
video:891kB audio:316kB subtitle:0 global headers:0kB muxing overhead
0.974321%
[libx264 @ 0x7f9701831800] frame I:2     Avg QP:19.00  size:  8307
[libx264 @ 0x7f9701831800] frame P:97    Avg QP:22.00  size:  6083
[libx264 @ 0x7f9701831800] frame B:273   Avg QP:23.69  size:  1117
[libx264 @ 0x7f9701831800] consecutive B-frames:  2.2%  3.2% 10.5% 59.1%
17.5%  3.2%  0.0%  4.3%  0.0%
[libx264 @ 0x7f9701831800] mb I  I16..4: 92.3%  4.8%  2.9%
[libx264 @ 0x7f9701831800] mb P  I16..4:  8.0%  2.5%  1.0%  P16..4:  9.4%
2.6%  1.4%  0.1%  0.0%    skip:75.0%
[libx264 @ 0x7f9701831800] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8:  7.7%
0.6%  0.1%  direct: 0.9%  skip:90.5%  L0:53.0% L1:39.3% BI: 7.8%
[libx264 @ 0x7f9701831800] 8x8 transform intra:19.8% inter:59.9%
[libx264 @ 0x7f9701831800] direct mvs  spatial:97.4% temporal:2.6%
[libx264 @ 0x7f9701831800] coded y,uvDC,uvAC intra: 18.8% 28.3% 9.9%
inter: 2.2% 3.6% 0.2%
[libx264 @ 0x7f9701831800] i16 v,h,dc,p: 76% 16%  2%  6%
[libx264 @ 0x7f9701831800] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 13% 26%  5%
9% 12%  9%  6%  8%
[libx264 @ 0x7f9701831800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 42%  8%  3%
5%  6%  6%  4%  7%
[libx264 @ 0x7f9701831800] i8c dc,h,v,p: 64% 20% 11%  5%
[libx264 @ 0x7f9701831800] Weighted P-Frames: Y:5.2% UV:3.1%
[libx264 @ 0x7f9701831800] ref P L0: 53.5%  8.6% 20.4%  5.3%  3.4%  2.5%
1.7%  1.0%  0.7%  0.6%  0.5%  0.5%  0.4%  0.4%  0.4%  0.3%
[libx264 @ 0x7f9701831800] ref B L0: 84.2%  9.4%  3.1%  1.2%  0.7%  0.4%
0.3%  0.1%  0.1%  0.1%  0.2%  0.1%  0.1%  0.0%  0.0%
[libx264 @ 0x7f9701831800] ref B L1: 97.0%  3.0%
[libx264 @ 0x7f9701831800] kb/s:470.08



---------



Here's the command used on source 2:


---------


ffmpeg -i 'Blockyclip_mpg.mpg' -vf "fieldmatch=order=tff:combmatch=none"
-pix_fmt yuv420p -c:v libx264 -preset veryslow -tune film -qp 22 -r 23.976
-s 1280x720 -aspect 16:9 'Blockyclip_output_mpg.mp4'
ffmpeg version N-37959-g20e99a9 Copyright (c) 2000-2013 the FFmpeg
developers
  built on Apr 16 2013 13:28:23 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --enable-filter=fieldmatch --enable-libmp3lame
--enable-gpl --enable-libfaac --enable-pthreads --enable-ffplay
--enable-nonfree --enable-libx264
  libavutil      52. 26.100 / 52. 26.100
  libavcodec     55.  2.100 / 55.  2.100
  libavformat    55.  2.100 / 55.  2.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 56.101 /  3. 56.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[h264 @ 0x7fc6f4021a00] mmco: unref short failure
    Last message repeated 1 times
Input #0, mpegts, from 'Blockyclip_mpg.mpg':
  Duration: 02:44:21.62, start: 1.404767, bitrate: 12513 kb/s
  Program 1 
    Stream #0:0[0x1011]: Video: h264 (Main) (HDMV / 0x564D4448), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
    Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz,
5.1(side), fltp, 384 kb/s
[libx264 @ 0x7fc6f401a000] using SAR=1/1
[libx264 @ 0x7fc6f401a000] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX
[libx264 @ 0x7fc6f401a000] profile High, level 5.0
[libx264 @ 0x7fc6f401a000] 264 - core 130 - H.264/MPEG-4 AVC codec -
Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1
ref=16 deblock=1:-1:-1 analyse=0x3:0x133 me=umh subme=9 psy=1
psy_rd=1.00:0.15 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-3 threads=12
lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=8 b_pyramid=2 b_adapt=2
b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23
scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=22 ip_ratio=1.40
pb_ratio=1.30 aq=0
Output #0, mp4, to '/Blockyclip_output_mpg.mp4':
  Metadata:
    encoder         : Lavf55.2.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720
[SAR 1:1 DAR 16:9], q=-1--1, 11988 tbn, 23.98 tbc
    Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, 5.1, s16,
128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (ac3 -> libfaac)
Press [q] to stop, [?] for help
[h264 @ 0x7fc6f5112000] mmco: unref short failure
[h264 @ 0x7fc6f5113800] mmco: unref short failure
frame= 6144 fps=9.9 q=-1.0 Lsize=   53333kB time=00:04:16.32
bitrate=1704.5kbits/s dup=0 drop=9209
video:47140kB audio:6027kB subtitle:0 global headers:0kB muxing overhead
0.312380%
[libx264 @ 0x7fc6f401a000] frame I:58    Avg QP:19.00  size: 32860
[libx264 @ 0x7fc6f401a000] frame P:1451  Avg QP:22.00  size: 15946
[libx264 @ 0x7fc6f401a000] frame B:4635  Avg QP:23.73  size:  5011
[libx264 @ 0x7fc6f401a000] consecutive B-frames:  2.5%  3.9% 12.8% 21.9%
24.4% 25.6%  5.0%  3.1%  0.7%
[libx264 @ 0x7fc6f401a000] mb I  I16..4: 43.3% 47.9%  8.8%
[libx264 @ 0x7fc6f401a000] mb P  I16..4:  7.7% 10.2%  1.5%  P16..4: 30.2%
7.1%  5.0%  0.3%  0.1%    skip:37.9%
[libx264 @ 0x7fc6f401a000] mb B  I16..4:  0.4%  0.8%  0.2%  B16..8: 28.3%
3.5%  0.7%  direct: 2.8%  skip:63.3%  L0:42.9% L1:48.8% BI: 8.3%
[libx264 @ 0x7fc6f401a000] 8x8 transform intra:52.5% inter:73.8%
[libx264 @ 0x7fc6f401a000] direct mvs  spatial:99.8% temporal:0.2%
[libx264 @ 0x7fc6f401a000] coded y,uvDC,uvAC intra: 45.8% 56.1% 19.9%
inter: 9.0% 15.6% 0.4%
[libx264 @ 0x7fc6f401a000] i16 v,h,dc,p: 49% 25%  8% 18%
[libx264 @ 0x7fc6f401a000] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 12% 10%  7%
12% 12% 12% 10% 11%
[libx264 @ 0x7fc6f401a000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 22%  8%  5%
10% 10% 10%  7% 11%
[libx264 @ 0x7fc6f401a000] i8c dc,h,v,p: 48% 26% 18%  7%
[libx264 @ 0x7fc6f401a000] Weighted P-Frames: Y:5.0% UV:2.7%
[libx264 @ 0x7fc6f401a000] ref P L0: 51.4% 16.3% 12.7%  4.5%  3.1%  2.6%
1.9%  1.4%  1.0%  1.0%  0.8%  0.9%  0.6%  0.7%  0.6%  0.5%
[libx264 @ 0x7fc6f401a000] ref B L0: 84.2%  7.1%  2.9%  1.3%  1.0%  0.8%
0.7%  0.4%  0.3%  0.3%  0.3%  0.2%  0.2%  0.2%  0.1%
[libx264 @ 0x7fc6f401a000] ref B L1: 95.1%  4.9%
[libx264 @ 0x7fc6f401a000] kb/s:1506.95

---------



Thanks.

Laine Lee





More information about the ffmpeg-user mailing list