Opened 11 years ago

Closed 9 years ago

Last modified 9 years ago

#3019 closed defect (fixed)

fieldmatch + decimate causes out-of-sync audio

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

Description

Summary of the bug:
Using fieldmatch and decimate filters together throws the audio out of sync. Source video is 29.97i with 3:2 pulldown.
How to reproduce:

$ ffmpeg -ss 900 -i NCIS.ts -t 30 -vf "fieldmatch, decimate" -pix_fmt yuv420p -acodec copy -vcodec libx264 -preset ultrafast fm-decimate.mkv
ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Sep 25 2013 06:03:35 with Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-libfreetype --disable-outdev=xv --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
  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

The above produces properly detelecined video at 23.98p, but the audio is out of sync. The problems still happens if I add the yadif filter in between.

ffmpeg -ss 900 -i NCIS.ts -t 30 -vf "fieldmatch" -pix_fmt yuv420p -acodec copy -vcodec libx264 -preset ultrafast fm.mkv

With this command, audio sync is fine, but video output is 29.97p.

Change History (21)

comment:1 by Carl Eugen Hoyos, 11 years ago

Is x264 needed to reproduce the problem? If not please use -vcodec mpeg4. Please provide the complete, uncut console output to make this a valid ticket.

comment:2 by Carl Eugen Hoyos, 11 years ago

Component: undeterminedavfilter
Keywords: pullup added; ivtc filters removed

And please test current git head, there is nothing "stable" about releases, they are simply snapshots for distributors.

comment:3 by Elliott, 11 years ago

Same thing happens with mpeg4. I will try git later, I've been using macports because it's so easy.

ffmpeg -ss 00:02:00 -i NCIS.ts -t 30 -vf "fieldmatch, yadif=deint=interlaced, decimate" -pix_fmt yuv420p -acodec copy -vcodec mpeg4 ncis-mpeg4.mkv
ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Sep 25 2013 06:03:35 with Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-libfreetype --disable-outdev=xv --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
  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
Input #0, mpegts, from 'NCIS.ts':
  Duration: 00:58:56.86, start: 10892.598633, bitrate: 11280 kb/s
  Program 258 
    Stream #0:0[0xe0]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x80](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x81](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, mono, fltp, 96 kb/s (visual impaired)
Output #0, matroska, to 'ncis-mpeg4.mkv':
  Metadata:
    encoder         : Lavf55.12.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 1k tbn, 23.98 tbc
    Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), 384 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video -> mpeg4)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Frame #138 at 5.39704 is still interlacedB time=00:00:04.74 bitrate=2319.6kbits/s    
frame=  720 fps= 26 q=31.0 Lsize=    6871kB time=00:00:30.03 bitrate=1874.3kbits/s    
video:5455kB audio:1401kB subtitle:0 global headers:0kB muxing overhead 0.207562%

comment:4 by Elliott, 11 years ago

Same thing happens with latest git version.

ffmpeg -i NCIS.ts -ss 00:02:00 -t 30 -vf "fieldmatch, yadif=deint=interlaced, decimate" -acodec copy -vcodec mpeg4 test.mkv
ffmpeg version N-56820-g5e253fd Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct  2 2013 09:37:06 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --enable-gpl --enable-version3 --enable-postproc --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libass --enable-libopenjpeg --enable-openssl --enable-libopus --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-yasm --enable-swscale --enable-avfilter --enable-libmodplug --enable-libbluray --enable-gnutls --enable-shared --enable-pthreads --arch=x86_64 --enable-nonfree --enable-opencl --enable-avresample
  libavutil      52. 46.100 / 52. 46.100
  libavcodec     55. 33.101 / 55. 33.101
  libavformat    55. 18.104 / 55. 18.104
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 88.100 /  3. 88.100
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mpegts, from 'NCIS.ts':
  Duration: 00:58:56.86, start: 10892.598633, bitrate: 11280 kb/s
  Program 258 
    Stream #0:0[0xe0]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], max. 79975 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x80](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x81](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, mono, fltp, 96 kb/s (visual impaired)
Output #0, matroska, to 'test.mkv':
  Metadata:
    encoder         : Lavf55.18.104
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 1k tbn, 23.98 tbc
    Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), 384 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video -> mpeg4)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=    0 fps=0.0 q=0.0 Lsize=       1kB time=00:00:00.00 bitrate=N/A    
