Opened 10 years ago

Closed 9 years ago

#3968 closed enhancement (fixed)

fieldmatch does not work for mixed telecined and progressive content

Reported by: Marcus Owned by:
Priority: wish Component: avfilter
Version: git-master Keywords: pullup fieldmatch decimate
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

When using fieldmatch on some interlaced mpeg video (ntsc dvd source), the output was generated with out-of-sync video.

The input sample has 120 seconds of video + audio, and is available on:

https://docs.google.com/file/d/0B4PVnH9qRoFRSlRGT19VZ3Zpbmc/edit?pli=1

After reencoding, The output has 97 seconds of video and 120 seconds of audio.

How to reproduce:

C:\Temp>"c:\Program Files\ffmpeg\ffmpeg.exe" -i sample.mpg -vf fieldmatch,decimate output.mp4

Output of ffmpeg log 99:

C:\Temp>"c:\Program Files\ffmpeg\ffmpeg.exe" -v 9 -loglevel 99 -i sample.mpg
ffmpeg version 2.2.4 Copyright (c) 2000-2014 the FFmpeg developers

built on Jul 7 2014 19:32:48 with gcc 4.8.2 (GCC)
configuration: --extra-ldflags=-L/usr/local/x86_64-w64-mingw32/lib --prefix=/u

sr/local/x86_64-w64-mingw32 --cross-prefix=x86_64-w64-mingw32- --target-os=mingw
32 --enable-w32threads --enable-memalign-hack --arch=x86_64 --enable-runtime-cpu
detect --disable-debug --enable-static --disable-shared --disable-ffplay --disab
le-ffserver --enable-gpl --enable-version3 --enable-nonfree --enable-libmp3lame
--enable-libfdk-aac --enable-libx264 --enable-libopenjpeg

libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100

Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument
'9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level)
with argument '99'.
Reading option '-i' ... matched as input file with argument 'sample.mpg'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input file sample.mpg.
Successfully parsed a group of options.
Opening an input file: sample.mpg.
[mpeg @ 0000000001b17780] Format mpeg probed with size=16384 and score=52
[mpeg @ 0000000001b17780] Before avformat_find_stream_info() pos: 0 bytes read:3
2768 seeks:0
[mpeg @ 0000000001b17780] probing stream 0 pp:2500
[mpeg @ 0000000001b17780] Probe with size=2002, packets=1 detected mpegvideo wit
h score=25
[mpeg @ 0000000001b17780] probed stream 0
[mpeg @ 0000000001b17780] max_analyze_duration 5000000 reached at 5005000 micros
econds
rfps: 29.916667 0.005978

Last message repeated 1 times

rfps: 30.000000 0.002044
rfps: 59.916667 0.001354

Last message repeated 1 times

rfps: 60.000000 0.008178
rfps: 29.970030 0.000076

Last message repeated 1 times

rfps: 59.940060 0.000304

Last message repeated 1 times

[mpeg @ 0000000001b17780] After avformat_find_stream_info() pos: 0 bytes read:29
69744 seeks:2 frames:298
Input #0, mpeg, from 'sample.mpg':

Duration: 00:02:00.10, start: 0.600000, bitrate: 6081 kb/s

Stream #0:0[0x1e0], 152, 1/90000: Video: mpeg2video (Main), yuv420p(tv), 720

x480 [SAR 8:9 DAR 4:3], 1001/60000, max. 8801 kb/s, 29.97 fps, 29.97 tbr, 90k tb
n, 59.94 tbc

Stream #0:1[0x80], 146, 1/90000: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384

kb/s
Successfully opened the file.
At least one output file must be specified
[AVIOContext @ 0000000001b1fee0] Statistics: 2969744 bytes read, 2 seeks
Conversion failed!

Change History (9)

comment:1 by Carl Eugen Hoyos, 10 years ago

Is the problem reproducible with current FFmpeg git head?
To make this a valid ticket, please provide the command line that allows to reproduce the issue together with the complete, uncut console output.

comment:2 by Marcus, 10 years ago

Hello. I just recompiled ffmpeg, to lastest version - 2.4.1. The problem remains the same.

Below follows the command line to reproduce the issue, and also the full uncut console output:

C:\Temp>"c:\Program Files\ffmpeg\ffmpeg.exe" -i sample.mpg -vf fieldmatch,decim
ate output.mp4
ffmpeg version 2.4.1 Copyright (c) 2000-2014 the FFmpeg developers

built on Sep 22 2014 11:39:40 with gcc 4.8.2 (GCC)
configuration: --extra-ldflags=-L/usr/local/x86_64-w64-mingw32/lib --prefix=/u

sr/local/x86_64-w64-mingw32 --cross-prefix=x86_64-w64-mingw32- --target-os=mingw
32 --enable-w32threads --enable-memalign-hack --arch=x86_64 --enable-runtime-cpu
detect --disable-debug --enable-static --disable-shared --disable-ffplay --disab
le-ffserver --enable-gpl --enable-version3 --enable-nonfree --enable-libmp3lame
--enable-libfdk-aac --enable-libx264 --enable-libopenjpeg

libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 1.100 / 56. 1.100
libavformat 56. 4.101 / 56. 4.101
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 1.100 / 5. 1.100
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 0.100 / 53. 0.100

Input #0, mpeg, from 'sample.mpg':

Duration: 00:02:00.14, start: 0.600000, bitrate: 6080 kb/s

Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR 8:9

DAR 4:3], max. 8801 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc

Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s

File 'output.mp4' already exists. Overwrite ? [y/N] y
No pixel format specified, yuv420p10le for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 00000000046e6140] using SAR=8/9
[libx264 @ 00000000046e6140] using cpu capabilities: MMX2 SSE2Fast LZCNT
[libx264 @ 00000000046e6140] profile High 10, level 3.0, 4:2:0 10-bit
[libx264 @ 00000000046e6140] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft
2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1
:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_rang
e=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_
offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interla
ced=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=2 keyint=250 keyint_min=23 scenecut=40
intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpma
x=81 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':

Metadata:

encoder : Lavf56.4.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p10le, 72

0x480 [SAR 8:9 DAR 4:3], q=-1--1, 23.98 fps, 24k tbn, 23.98 tbc

Metadata:

encoder : Lavc56.1.100 libx264

Stream #0:1: Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 48000 Hz, 5.1

, s16, 488 kb/s

Metadata:

encoder : Lavc56.1.100 libfdk_aac

Stream mapping:

Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (ac3 (native) -> aac (libfdk_aac))

