[FFmpeg-user] Reversing PAL->NTSC telecining.

Nicholas Robbins nickrobbins at yahoo.com
Mon Jan 6 23:04:37 CET 2014


> On Monday, January 6, 2014 3:14 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:

> > Nicholas Robbins <nickrobbins <at> yahoo.com> writes:
> 
>>  > Both the fieldmatch and the pullup filter were generally 
>>  > able to inverse telecine such a sample.
> 
>>  Should I add decimate to the end? 
> 
> If you use pullup, you need "-r" but not decimate, if you 
> use fieldmatch, decimate is required.
> 
>>  If it drops every 5th frame, it won't be doing the
>>  right thing, or will decimate=cycle=6 do what I want?
> 
> I thought the default may be correct, but this is easy to 
> test.
> 
>>  Perhaps mpdecimate?
> 
> mpdecimate is a different filter with a different purpose bbi
> please do not use it with fieldmatch.
> 
>>  Here is my first guess:
>> 
>>  -vf 
> "fps=fps=30000/1001,fieldmatch,decimate=6,yadif=deint=interlaced"
> 
> Do not initially use yadif, it imo can cause problems.
> 
>>  If you recall, something about how mplayer dumps its 
>>  vobs labels them as ~60fps, when they are really ~30.
>
>
> Did you upload a sample? (What was its name?)
> 
> Carl Eugen


I've uploaded robbins-test-fixed.mkv (my computer crashed in the middle of the first upload.) which is the input and robbins-out.mkv & robbins-6-out.mkv which are the output of:

$ ffmpeg  -i robbins-test-fixed.mkv -map 0 -c:a copy -c:s copy -c:v 
libx264 -preset veryfast -crf 17 -vf 
"fps=fps=30000/1001,fieldmatch,decimate" robbins-out.mkv

and the same with decimate=6. My eye is still not perfect at this, but I think that the version without the 6 has judder, and the version with the 6 doesn't.

Full commands and output below.

-Nick


$ ffmpeg  -i robbins-test-fixed.mkv -map 0 -c:a copy -c:s copy -c:v libx264 -preset veryfast -crf 17 -vf "fps=fps=30000/1001,fieldmatch,decimate" robbins-out.mkv
ffmpeg version 2.0.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec 22 2013 11:21:38 with gcc 4.7.3 (Gentoo Hardened 4.7.3-r1 p1.3, pie-0.5.5)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-O2 -pipe -march=native -fomit-frame-pointer' --extra-cflags='-O2 -pipe -march=native -fomit-frame-pointer' --extra-cxxflags='-O2 -pipe -march=native -fomit-frame-pointer' --disable-static --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --disable-stripping --enable-nonfree --disable-indev=v4l2 --disable-outdev=v4l2 --disable-indev=alsa --disable-indev=oss --disable-indev=jack --disable-outdev=alsa --disable-outdev=oss --disable-outdev=sdl --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-doc --disable-gnutls --enable-hardcoded-tables --enable-iconv --enable-network --disable-openssl --disable-ffplay --disable-vaapi --disable-vdpau --enable-zlib --disable-libvo-aacenc --disable-libvo-amrwbenc
 --enable-libmp3lame --disable-libfdk-aac --disable-libaacplus --enable  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 79.101 /  3. 79.101
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[mpeg2video @ 0x692bc7ef90] ignoring pic cod ext after 0
Input #0, matroska,webm, from 'robbins-test-fixed.mkv':
  Metadata:
    ENCODER         : Lavf55.12.100
  Duration: 00:00:10.11, start: 0.000000, bitrate: 4546 kb/s
    Chapter #0.0: start 0.000000, end 10.000000
    Metadata:
      title           : Chapter 01
    Stream #0:0(eng): Video: mpeg2video (Main), yuv420p, 720x480 [SAR 32:27 DAR 16:9], SAR 186:157 DAR 279:157, 59.94 fps, 59.94 tbr, 1k tbn, 59.94 tbc (default)
    Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Stream #0:2(eng): Subtitle: dvd_subtitle