video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead 1353.191489%
Received signal 2: terminating.
macpro:NCIS.eyetv elliott$ ffmpeg -ss 00:02:00 -i NCIS.ts -t 30 -vf "fieldmatch, yadif=deint=interlaced, decimate" -acodec copy -vcodec mpeg4 test.mkv
ffmpeg version N-56820-g5e253fd Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct  2 2013 09:37:06 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --enable-gpl --enable-version3 --enable-postproc --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libass --enable-libopenjpeg --enable-openssl --enable-libopus --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-yasm --enable-swscale --enable-avfilter --enable-libmodplug --enable-libbluray --enable-gnutls --enable-shared --enable-pthreads --arch=x86_64 --enable-nonfree --enable-opencl --enable-avresample
  libavutil      52. 46.100 / 52. 46.100
  libavcodec     55. 33.101 / 55. 33.101
  libavformat    55. 18.104 / 55. 18.104
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 88.100 /  3. 88.100
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mpegts, from 'NCIS.ts':
  Duration: 00:58:56.86, start: 10892.598633, bitrate: 11280 kb/s
  Program 258 
    Stream #0:0[0xe0]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], max. 79975 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x80](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x81](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, mono, fltp, 96 kb/s (visual impaired)
File 'test.mkv' already exists. Overwrite ? [y/N] y
Output #0, matroska, to 'test.mkv':
  Metadata:
    encoder         : Lavf55.18.104
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 1k tbn, 23.98 tbc
    Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), 384 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video -> mpeg4)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[Parsed_fieldmatch_0 @ 0x7fc4fa800000] Frame #138 at 5.39704 is still interlaceds    
frame=  720 fps= 20 q=31.0 Lsize=    6856kB time=00:00:30.03 bitrate=1870.2kbits/s    
video:5440kB audio:1401kB subtitle:0 global headers:0kB muxing overhead 0.212005%

comment:5 by Elliott, 11 years ago

Version: 2.0.1git-master

comment:6 by Elon Musk, 11 years ago

Perhaps this depends on specific input?

comment:7 by Carl Eugen Hoyos, 11 years ago

Please provide the input sample.

comment:8 by Elliott, 11 years ago

Here is a sample. The header might be broken because I trimmed it using dd, but it should still work. It's MPEG2 video with 5.1 AC3 audio.
https://docs.google.com/file/d/0B52QuT8oHvtZcDNFNjdTaXpNdms/

comment:9 by Carl Eugen Hoyos, 11 years ago

Reproduced by developer: set
Status: newopen

(transport streams do not have a header.)

The problem is reproducible:

$ ffmpeg -i NCIS-trim.ts -vf fieldmatch,decimate -qscale 2 out.avi
ffmpeg version N-56827-g64327aa Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct  3 2013 00:11:23 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      52. 46.100 / 52. 46.100
  libavcodec     55. 33.101 / 55. 33.101
  libavformat    55. 19.100 / 55. 19.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 88.100 /  3. 88.100
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
[mpeg2video @ 0x32058c0] Invalid frame dimensions 0x0.
    Last message repeated 2 times
Input #0, mpegts, from 'NCIS-trim.ts':
  Duration: 00:00:54.76, start: 11120.950633, bitrate: 15319 kb/s
  Program 258
    Stream #0:0[0xe0]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], max. 79975 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x80](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x81](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, mono, fltp, 96 kb/s (visual impaired)
Please use -q:a or -q:v, -qscale is ambiguous
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf55.19.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 23.98 tbn, 23.98 tbc
    Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 448 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video -> mpeg4)
  Stream #0:1 -> #0:1 (ac3 -> ac3)
Press [q] to stop, [?] for help
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #1 at 0.837678 is still interlaced
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #2 at 0.871044 is still interlaced
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #4 at 0.937778 is still interlaced
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #5 at 0.971144 is still interlaced
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #9 at 1.10461 is still interlaced
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #11 at 1.17134 is still interlaced
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #12 at 1.20471 is still interlaced
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #14 at 1.27144 is still interlacedkbits/s
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #15 at 1.30481 is still interlaced
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #16 at 1.33818 is still interlaced
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #17 at 1.37154 is still interlaced
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #26 at 1.67184 is still interlaced
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #28 at 1.73858 is still interlaced
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #29 at 1.77194 is still interlacedkbits/s
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #34 at 1.93878 is still interlaced
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #36 at 2.00551 is still interlaced
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #37 at 2.03888 is still interlaced
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #56 at 2.67284 is still interlacedkbits/s
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #57 at 2.70621 is still interlaced
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #61 at 2.83968 is still interlacedkbits/s
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #62 at 2.87304 is still interlaced
[Parsed_fieldmatch_0 @ 0x31eb2e0] Frame #497 at 17.3875 is still interlacedbits/s
[mpeg2video @ 0x32058c0] ac-tex damaged at 19 150:00:54.01 bitrate=13201.0kbits/s
[mpeg2video @ 0x32058c0] Warning MVs not available
[mpeg2video @ 0x32058c0] concealing 6360 DC, 6360 AC, 6360 MV errors in B frame
frame= 1294 fps= 41 q=2.0 Lsize=   87558kB time=00:00:54.01 bitrate=13278.9kbits/s
video:84523kB audio:2954kB subtitle:0 global headers:0kB muxing overhead 0.091787%