Press [q] to stop, ? for help
frame= 48 fps=0.0 q=40.0 size= 1kB time=00:00:01.68 bitrate= 4.0kbits/
frame= 76 fps= 75 q=40.0 size= 74kB time=00:00:02.77 bitrate= 217.1kbits/
frame= 92 fps= 61 q=40.0 size= 161kB time=00:00:03.56 bitrate= 370.0kbits/
frame= 108 fps= 54 q=40.0 size= 255kB time=00:00:04.11 bitrate= 506.5kbits/
frame= 128 fps= 50 q=40.0 size= 351kB time=00:00:04.95 bitrate= 581.0kbits/
frame= 144 fps= 47 q=40.0 size= 444kB time=00:00:05.61 bitrate= 648.6kbits/
frame= 160 fps= 44 q=40.0 size= 546kB time=00:00:06.42 bitrate= 696.2kbits/
frame= 180 fps= 43 q=40.0 size= 661kB time=00:00:07.14 bitrate= 757.8kbits/
frame= 200 fps= 42 q=40.0 size= 787kB time=00:00:07.91 bitrate= 814.6kbits/
frame= 216 fps= 41 q=40.0 size= 894kB time=00:00:08.59 bitrate= 851.4kbits/
frame= 232 fps= 40 q=40.0 size= 993kB time=00:00:09.38 bitrate= 866.7kbits/
frame= 248 fps= 40 q=40.0 size= 1091kB time=00:00:09.94 bitrate= 899.0kbits/
frame= 260 fps= 38 q=40.0 size= 1157kB time=00:00:10.51 bitrate= 901.4kbits/
frame= 272 fps= 37 q=40.0 size= 1218kB time=00:00:10.86 bitrate= 918.4kbits/
frame= 288 fps= 37 q=40.0 size= 1293kB time=00:00:11.62 bitrate= 911.2kbits/
frame= 308 fps= 37 q=40.0 size= 1382kB time=00:00:12.37 bitrate= 914.6kbits/
frame= 324 fps= 37 q=40.0 size= 1457kB time=00:00:13.10 bitrate= 911.1kbits/
frame= 340 fps= 37 q=40.0 size= 1553kB time=00:00:13.74 bitrate= 925.6kbits/
frame= 360 fps= 36 q=40.0 size= 1652kB time=00:00:14.55 bitrate= 930.0kbits/
frame= 376 fps= 36 q=40.0 size= 1728kB time=00:00:15.25 bitrate= 927.8kbits/
frame= 396 fps= 36 q=40.0 size= 1826kB time=00:00:16.04 bitrate= 932.5kbits/
frame= 416 fps= 36 q=40.0 size= 1918kB time=00:00:16.91 bitrate= 928.7kbits/
frame= 436 fps= 36 q=40.0 size= 2008kB time=00:00:17.75 bitrate= 926.7kbits/
frame= 460 fps= 37 q=40.0 size= 2104kB time=00:00:18.77 bitrate= 917.9kbits/
frame= 484 fps= 37 q=40.0 size= 2191kB time=00:00:19.73 bitrate= 909.4kbits/
frame= 504 fps= 37 q=40.0 size= 2263kB time=00:00:20.56 bitrate= 901.3kbits/
frame= 528 fps= 38 q=40.0 size= 2349kB time=00:00:21.29 bitrate= 903.8kbits/
frame= 552 fps= 38 q=40.0 size= 2433kB time=00:00:22.25 bitrate= 895.8kbits/
frame= 568 fps= 38 q=40.0 size= 2501kB time=00:00:23.31 bitrate= 878.4kbits/
frame= 596 fps= 38 q=40.0 size= 2591kB time=00:00:25.06 bitrate= 846.6kbits/
frame= 632 fps= 39 q=40.0 size= 2681kB time=00:00:27.30 bitrate= 804.2kbits/
frame= 664 fps= 40 q=40.0 size= 2763kB time=00:00:29.48 bitrate= 767.7kbits/
frame= 688 fps= 40 q=40.0 size= 2831kB time=00:00:30.87 bitrate= 751.2kbits/
frame= 708 fps= 40 q=40.0 size= 2896kB time=00:00:32.04 bitrate= 740.5kbits/
frame= 720 fps= 40 q=40.0 size= 2955kB time=00:00:32.59 bitrate= 742.5kbits/
frame= 732 fps= 39 q=40.0 size= 3029kB time=00:00:33.26 bitrate= 746.0kbits/
frame= 744 fps= 39 q=40.0 size= 3119kB time=00:00:33.87 bitrate= 754.1kbits/
frame= 760 fps= 39 q=40.0 size= 3255kB time=00:00:34.66 bitrate= 769.2kbits/
frame= 772 fps= 38 q=40.0 size= 3354kB time=00:00:35.30 bitrate= 778.1kbits/
frame= 784 fps= 38 q=40.0 size= 3457kB time=00:00:35.99 bitrate= 786.8kbits/
frame= 796 fps= 37 q=40.0 size= 3562kB time=00:00:36.52 bitrate= 798.9kbits/
frame= 800 fps= 36 q=40.0 size= 3597kB time=00:00:36.75 bitrate= 801.6kbits/
frame= 808 fps= 36 q=40.0 size= 3667kB time=00:00:37.16 bitrate= 808.2kbits/
frame= 820 fps= 35 q=40.0 size= 3776kB time=00:00:37.80 bitrate= 818.1kbits/
frame= 832 fps= 35 q=40.0 size= 3885kB time=00:00:38.42 bitrate= 828.3kbits/
frame= 844 fps= 34 q=40.0 size= 4012kB time=00:00:39.14 bitrate= 839.5kbits/
frame= 856 fps= 34 q=40.0 size= 4135kB time=00:00:39.66 bitrate= 854.1kbits/
frame= 868 fps= 34 q=40.0 size= 4259kB time=00:00:40.34 bitrate= 864.8kbits/
frame= 880 fps= 34 q=40.0 size= 4393kB time=00:00:40.91 bitrate= 879.4kbits/
frame= 892 fps= 33 q=40.0 size= 4532kB time=00:00:41.51 bitrate= 894.3kbits/
frame= 904 fps= 33 q=40.0 size= 4664kB time=00:00:42.15 bitrate= 906.4kbits/
frame= 916 fps= 33 q=40.0 size= 4804kB time=00:00:42.86 bitrate= 918.2kbits/
frame= 928 fps= 33 q=40.0 size= 4942kB time=00:00:43.41 bitrate= 932.5kbits/
frame= 940 fps= 33 q=40.0 size= 5080kB time=00:00:44.11 bitrate= 943.3kbits/
frame= 952 fps= 33 q=40.0 size= 5221kB time=00:00:44.82 bitrate= 954.3kbits/
frame= 964 fps= 32 q=40.0 size= 5362kB time=00:00:45.42 bitrate= 967.1kbits/
frame= 980 fps= 32 q=40.0 size= 5553kB time=00:00:46.12 bitrate= 986.3kbits/
frame= 992 fps= 32 q=40.0 size= 5694kB time=00:00:46.76 bitrate= 997.5kbits/
frame= 1004 fps= 32 q=40.0 size= 5840kB time=00:00:47.40 bitrate=1009.2kbits/
frame= 1016 fps= 32 q=40.0 size= 5988kB time=00:00:48.04 bitrate=1021.1kbits/
frame= 1028 fps= 32 q=40.0 size= 6135kB time=00:00:48.62 bitrate=1033.7kbits/
frame= 1040 fps= 31 q=40.0 size= 6286kB time=00:00:49.26 bitrate=1045.3kbits/
frame= 1052 fps= 31 q=40.0 size= 6438kB time=00:00:50.07 bitrate=1053.3kbits/
frame= 1064 fps= 31 q=40.0 size= 6613kB time=00:00:50.66 bitrate=1069.2kbits/
frame= 1076 fps= 31 q=40.0 size= 6785kB time=00:00:51.11 bitrate=1087.3kbits/
frame= 1088 fps= 31 q=40.0 size= 6961kB time=00:00:51.75 bitrate=1101.8kbits/
frame= 1100 fps= 31 q=40.0 size= 7146kB time=00:00:52.39 bitrate=1117.2kbits/
frame= 1112 fps= 30 q=40.0 size= 7323kB time=00:00:53.03 bitrate=1131.1kbits/
frame= 1124 fps= 30 q=40.0 size= 7479kB time=00:00:53.61 bitrate=1142.7kbits/
frame= 1136 fps= 30 q=40.0 size= 7641kB time=00:00:54.35 bitrate=1151.5kbits/
frame= 1148 fps= 30 q=40.0 size= 7810kB time=00:00:54.89 bitrate=1165.6kbits/
frame= 1160 fps= 30 q=40.0 size= 7978kB time=00:00:55.53 bitrate=1177.0kbits/
frame= 1172 fps= 30 q=40.0 size= 8141kB time=00:00:56.17 bitrate=1187.2kbits/
frame= 1184 fps= 30 q=40.0 size= 8311kB time=00:00:56.79 bitrate=1198.9kbits/
frame= 1196 fps= 30 q=40.0 size= 8483kB time=00:00:57.43 bitrate=1210.0kbits/
frame= 1208 fps= 30 q=40.0 size= 8662kB time=00:00:58.02 bitrate=1222.9kbits/
frame= 1220 fps= 30 q=40.0 size= 8845kB time=00:00:58.60 bitrate=1236.5kbits/
frame= 1232 fps= 29 q=40.0 size= 9057kB time=00:00:59.24 bitrate=1252.4kbits/
frame= 1244 fps= 29 q=40.0 size= 9280kB time=00:00:59.88 bitrate=1269.5kbits/
frame= 1256 fps= 29 q=40.0 size= 9500kB time=00:01:00.52 bitrate=1285.8kbits/
frame= 1268 fps= 29 q=40.0 size= 9706kB time=00:01:01.10 bitrate=1301.3kbits/
frame= 1280 fps= 29 q=40.0 size= 9882kB time=00:01:01.74 bitrate=1311.2kbits/
frame= 1292 fps= 29 q=40.0 size= 10050kB time=00:01:02.38 bitrate=1319.9kbits/
frame= 1304 fps= 29 q=40.0 size= 10217kB time=00:01:03.02 bitrate=1328.1kbits/
frame= 1320 fps= 29 q=40.0 size= 10438kB time=00:01:03.83 bitrate=1339.6kbits/
frame= 1332 fps= 29 q=40.0 size= 10611kB time=00:01:04.47 bitrate=1348.3kbits/
frame= 1344 fps= 29 q=40.0 size= 10779kB time=00:01:04.98 bitrate=1358.8kbits/
frame= 1356 fps= 28 q=40.0 size= 10945kB time=00:01:05.64 bitrate=1365.9kbits/
frame= 1368 fps= 28 q=40.0 size= 11097kB time=00:01:06.26 bitrate=1371.9kbits/
frame= 1380 fps= 28 q=40.0 size= 11256kB time=00:01:06.90 bitrate=1378.3kbits/
frame= 1396 fps= 28 q=40.0 size= 11419kB time=00:01:07.75 bitrate=1380.6kbits/
frame= 1412 fps= 28 q=40.0 size= 11565kB time=00:01:08.52 bitrate=1382.6kbits/
frame= 1428 fps= 28 q=40.0 size= 11731kB time=00:01:09.35 bitrate=1385.6kbits/
frame= 1444 fps= 28 q=40.0 size= 11898kB time=00:01:10.25 bitrate=1387.4kbits/
frame= 1460 fps= 28 q=40.0 size= 12051kB time=00:01:11.08 bitrate=1388.8kbits/
frame= 1476 fps= 28 q=40.0 size= 12195kB time=00:01:11.85 bitrate=1390.4kbits/
frame= 1492 fps= 28 q=40.0 size= 12345kB time=00:01:12.74 bitrate=1390.1kbits/
frame= 1508 fps= 28 q=40.0 size= 12505kB time=00:01:13.55 bitrate=1392.6kbits/
frame= 1524 fps= 28 q=40.0 size= 12660kB time=00:01:14.45 bitrate=1392.9kbits/
frame= 1544 fps= 29 q=40.0 size= 12834kB time=00:01:15.41 bitrate=1394.1kbits/
frame= 1560 fps= 29 q=40.0 size= 12973kB time=00:01:16.31 bitrate=1392.7kbits/
frame= 1580 fps= 29 q=40.0 size= 13127kB time=00:01:17.14 bitrate=1394.0kbits/
frame= 1596 fps= 29 q=40.0 size= 13259kB time=00:01:17.97 bitrate=1393.0kbits/
frame= 1616 fps= 29 q=40.0 size= 13385kB time=00:01:18.89 bitrate=1389.8kbits/
frame= 1636 fps= 29 q=40.0 size= 13515kB time=00:01:20.30 bitrate=1378.8kbits/
frame= 1660 fps= 29 q=40.0 size= 13640kB time=00:01:21.68 bitrate=1367.9kbits/
frame= 1684 fps= 29 q=40.0 size= 13748kB time=00:01:23.28 bitrate=1352.2kbits/
frame= 1712 fps= 29 q=40.0 size= 13857kB time=00:01:24.90 bitrate=1336.9kbits/
frame= 1736 fps= 30 q=40.0 size= 13962kB time=00:01:26.50 bitrate=1322.1kbits/
frame= 1760 fps= 30 q=40.0 size= 14045kB time=00:01:27.72 bitrate=1311.5kbits/
frame= 1784 fps= 30 q=40.0 size= 14140kB time=00:01:29.04 bitrate=1300.8kbits/
frame= 1804 fps= 30 q=40.0 size= 14219kB time=00:01:30.13 bitrate=1292.3kbits/
frame= 1824 fps= 30 q=40.0 size= 14309kB time=00:01:31.18 bitrate=1285.6kbits/
frame= 1844 fps= 30 q=40.0 size= 14411kB time=00:01:32.18 bitrate=1280.7kbits/
frame= 1860 fps= 30 q=40.0 size= 14514kB time=00:01:33.10 bitrate=1277.1kbits/
frame= 1880 fps= 30 q=40.0 size= 14608kB time=00:01:34.03 bitrate=1272.6kbits/
frame= 1900 fps= 30 q=40.0 size= 14701kB time=00:01:35.08 bitrate=1266.6kbits/
frame= 1920 fps= 30 q=40.0 size= 14791kB time=00:01:36.23 bitrate=1259.0kbits/
frame= 1944 fps= 30 q=40.0 size= 14877kB time=00:01:37.38 bitrate=1251.4kbits/
frame= 1968 fps= 30 q=40.0 size= 14962kB time=00:01:38.58 bitrate=1243.3kbits/
frame= 1992 fps= 31 q=40.0 size= 15053kB time=00:01:39.86 bitrate=1234.8kbits/
frame= 2016 fps= 31 q=40.0 size= 15143kB time=00:01:41.14 bitrate=1226.5kbits/
frame= 2040 fps= 31 q=40.0 size= 15242kB time=00:01:42.57 bitrate=1217.3kbits/
frame= 2064 fps= 31 q=40.0 size= 15335kB time=00:01:43.91 bitrate=1208.9kbits/
frame= 2088 fps= 31 q=40.0 size= 15437kB time=00:01:45.43 bitrate=1199.4kbits/
frame= 2116 fps= 31 q=40.0 size= 15549kB time=00:01:47.15 bitrate=1188.7kbits/
frame= 2144 fps= 31 q=40.0 size= 15662kB time=00:01:48.84 bitrate=1178.7kbits/
frame= 2168 fps= 32 q=40.0 size= 15767kB time=00:01:50.42 bitrate=1169.7kbits/
frame= 2196 fps= 32 q=40.0 size= 15861kB time=00:01:51.85 bitrate=1161.7kbits/
frame= 2220 fps= 32 q=40.0 size= 15969kB time=00:01:53.26 bitrate=1155.0kbits/
frame= 2244 fps= 32 q=40.0 size= 16061kB time=00:01:54.39 bitrate=1150.2kbits/
frame= 2268 fps= 32 q=40.0 size= 16171kB time=00:01:55.79 bitrate=1144.0kbits/
frame= 2288 fps= 32 q=40.0 size= 16254kB time=00:01:56.88 bitrate=1139.1kbits/
frame= 2308 fps= 32 q=40.0 size= 16340kB time=00:01:58.03 bitrate=1134.0kbits/
frame= 2324 fps= 32 q=40.0 size= 16555kB time=00:01:58.67 bitrate=1142.8kbits/
frame= 2340 fps= 32 q=40.0 size= 16751kB time=00:01:59.27 bitrate=1150.5kbits/
frame= 2348 fps= 32 q=-1.0 Lsize= 17771kB time=00:02:00.00 bitrate=1213.2kbits
/s
video:10546kB audio:7162kB subtitle:0kB other streams:0kB global headers:0kB mux
ing overhead: 0.357373%
[libx264 @ 00000000046e6140] frame I:25 Avg QP:23.87 size: 9387
[libx264 @ 00000000046e6140] frame P:1406 Avg QP:29.97 size: 5476
[libx264 @ 00000000046e6140] frame B:917 Avg QP:32.93 size: 3124
[libx264 @ 00000000046e6140] consecutive B-frames: 25.2% 68.1% 0.3% 6.5%
[libx264 @ 00000000046e6140] mb I I16..4: 67.2% 29.0% 3.8%
[libx264 @ 00000000046e6140] mb P I16..4: 2.6% 5.8% 0.3% P16..4: 21.6% 8.3
% 4.2% 0.0% 0.0% skip:57.1%
[libx264 @ 00000000046e6140] mb B I16..4: 0.2% 1.9% 0.0% B16..8: 20.3% 3.5
% 1.1% direct: 2.7% skip:70.2% L0:39.0% L1:52.2% BI: 8.8%
[libx264 @ 00000000046e6140] 8x8 transform intra:63.2% inter:72.2%
[libx264 @ 00000000046e6140] coded y,uvDC,uvAC intra: 51.5% 37.8% 13.1% inter: 1
4.9% 11.6% 1.2%
[libx264 @ 00000000046e6140] i16 v,h,dc,p: 65% 21% 5% 9%
[libx264 @ 00000000046e6140] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 8% 15% 38% 5% 6%

