#9316 closed defect (wontfix)

nnedi af mode causes flicker at top and bottom row

Reported by: Tom B Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: nnedi
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Tom B)

I'm using the following filter:

-vf nnedi=weights.bin:all:af

This generally works great, however, when converting 50i to 50p footage it causes a flicker at the top and bottom field in most frames.

It seems that odd frames are simply black. It would be good if it used a bob/weave here as the result is distracting. yadif=1 produces worse results overall (e.g. scrolling text looks horrible) but does not produce this same flicker.

This doesn't just happen on PAL videos like this with a black half row at the top/bottom. It happens on any video when af is specified.

Using a mode works fine but obviously drops 50% of frames.

I hadn't realised that the attachment limit was 2.5mb on here. Here are the videos:

Original video https://r.je/tmp/original.mkv

-vf nnedi=weights.bin:all:af https://r.je/tmp/nnedi.mkv

Change History (6)

comment:1 by Tom B, 12 months ago

Description: modified (diff)

comment:2 by Carl Eugen Hoyos, 12 months ago

Keywords: nnedi added

Please provide the command line you tested together with the complete, uncut console output to make this a valid ticket.

comment:3 by Tom B, 12 months ago

Command: ffmpeg -i "original.mkv" -c:v libx265 -crf 23 -vf nnedi=weights.bin:all:af -c:a copy nnedi.mkv

wights.bin is from here: https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin as per ffmpeg documentation.

Output:

ffmpeg version n4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-openssl --enable-shared --enable-version3 --enable-libfdk_aac --enable-nonfree
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, matroska,webm, from 'original.mkv':
  Metadata:
    ENCODER         : Lavf58.76.100
  Duration: 00:00:05.08, start: 0.000000, bitrate: 4532 kb/s
  Chapters:
    Chapter #0:0: start 0.000000, end 5.000000
      Metadata:
        title           : Chapter 01
  Stream #0:0(eng): Video: mpeg2video (Main), yuv420p(tv, bt470bg, top first), 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Metadata:
      BPS-eng         : 4979095
      DURATION-eng    : 00:28:57.000000000
      NUMBER_OF_FRAMES-eng: 43425
      NUMBER_OF_BYTES-eng: 1081086192
      SOURCE_ID-eng   : 0100E0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.16.3 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2021-06-29 16:06:43
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      DURATION        : 00:00:05.080000000
    Side data:
      cpb: bitrate max/min/avg: 9800000/0/0 buffer size: 1835008 vbv_delay: N/A
  Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      title           : Stereo
      BPS-eng         : 192000
      DURATION-eng    : 00:28:56.800000000
      NUMBER_OF_FRAMES-eng: 54275
      NUMBER_OF_BYTES-eng: 41683200
      SOURCE_ID-eng   : 0180BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.16.3 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2021-06-29 16:06:43
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      DURATION        : 00:00:05.024000000
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> hevc (libx265))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
x265 [info]: HEVC encoder version 3.5
x265 [info]: build info [Linux][GCC 10.2.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [info]: Main profile, Level-3.1 (Main tier)
x265 [info]: Thread pool created using 32 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 5 / wpp(9 rows)
x265 [warning]: Source height < 720p; disabling lookahead-slices
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias  : 25 / 250 / 40 / 5.00 
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-23.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
x265 [info]: tools: b-intra strong-intra-smoothing deblock sao
Output #0, matroska, to 'nnedi.mkv':
  Metadata:
    encoder         : Lavf58.76.100
  Chapters:
    Chapter #0:0: start 0.000000, end 5.000000
      Metadata:
        title           : Chapter 01
  Stream #0:0(eng): Video: hevc, yuv420p(tv, bt470bg, progressive), 720x576 [SAR 16:15 DAR 4:3], q=2-31, 50 fps, 1k tbn (default)
    Metadata:
      BPS-eng         : 4979095
      DURATION-eng    : 00:28:57.000000000
      NUMBER_OF_FRAMES-eng: 43425
      NUMBER_OF_BYTES-eng: 1081086192
      SOURCE_ID-eng   : 0100E0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.16.3 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2021-06-29 16:06:43
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      DURATION        : 00:00:05.080000000
      encoder         : Lavc58.134.100 libx265
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
  Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      title           : Stereo
      BPS-eng         : 192000
      DURATION-eng    : 00:28:56.800000000
      NUMBER_OF_FRAMES-eng: 54275
      NUMBER_OF_BYTES-eng: 41683200
      SOURCE_ID-eng   : 0180BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.16.3 linux(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2021-06-29 16:06:43
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      DURATION        : 00:00:05.024000000
frame=  252 fps= 64 q=31.8 Lsize=     825kB time=00:00:05.00 bitrate=1351.9kbits/s speed=1.27x    
video:701kB audio:118kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.838927%
x265 [info]: frame I:      2, Avg QP:27.07  kb/s: 4427.80 
x265 [info]: frame P:     59, Avg QP:27.45  kb/s: 2916.88 
x265 [info]: frame B:    191, Avg QP:32.00  kb/s: 553.15  
x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%
x265 [info]: consecutive B-frames: 11.5% 3.3% 6.6% 18.0% 60.7% 

encoded 252 frames in 3.86s (65.29 fps), 1137.32 kb/s, Avg QP:30.90
Last edited 12 months ago by Carl Eugen Hoyos (previous) (diff)

comment:4 by Carl Eugen Hoyos, 12 months ago

Is the issue reproducible with current FFmpeg git head, the only version supported on this bug tracker?

comment:5 by Tom B, 12 months ago

I've just installed ffmpeg from https://aur.archlinux.org/packages/ffmpeg-git/ which pulls it from: https://git.ffmpeg.org/ffmpeg.git

The output is the same. nnedi af mode gives gives flickering top.bottom rows.

`
ffmpeg -i "original.mkv" -c:v libx265 -crf 23 -vf nnedi=weights.bin:all:af -c:a copy nnedi.mkv
ffmpeg version N-102841-g041267b558 Copyright (c) 2000-2021 the FFmpeg developers

built with gcc 11.1.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
libavutil 57. 0.100 / 57. 0.100
libavcodec 59. 3.101 / 59. 3.101
libavformat 59. 4.100 / 59. 4.100
libavdevice 59. 0.100 / 59. 0.100
libavfilter 8. 0.103 / 8. 0.103
libswscale 6. 0.100 / 6. 0.100
libswresample 4. 0.100 / 4. 0.100
libpostproc 56. 0.100 / 56. 0.100

Input #0, matroska,webm, from 'original.mkv':

Metadata:

ENCODER : Lavf58.76.100

Duration: 00:00:05.08, start: 0.000000, bitrate: 4532 kb/s
Chapters:

Chapter #0:0: start 0.000000, end 5.000000

Metadata:

title : Chapter 01

Stream #0:0(eng): Video: mpeg2video (Main), yuv420p(tv, bt470bg, top first), 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 1k tbn (default)

Metadata:

BPS-eng : 4979095
DURATION-eng : 00:28:57.000000000
NUMBER_OF_FRAMES-eng: 43425
NUMBER_OF_BYTES-eng: 1081086192
SOURCE_ID-eng : 0100E0
_STATISTICS_WRITING_APP-eng: MakeMKV v1.16.3 linux(x64-release)
_STATISTICS_WRITING_DATE_UTC-eng: 2021-06-29 16:06:43
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
DURATION : 00:00:05.080000000

Side data:

cpb: bitrate max/min/avg: 9800000/0/0 buffer size: 1835008 vbv_delay: N/A

Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)

Metadata:

title : Stereo
BPS-eng : 192000
DURATION-eng : 00:28:56.800000000
NUMBER_OF_FRAMES-eng: 54275
NUMBER_OF_BYTES-eng: 41683200
SOURCE_ID-eng : 0180BD
_STATISTICS_WRITING_APP-eng: MakeMKV v1.16.3 linux(x64-release)
_STATISTICS_WRITING_DATE_UTC-eng: 2021-06-29 16:06:43
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
DURATION : 00:00:05.024000000

File 'nnedi.mkv' already exists. Overwrite? [y/N] y
Stream mapping:

Stream #0:0 -> #0:0 (mpeg2video (native) -> hevc (libx265))
Stream #0:1 -> #0:1 (copy)

Press [q] to stop, ? for help
x265 [info]: HEVC encoder version 3.5
x265 [info]: build info [Linux][GCC 10.2.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [info]: Main profile, Level-3.1 (Main tier)
x265 [info]: Thread pool created using 32 threads
x265 [info]: Slices : 1
x265 [info]: frame threads / pool features : 5 / wpp(9 rows)
x265 [warning]: Source height < 720p; disabling lookahead-slices
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias : 25 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb : 1 / 1 / 0
x265 [info]: References / ref-limit cu / depth : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress : CRF-23.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
x265 [info]: tools: b-intra strong-intra-smoothing deblock sao
Output #0, matroska, to 'nnedi.mkv':

Metadata:

encoder : Lavf59.4.100

Chapters:

Chapter #0:0: start 0.000000, end 5.000000

Metadata:

title : Chapter 01

Stream #0:0(eng): Video: hevc, yuv420p(tv, bt470bg, progressive), 720x576 [SAR 16:15 DAR 4:3], q=2-31, 50 fps, 1k tbn (default)

Metadata:

BPS-eng : 4979095
DURATION-eng : 00:28:57.000000000
NUMBER_OF_FRAMES-eng: 43425
NUMBER_OF_BYTES-eng: 1081086192
SOURCE_ID-eng : 0100E0
_STATISTICS_WRITING_APP-eng: MakeMKV v1.16.3 linux(x64-release)
_STATISTICS_WRITING_DATE_UTC-eng: 2021-06-29 16:06:43
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
DURATION : 00:00:05.080000000
encoder : Lavc59.3.101 libx265

Side data:

cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A

Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s (default)

Metadata:

title : Stereo
BPS-eng : 192000
DURATION-eng : 00:28:56.800000000
NUMBER_OF_FRAMES-eng: 54275
NUMBER_OF_BYTES-eng: 41683200
SOURCE_ID-eng : 0180BD
_STATISTICS_WRITING_APP-eng: MakeMKV v1.16.3 linux(x64-release)
_STATISTICS_WRITING_DATE_UTC-eng: 2021-06-29 16:06:43
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
DURATION : 00:00:05.024000000

frame= 252 fps= 64 q=31.8 Lsize= 825kB time=00:00:05.02 bitrate=1345.7kbits/s speed=1.28x
video:701kB audio:118kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.838331%
x265 [info]: frame I: 2, Avg QP:27.07 kb/s: 4427.80
x265 [info]: frame P: 59, Avg QP:27.45 kb/s: 2916.88
x265 [info]: frame B: 191, Avg QP:32.00 kb/s: 553.15
x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%
x265 [info]: consecutive B-frames: 11.5% 3.3% 6.6% 18.0% 60.7%

encoded 252 frames in 3.84s (65.67 fps), 1137.32 kb/s, Avg QP:30.90
[tom@desktop test]$ ffplay nnedi.mkv
ffplay version N-102841-g041267b558 Copyright (c) 2003-2021 the FFmpeg developers

built with gcc 11.1.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
libavutil 57. 0.100 / 57. 0.100
libavcodec 59. 3.101 / 59. 3.101
libavformat 59. 4.100 / 59. 4.100
libavdevice 59. 0.100 / 59. 0.100
libavfilter 8. 0.103 / 8. 0.103
libswscale 6. 0.100 / 6. 0.100
libswresample 4. 0.100 / 4. 0.100
libpostproc 56. 0.100 / 56. 0.100

Input #0, matroska,webm, from 'nnedi.mkv': 0KB sq= 0B f=0/0

Metadata:

ENCODER : Lavf59.4.100

Duration: 00:00:05.08, start: 0.000000, bitrate: 1330 kb/s
Chapters:

Chapter #0:0: start 0.000000, end 5.000000

Metadata:

title : Chapter 01

Stream #0:0(eng): Video: hevc (Main), yuv420p(tv, bt470bg, progressive), 720x576 [SAR 16:15 DAR 4:3], 50 fps, 50 tbr, 1k tbn (default)

Metadata:

BPS-eng : 4979095
DURATION-eng : 00:28:57.000000000
NUMBER_OF_FRAMES-eng: 43425
NUMBER_OF_BYTES-eng: 1081086192
SOURCE_ID-eng : 0100E0
_STATISTICS_WRITING_APP-eng: MakeMKV v1.16.3 linux(x64-release)
_STATISTICS_WRITING_DATE_UTC-eng: 2021-06-29 16:06:43
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
ENCODER : Lavc59.3.101 libx265
DURATION : 00:00:05.080000000

Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)

Metadata:

title : Stereo
BPS-eng : 192000
DURATION-eng : 00:28:56.800000000
NUMBER_OF_FRAMES-eng: 54275
NUMBER_OF_BYTES-eng: 41683200
SOURCE_ID-eng : 0180BD
_STATISTICS_WRITING_APP-eng: MakeMKV v1.16.3 linux(x64-release)
_STATISTICS_WRITING_DATE_UTC-eng: 2021-06-29 16:06:43
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
DURATION : 00:00:05.024000000

2.18 A-V: -0.006 fd= 14 aq= 24KB vq= 177KB sq= 0B f=0/0

`

`
$ ffmpeg -version
ffmpeg version N-102841-g041267b558 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11.1.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
libavutil 57. 0.100 / 57. 0.100
libavcodec 59. 3.101 / 59. 3.101
libavformat 59. 4.100 / 59. 4.100
libavdevice 59. 0.100 / 59. 0.100
libavfilter 8. 0.103 / 8. 0.103
libswscale 6. 0.100 / 6. 0.100
libswresample 4. 0.100 / 4. 0.100
libpostproc 56. 0.100 / 56. 0.100
`

comment:6 by Elon Musk, 12 months ago

Resolution: wontfix
Status: newclosed

This is intended behavior, as filter is intra only deinterlacer.

Feature could be added to export mask from filters like bwdif or yadif so pixels that are intra only interpolated uses actually nnedi filter (or estdif filter) algorithm, and thus final output is combination of both filters.

Note: See TracTickets for help on using tickets.