out.avi plays horribly out-of-sync, this does not change with -ss 4 (to skip the problematic frames in the beginning).
(It should be noted imo that both filmdint and pullup have no problem with the frame at 17.3875.)

The following is just for the record:
The following two command lines seem to work fine, ie no combing artefacts in the output file which (at least mostly) in-sync:
$ mencoder NCIS-trim.ts -ovc lavc -lavcopts vqscale=2 -oac faac -vf filmdint -ofps 24000/1001 -o out.avi -demuxer lavf
$ mencoder NCIS-trim.ts -ovc lavc -lavcopts vqscale=2 -oac faac -vf pullup -ofps 24000/1001 -o out.avi -demuxer lavf

The following produces a file that plays in sync but the inverse telecine process mostly / completely fails: two out of four frames are still interlaced:

$ ffmpeg -i NCIS-trim.ts -vf pullup,fps=24000/1001 -qscale 2 out.avi
ffmpeg version N-56827-g64327aa Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct  3 2013 00:11:23 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      52. 46.100 / 52. 46.100
  libavcodec     55. 33.101 / 55. 33.101
  libavformat    55. 19.100 / 55. 19.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 88.100 /  3. 88.100
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
[mpeg2video @ 0x1b248c0] Invalid frame dimensions 0x0.
    Last message repeated 2 times
Input #0, mpegts, from 'NCIS-trim.ts':
  Duration: 00:00:54.76, start: 11120.950633, bitrate: 15319 kb/s
  Program 258
    Stream #0:0[0xe0]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv,                  bt709), 1920x1080 [SAR 1:1 DAR 16:9], max. 79975 kb/s, 29.97 fps, 29.97 tbr, 90k tbn,                  59.94 tbc
    Stream #0:1[0x80](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp                 , 384 kb/s
    Stream #0:2[0x81](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, mono, fltp, 96                  kb/s (visual impaired)
Please use -q:a or -q:v, -qscale is ambiguous
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf55.19.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080 [SAR 1:1 DAR 16                 :9], q=2-31, 200 kb/s, 23.98 tbn, 23.98 tbc
    Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 44                 8 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video -> mpeg4)
  Stream #0:1 -> #0:1 (ac3 -> ac3)
Press [q] to stop, [?] for help
[mpeg2video @ 0x1b248c0] ac-tex damaged at 19 150:00:54.34 bitrate=19299.5kbits/s
[mpeg2video @ 0x1b248c0] Warning MVs not available
[mpeg2video @ 0x1b248c0] concealing 6360 DC, 6360 AC, 6360 MV errors in B frame
frame= 1291 fps= 84 q=2.0 Lsize=  129571kB time=00:00:54.72 bitrate=19397.3kbits/s
video:126536kB audio:2954kB subtitle:0 global headers:0kB muxing overhead 0.062330%
Version 0, edited 11 years ago by Carl Eugen Hoyos (next)

comment:10 by Carl Eugen Hoyos, 11 years ago

The following command works fine now:

$ ffmpeg -i NCIS-trim.ts -vf pullup -r 24000/1001 -qscale 2 out.avi

The following produces an output file that is inverse telecined but contains wrong duplicates/skips for every block of five frames:

$ ffmpeg -i NCIS-trim.ts -vf pullup,fps=24000/1001 -qscale 2 out.avi

indicating that my pullup documentation patch was wrong / does not really help users.

comment:11 by Carl Eugen Hoyos, 11 years ago

The original desync problem is also reproducible with the following command line:

$ ffmpeg -i NCIS-trim.ts -vf pullup,decimate -qscale 2 out.avi
ffmpeg version N-56994-g19fda0a Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct  9 2013 15:38:08 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      52. 46.101 / 52. 46.101
  libavcodec     55. 35.100 / 55. 35.100
  libavformat    55. 19.100 / 55. 19.100
  libavdevice    55.  4.100 / 55.  4.100
  libavfilter     3. 88.101 /  3. 88.101
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
[mpeg2video @ 0x20c58c0] Invalid frame dimensions 0x0.
    Last message repeated 2 times
Input #0, mpegts, from 'NCIS-trim.ts':
  Duration: 00:00:54.76, start: 11120.950633, bitrate: 15319 kb/s
  Program 258
    Stream #0:0[0xe0]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], max. 79975 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x80](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x81](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, mono, fltp, 96 kb/s (visual impaired)
Please use -q:a or -q:v, -qscale is ambiguous
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf55.19.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 23.98 tbn, 23.98 tbc
    Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 448 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video -> mpeg4)
  Stream #0:1 -> #0:1 (ac3 -> ac3)
Press [q] to stop, [?] for help
[mpeg2video @ 0x20c58c0] ac-tex damaged at 19 150:00:52.76 bitrate=10965.4kbits/s
[mpeg2video @ 0x20c58c0] Warning MVs not available
[mpeg2video @ 0x20c58c0] concealing 6360 DC, 6360 AC, 6360 MV errors in B frame
frame= 1038 fps= 56 q=2.0 Lsize=   72747kB time=00:00:54.01 bitrate=11032.7kbits/s
video:69718kB audio:2954kB subtitle:0 global headers:0kB muxing overhead 0.102079%

comment:12 by Elon Musk, 11 years ago

I posted patch on mailing list, which may fix async issues.
It would be nice if someone confirm it fixes this bug.

in reply to:  11 comment:13 by Carl Eugen Hoyos, 11 years ago

Replying to cehoyos:

The original desync problem is also reproducible with the following command line:

$ ffmpeg -i NCIS-trim.ts -vf pullup,decimate -qscale 2 out.avi

This is plain wrong, the pullup filter cannot work in combination with decimate.

comment:14 by Elon Musk, 11 years ago

Why you think that?

comment:15 by Carl Eugen Hoyos, 11 years ago

Afaiu, the output of pullup (for NTSC telecined input) is not ~30fps CFR but that is what decimate requires as input to produce ~24fps output.

comment:16 by Elon Musk, 11 years ago

Generally - pullup filter does not need decimate.
Should pullup filter change pts, certainly, i'm interested in such solution.

comment:17 by Carl Eugen Hoyos, 11 years ago

Keywords: decimate added
Resolution: fixed
Status: openclosed

The original issue was fixed in e4b0a770 - thank you for the particularly useful report!

Documentation update for pullup awaiting review.

comment:18 by Detergent, 9 years ago

Reproduced by developer: unset
Resolution: fixed
Status: closedreopened

Hi, reopening this issue as I have this problem in 2.7.1 with another 29,97i file. Here's an extract :

https://drive.google.com/file/d/0Bz_fz7x43dCZanJxUE9tVVF1R0k/view?usp=sharing

The command I used was the following :

ffmpeg -i TD-trim.ts -vf fieldmatch,yadif=deint=interlaced,decimate -vcodec libx264 -preset faster -acodec copy out.mkv

What seems to happen is that too many frames are dropped, and the result, while tagged as 23,976p, is accelerated and causes out-of-sync audio. Same thing without the yadif filter.

I also tested this command with the NCIS-trim.ts file attached here and it works fine, so there's another problem.

in reply to:  18 comment:19 by Carl Eugen Hoyos, 9 years ago

Reproduced by developer: set
Resolution: fixed
Status: reopenedclosed

Replying to Detergent:

Hi, reopening this issue as I have this problem in 2.7.1 with another 29,97i file.

Generally, please only reopen tickets if they are (still) reproducible with the same sample, open a new ticket for other files.

Your file is not telecined and therefore cannot be inverse telecined.

comment:20 by Detergent, 9 years ago

I see, sorry for the false report then ! My bad.

Would you mind explaining what is the process in this file then ? If it's 29.97i but not telecined, what kind of dark magic was applied on it then ? Because there are still frame duplicates here and there, and a mix of progressive + interlaced :( .

in reply to:  20 comment:21 by Carl Eugen Hoyos, 9 years ago

Replying to Detergent:

Would you mind explaining what is the process in this file then ?

I don't know, maybe deinterlacing and / or frame interpolation was used.

Note: See TracTickets for help on using tickets.