6% 7% 5% 9%

[libx264 @ 00000000046e6140] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 28% 20% 6% 8%

5% 9% 4% 8%

[libx264 @ 00000000046e6140] i8c dc,h,v,p: 66% 19% 10% 5%
[libx264 @ 00000000046e6140] Weighted P-Frames: Y:15.6% UV:8.4%
[libx264 @ 00000000046e6140] ref P L0: 76.8% 14.1% 8.4% 0.7%
[libx264 @ 00000000046e6140] ref B L0: 82.6% 17.4% 0.0%
[libx264 @ 00000000046e6140] ref B L1: 100.0% 0.0%
[libx264 @ 00000000046e6140] kb/s:882.14

C:\Temp>

comment:3 by Carl Eugen Hoyos, 10 years ago

Component: undetermineddocumentation
Keywords: fieldmatch added
Priority: normalminor
Reproduced by developer: set
Status: newopen
Summary: fieldmatch with decimate generates out-of-sync videofieldmatch does not work for mixed telecined and progressive content
Version: unspecifiedgit-master

For future tickets: Please always test current FFmpeg git head, nothing else is supported both here and on the user mailing list.

The content is mixed progressive and telecined (actually 20 seconds telecined Fox Intro followed by a progressive movie), this does not work with fieldmatch currently, it requires cfr input: This seems not documented (although known),