[libx264 @ 0x692bc84cd0] using SAR=186/157
[libx264 @ 0x692bc84cd0] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[libx264 @ 0x692bc84cd0] profile High, level 3.0
[libx264 @ 0x692bc84cd0] 264 - core 120 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=crf mbtree=1 crf=17.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to 'out.mkv':
  Metadata:
    encoder         : Lavf55.12.100
    Chapter #0.0: start 0.000000, end 10.000000
    Metadata:
      title           : Chapter 01
    Stream #0:0(eng): Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 720x480 [SAR 186:157 DAR 279:157], q=-1--1, 1k tbn, 23.98 tbc (default)
    Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), 448 kb/s (default)
    Stream #0:2(eng): Subtitle: dvd_subtitle
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video -> libx264)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
Press [q] to stop, [?] for help
[mpeg2video @ 0x692bc7ef90] ignoring pic cod ext after 0
frame=  242 fps= 36 q=-1.0 Lsize=    1971kB time=00:00:10.04 bitrate=1606.4kbits/s    
video:1418kB audio:548kB subtitle:0 global headers:0kB muxing overhead 0.243373%
[libx264 @ 0x692bc84cd0] frame I:2     Avg QP: 6.88  size: 15424
[libx264 @ 0x692bc84cd0] frame P:71    Avg QP:17.76  size: 14980
[libx264 @ 0x692bc84cd0] frame B:169   Avg QP:20.98  size:  2112
[libx264 @ 0x692bc84cd0] consecutive B-frames:  0.8%  2.5% 47.1% 49.6%
[libx264 @ 0x692bc84cd0] mb I  I16..4: 60.4% 19.1% 20.5%
[libx264 @ 0x692bc84cd0] mb P  I16..4:  7.0%  1.9%  0.5%  P16..4: 34.3% 18.9% 18.5%  0.0%  0.0%    skip:18.9%
[libx264 @ 0x692bc84cd0] mb B  I16..4:  0.9%  0.3%  0.0%  B16..8: 17.8%  5.0%  0.5%  direct:13.9%  skip:61.6%  L0:30.9% L1:41.5% BI:27.6%
[libx264 @ 0x692bc84cd0] 8x8 transform intra:20.7% inter:47.9%
[libx264 @ 0x692bc84cd0] coded y,uvDC,uvAC intra: 33.3% 17.6% 8.6% inter: 20.1% 17.7% 0.7%
[libx264 @ 0x692bc84cd0] i16 v,h,dc,p: 74% 16% 10%  1%
[libx264 @ 0x692bc84cd0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 13% 71%  1%  1%  1%  1%  1%  2%
[libx264 @ 0x692bc84cd0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 22% 19%  7%  7%  6%  7%  6% 11%
[libx264 @ 0x692bc84cd0] i8c dc,h,v,p: 84%  9%  5%  2%
[libx264 @ 0x692bc84cd0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x692bc84cd0] kb/s:1150.35


and 

 $ ffmpeg  -i robbins-test-fixed.mkv -map 0 -c:a copy -c:s copy -c:v libx264 -preset veryfast -crf 17 -vf "fps=fps=30000/1001,fieldmatch,decimate=6" robbins-6-out.mkv
ffmpeg version 2.0.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec 22 2013 11:21:38 with gcc 4.7.3 (Gentoo Hardened 4.7.3-r1 p1.3, pie-0.5.5)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-O2 -pipe -march=native -fomit-frame-pointer' --extra-cflags='-O2 -pipe -march=native -fomit-frame-pointer' --extra-cxxflags='-O2 -pipe -march=native -fomit-frame-pointer' --disable-static --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --disable-stripping --enable-nonfree --disable-indev=v4l2 --disable-outdev=v4l2 --disable-indev=alsa --disable-indev=oss --disable-indev=jack --disable-outdev=alsa --disable-outdev=oss --disable-outdev=sdl --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-doc --disable-gnutls --enable-hardcoded-tables --enable-iconv --enable-network --disable-openssl --disable-ffplay --disable-vaapi --disable-vdpau --enable-zlib --disable-libvo-aacenc --disable-libvo-amrwbenc
 --enable-libmp3lame --disable-libfdk-aac --disable-libaacplus --enable  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 79.101 /  3. 79.101
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[mpeg2video @ 0x82a09de00] ignoring pic cod ext after 0
Input #0, matroska,webm, from 'robbins-test-fixed.mkv':
  Metadata:
    ENCODER         : Lavf55.12.100
  Duration: 00:00:10.11, start: 0.000000, bitrate: 4546 kb/s
    Chapter #0.0: start 0.000000, end 10.000000
    Metadata:
      title           : Chapter 01
    Stream #0:0(eng): Video: mpeg2video (Main), yuv420p, 720x480 [SAR 32:27 DAR 16:9], SAR 186:157 DAR 279:157, 59.94 fps, 59.94 tbr, 1k tbn, 59.94 tbc (default)
    Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Stream #0:2(eng): Subtitle: dvd_subtitle
[libx264 @ 0x82a0a3b80] using SAR=186/157
[libx264 @ 0x82a0a3b80] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[libx264 @ 0x82a0a3b80] profile High, level 3.0
[libx264 @ 0x82a0a3b80] 264 - core 120 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=crf mbtree=1 crf=17.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to 'robbins-6-out.mkv':
  Metadata:
    encoder         : Lavf55.12.100
    Chapter #0.0: start 0.000000, end 10.000000
    Metadata:
      title           : Chapter 01
    Stream #0:0(eng): Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 720x480 [SAR 186:157 DAR 279:157], q=-1--1, 1k tbn, 24.98 tbc (default)
    Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), 448 kb/s (default)
    Stream #0:2(eng): Subtitle: dvd_subtitle
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video -> libx264)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
Press [q] to stop, [?] for help
[mpeg2video @ 0x82a09de00] ignoring pic cod ext after 0
frame=  252 fps= 37 q=-1.0 Lsize=    1965kB time=00:00:10.04 bitrate=1602.3kbits/s    
video:1413kB audio:548kB subtitle:0 global headers:0kB muxing overhead 0.247402%
[libx264 @ 0x82a0a3b80] frame I:2     Avg QP: 6.98  size: 15077
[libx264 @ 0x82a0a3b80] frame P:74    Avg QP:17.80  size: 14436
[libx264 @ 0x82a0a3b80] frame B:176   Avg QP:21.14  size:  1975
[libx264 @ 0x82a0a3b80] consecutive B-frames:  1.6%  0.8% 45.2% 52.4%
[libx264 @ 0x82a0a3b80] mb I  I16..4: 60.6% 18.9% 20.4%
[libx264 @ 0x82a0a3b80] mb P  I16..4:  7.4%  2.1%  0.5%  P16..4: 34.6% 18.9% 18.1%  0.0%  0.0%    skip:18.4%
[libx264 @ 0x82a0a3b80] mb B  I16..4:  0.9%  0.2%  0.0%  B16..8: 17.1%  4.8%  0.5%  direct:13.2%  skip:63.3%  L0:30.6% L1:42.5% BI:26.9%
[libx264 @ 0x82a0a3b80] 8x8 transform intra:20.9% inter:47.6%
[libx264 @ 0x82a0a3b80] coded y,uvDC,uvAC intra: 32.6% 17.1% 8.0% inter: 19.5% 17.0% 0.7%
[libx264 @ 0x82a0a3b80] i16 v,h,dc,p: 74% 15%  9%  1%
[libx264 @ 0x82a0a3b80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 12% 72%  1%  1%  1%  1%  1%  2%
[libx264 @ 0x82a0a3b80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 22% 18%  7%  7%  6%  7%  6% 11%
[libx264 @ 0x82a0a3b80] i8c dc,h,v,p: 84%  9%  5%  2%
[libx264 @ 0x82a0a3b80] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x82a0a3b80] kb/s:1146.53


More information about the ffmpeg-user mailing list