The following is supposed to produce perfect output, it unfortunately doesn't work correctly:
-vf fps=30000/1001,fieldmatch,decimate

I suggest you either use the pullup filter or cut the Intro (or brutally edit it with -fps or -r).

comment:4 by Marcus, 10 years ago

Thanks for the feedback, but I am afraid that the problem remains.

I cutted the original sample video, starting from 60 seconds to 120 seconds, what is supposed to contain only progressive video:

C:\Temp>"c:\Program Files\ffmpeg\ffmpeg.exe" -i sample.mpg -ss 00:01:00 -acodec copy -vcodec copy sample2.mpg

The second sample is available on:

https://drive.google.com/file/d/0B4PVnH9qRoFRcy1zZEdzV3NUQlU/edit?usp=sharing

Then I reapplied the fieldmatch+decimate filter chain:

C:\Temp>"c:\Program Files\ffmpeg\ffmpeg.exe" -i sample2.mpg -pix_fmt yuv420p -vf

fieldmatch,decimate output2.mp4

The new output has 60 seconds of audio, and only 46 seconds of video.

The full console output follows below:

C:\Temp>"c:\Program Files\ffmpeg\ffmpeg.exe" -i sample2.mpg -pix_fmt yuv420p -vf

fieldmatch,decimate output2.mp4

ffmpeg version 2.4.1 Copyright (c) 2000-2014 the FFmpeg developers

built on Sep 22 2014 12:24:49 with gcc 4.8.2 (GCC)
configuration: --extra-ldflags=-L/usr/local/x86_64-w64-mingw32/lib --prefix=/u

sr/local/x86_64-w64-mingw32 --cross-prefix=x86_64-w64-mingw32- --target-os=mingw
32 --enable-w32threads --enable-memalign-hack --arch=x86_64 --enable-runtime-cpu
detect --disable-debug --enable-static --disable-shared --disable-ffplay --disab
le-ffserver --enable-gpl --enable-version3 --enable-nonfree --enable-libmp3lame
--enable-libfdk-aac --enable-libx264 --enable-libopenjpeg

libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 1.100 / 56. 1.100
libavformat 56. 4.101 / 56. 4.101
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 1.100 / 5. 1.100
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 0.100 / 53. 0.100

Input #0, mpeg, from 'sample2.mpg':

Duration: 00:01:00.12, start: 0.500000, bitrate: 5924 kb/s

Stream #0:0[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR 8:9

DAR 4:3], max. 8801 kb/s, 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
File 'output2.mp4' already exists. Overwrite ? [y/N] y
[libx264 @ 0000000001ded7c0] using SAR=8/9
[libx264 @ 0000000001ded7c0] using cpu capabilities: MMX2 SSE2Fast LZCNT
[libx264 @ 0000000001ded7c0] profile High, level 3.0
[libx264 @ 0000000001ded7c0] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft
2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1
:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_rang
e=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_
offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interla
ced=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=2 keyint=250 keyint_min=23 scenecut=40
intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpma
x=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output2.mp4':

Metadata:

encoder : Lavf56.4.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 720x48

0 [SAR 8:9 DAR 4:3], q=-1--1, 23.98 fps, 24k tbn, 23.98 tbc

Metadata:

encoder : Lavc56.1.100 libx264

Stream #0:1: Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 48000 Hz, 5.1

, s16, 488 kb/s

Metadata:

encoder : Lavc56.1.100 libfdk_aac

Stream mapping:

Stream #0:1 -> #0:0 (mpeg2video (native) -> h264 (libx264))
Stream #0:0 -> #0:1 (ac3 (native) -> aac (libfdk_aac))

Press [q] to stop, ? for help
frame= 47 fps=0.0 q=0.0 size= 0kB time=00:00:02.09 bitrate= 0.2kbits/s
frame= 67 fps= 67 q=28.0 size= 127kB time=00:00:03.28 bitrate= 317.3kbits/
frame= 83 fps= 53 q=28.0 size= 337kB time=00:00:03.94 bitrate= 699.7kbits/
frame= 95 fps= 45 q=28.0 size= 504kB time=00:00:04.52 bitrate= 912.1kbits/
frame= 111 fps= 41 q=28.0 size= 724kB time=00:00:05.29 bitrate=1121.6kbits/
frame= 127 fps= 39 q=28.0 size= 927kB time=00:00:06.18 bitrate=1227.2kbits/
frame= 139 fps= 37 q=28.0 size= 1068kB time=00:00:06.99 bitrate=1250.0kbits/
frame= 159 fps= 37 q=28.0 size= 1264kB time=00:00:07.82 bitrate=1322.8kbits/
frame= 179 fps= 37 q=28.0 size= 1441kB time=00:00:08.87 bitrate=1330.2kbits/
frame= 195 fps= 36 q=28.0 size= 1603kB time=00:00:09.74 bitrate=1346.6kbits/
frame= 211 fps= 36 q=28.0 size= 1748kB time=00:00:10.79 bitrate=1326.5kbits/
frame= 231 fps= 36 q=28.0 size= 1911kB time=00:00:11.60 bitrate=1349.0kbits/
frame= 247 fps= 36 q=28.0 size= 2051kB time=00:00:12.39 bitrate=1355.6kbits/
frame= 267 fps= 36 q=28.0 size= 2240kB time=00:00:13.46 bitrate=1363.3kbits/
frame= 287 fps= 36 q=28.0 size= 2411kB time=00:00:14.50 bitrate=1361.5kbits/
frame= 307 fps= 36 q=28.0 size= 2568kB time=00:00:15.59 bitrate=1349.0kbits/
frame= 327 fps= 36 q=28.0 size= 2726kB time=00:00:16.66 bitrate=1340.5kbits/
frame= 347 fps= 36 q=28.0 size= 2881kB time=00:00:17.45 bitrate=1352.4kbits/
frame= 367 fps= 37 q=28.0 size= 3011kB time=00:00:18.64 bitrate=1322.8kbits/
frame= 391 fps= 37 q=28.0 size= 3142kB time=00:00:19.69 bitrate=1307.0kbits/
frame= 415 fps= 38 q=28.0 size= 3247kB time=00:00:21.29 bitrate=1249.4kbits/
frame= 443 fps= 38 q=28.0 size= 3337kB time=00:00:23.08 bitrate=1184.3kbits/
frame= 471 fps= 39 q=28.0 size= 3423kB time=00:00:24.85 bitrate=1128.2kbits/
frame= 499 fps= 40 q=28.0 size= 3507kB time=00:00:26.60 bitrate=1080.0kbits/
frame= 523 fps= 40 q=28.0 size= 3581kB time=00:00:27.94 bitrate=1049.7kbits/
frame= 547 fps= 40 q=28.0 size= 3658kB time=00:00:29.20 bitrate=1026.2kbits/
frame= 567 fps= 40 q=28.0 size= 3724kB time=00:00:30.42 bitrate=1002.8kbits/
frame= 591 fps= 40 q=28.0 size= 3822kB time=00:00:31.46 bitrate= 995.0kbits/
frame= 607 fps= 40 q=25.0 size= 3902kB time=00:00:32.42 bitrate= 985.8kbits/
frame= 627 fps= 40 q=28.0 size= 4012kB time=00:00:33.36 bitrate= 985.1kbits/
frame= 647 fps= 40 q=28.0 size= 4096kB time=00:00:34.53 bitrate= 971.6kbits/
frame= 671 fps= 40 q=28.0 size= 4188kB time=00:00:35.73 bitrate= 960.1kbits/
frame= 699 fps= 41 q=28.0 size= 4282kB time=00:00:37.07 bitrate= 946.1kbits/
frame= 723 fps= 41 q=28.0 size= 4377kB time=00:00:38.37 bitrate= 934.3kbits/
frame= 747 fps= 41 q=28.0 size= 4473kB time=00:00:39.70 bitrate= 923.0kbits/
frame= 775 fps= 42 q=28.0 size= 4573kB time=00:00:41.04 bitrate= 912.8kbits/
frame= 799 fps= 42 q=28.0 size= 4663kB time=00:00:42.28 bitrate= 903.4kbits/
frame= 823 fps= 42 q=28.0 size= 4772kB time=00:00:43.81 bitrate= 892.0kbits/
frame= 847 fps= 42 q=28.0 size= 4883kB time=00:00:45.39 bitrate= 881.2kbits/
frame= 879 fps= 42 q=28.0 size= 5013kB time=00:00:47.31 bitrate= 867.8kbits/
frame= 907 fps= 43 q=28.0 size= 5140kB time=00:00:49.17 bitrate= 856.3kbits/
frame= 935 fps= 43 q=28.0 size= 5257kB time=00:00:50.85 bitrate= 846.8kbits/
frame= 971 fps= 44 q=28.0 size= 5384kB time=00:00:52.56 bitrate= 839.1kbits/
frame= 999 fps= 44 q=28.0 size= 5499kB time=00:00:53.97 bitrate= 834.7kbits/
frame= 1023 fps= 44 q=28.0 size= 5611kB time=00:00:55.44 bitrate= 829.1kbits/
frame= 1043 fps= 44 q=28.0 size= 5696kB time=00:00:56.55 bitrate= 825.1kbits/
frame= 1067 fps= 44 q=28.0 size= 5785kB time=00:00:57.70 bitrate= 821.2kbits/
frame= 1083 fps= 44 q=28.0 size= 5997kB time=00:00:58.66 bitrate= 837.4kbits/
frame= 1103 fps= 44 q=28.0 size= 6245kB time=00:00:59.41 bitrate= 861.0kbits/
frame= 1109 fps= 42 q=-1.0 Lsize= 7212kB time=00:01:00.01 bitrate= 984.5kbits
/s dup=15 drop=0
video:3598kB audio:3583kB subtitle:0kB other streams:0kB global headers:0kB muxi
ng overhead: 0.434725%
[libx264 @ 0000000001ded7c0] frame I:23 Avg QP:15.07 size: 7471
[libx264 @ 0000000001ded7c0] frame P:670 Avg QP:20.08 size: 4052
[libx264 @ 0000000001ded7c0] frame B:416 Avg QP:21.89 size: 1915
[libx264 @ 0000000001ded7c0] consecutive B-frames: 30.5% 57.3% 3.5% 8.7%
[libx264 @ 0000000001ded7c0] mb I I16..4: 62.8% 32.3% 4.9%
[libx264 @ 0000000001ded7c0] mb P I16..4: 2.3% 3.2% 0.3% P16..4: 21.5% 5.9
% 3.7% 0.0% 0.0% skip:63.1%
[libx264 @ 0000000001ded7c0] mb B I16..4: 0.5% 0.6% 0.0% B16..8: 18.7% 2.4
% 0.7% direct: 1.9% skip:75.2% L0:40.5% L1:51.3% BI: 8.2%
[libx264 @ 0000000001ded7c0] 8x8 transform intra:47.3% inter:72.0%
[libx264 @ 0000000001ded7c0] coded y,uvDC,uvAC intra: 33.1% 43.4% 22.0% inter: 9
.1% 14.1% 1.8%
[libx264 @ 0000000001ded7c0] i16 v,h,dc,p: 63% 17% 4% 15%
[libx264 @ 0000000001ded7c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 8% 31% 33% 3% 4%

3% 6% 4% 8%

[libx264 @ 0000000001ded7c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 27% 31% 4% 5%

3% 7% 3% 8%

[libx264 @ 0000000001ded7c0] i8c dc,h,v,p: 59% 24% 10% 7%
[libx264 @ 0000000001ded7c0] Weighted P-Frames: Y:31.3% UV:15.4%
[libx264 @ 0000000001ded7c0] ref P L0: 64.4% 10.4% 17.5% 6.1% 1.7%
[libx264 @ 0000000001ded7c0] ref B L0: 81.9% 17.8% 0.3%
[libx264 @ 0000000001ded7c0] ref B L1: 99.4% 0.6%
[libx264 @ 0000000001ded7c0] kb/s:637.13

in reply to:  4 comment:5 by Carl Eugen Hoyos, 10 years ago

Replying to myleal:

C:\Temp>"c:\Program Files\ffmpeg\ffmpeg.exe" -i sample.mpg -ss 00:01:00 -acodec copy -vcodec copy sample2.mpg

This command produces a media file containing only progressive video, there is nothing that you can use an inverse telecine filter for when decoding it.

comment:6 by Marcus, 10 years ago

Thank you for the response. Please close the ticket.

comment:7 by Carl Eugen Hoyos, 10 years ago

Component: documentationavfilter
Keywords: pullup decimate added
Priority: minorwish
Type: defectenhancement

I added a line to the documentation explaining that mixed telecined and progressive content is not yet supported.
The decimate filter should be improved to allow it to detect changing frame-rates so no progressive frames are dropped.

comment:8 by Carl Eugen Hoyos, 9 years ago

Do you still have the complete input stream?
The following should work, note that in the short sample you uploaded, parts are only 20fps (for example for ten seconds starting after 102 seconds), so duplicates are unavoidable, there should be no drops though:
-vf dejudder,fps=30000/1001,fieldmatch,decimate
If the dejudder filter is not used, fps drops frames.

The following does not drop any frames (but only duplicates every fourth frame as expected):

$ ffmpeg -i sample.mpg -ss 87 -qscale 2 -t 15 -an -r 30000/1001 out.avi

The following drops and duplicates many frames, this may be a bug or the timestamps in the input stream are broken (or this is a limitation of the fps filter):

$ ffmpeg -i sample.mpg -ss 87 -qscale 2 -t 15 -an -vf fps=30000/1001 out.avi

The following works fine here for the short sample, I wonder if it also works for the whole file:

$ ffmpeg -i sample.mpg -ss 87 -qscale 2 -t 15 -an -vf dejudder,fps=30000/1001 out.avi

comment:9 by Carl Eugen Hoyos, 9 years ago

Resolution: fixed
Status: openclosed

I pushed a documentation update as 3cf0c959cd76f59709dbbb71e9576121cc1d2c58 - thank you for the report!
Please reopen if there still is a major issue if you encode the whole sample, for other samples I would suggest to open a new ticket.

Note: See TracTickets for help on using tickets.