[FFmpeg-trac] #9164(undetermined:new): Blackdetect filter PTS return limited to six digits

FFmpeg trac at avcodec.org
Fri Mar 26 22:21:29 EET 2021

#9164: Blackdetect filter PTS return limited to six digits
             Reporter:               |                     Type:
  livingroomg3                       |  enhancement
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:  4.3.2
  undetermined                       |
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
 Summary of the bug: blackdetect filter is returning a maximum of six
 digits for pts values. This doesn't give enough precision for frame-
 accurate results. You'll notice that all detected blacks have a maximum of
 six digits returned for the pts time. The early detected blacks have good
 precision. As the file progresses the precision is reduced and numbers are
 rounded. I.e. towards the end of the file precision is lowered to two
 digits to keep the total number of digits to six.

 How to reproduce:
 % ffmpeg -loglevel info -i input.mp4 -vf blackdetect=d=0.2:pix_th=0.2 -f
 null -y /dev/null
 ffmpeg version 4.2.3

 macbook-pro:~ $ ffmpeg -loglevel info -i ABC_R1.mp4 -vf
 blackdetect=d=0.2:pix_th=0.2 -f null -y /dev/null
 ffmpeg version 4.3.2 Copyright (c) 2000-2021 the FFmpeg developers
   built with Apple clang version 12.0.0 (clang-1200.0.32.29)
   configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.2-with-options
 --enable-shared --cc=clang --host-cflags= --host-ldflags= --enable-gpl
 --enable-libaom --enable-libdav1d --enable-libmp3lame --enable-libopus
 --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx
 --enable-libx264 --enable-libx265 --enable-libfontconfig --enable-
 libfreetype --enable-frei0r --enable-libass --enable-demuxer=dash
 --disable-libjack --disable-indev=jack --enable-opencl --enable-
 videotoolbox --disable-htmlpages --enable-libtesseract
   libavutil      56. 51.100 / 56. 51.100
   libavcodec     58. 91.100 / 58. 91.100
   libavformat    58. 45.100 / 58. 45.100
   libavdevice    58. 10.100 / 58. 10.100
   libavfilter     7. 85.100 /  7. 85.100
   libswscale      5.  7.100 /  5.  7.100
   libswresample   3.  7.100 /  3.  7.100
   libpostproc    55.  7.100 / 55.  7.100
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'ABC_R1.mp4':
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2avc1mp41
     encoder         : Lavf58.45.100
   Duration: 01:06:37.43, start: 0.000000, bitrate: 460 kb/s
     Stream #0:0(eng): Video: h264 (High 4:2:2) (avc1 / 0x31637661),
 yuv422p10le, 640x480 [SAR 4:3 DAR 16:9], 410 kb/s, 23.98 fps, 23.98 tbr,
 24k tbn, 47.95 tbc (default)
       handler_name    : Apple Video Media Handler
       timecode        : 00:57:30:00
     Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono,
 fltp, 44 kb/s (default)
       handler_name    : Apple Sound Media Handler
     Stream #0:2(eng): Data: none (tmcd / 0x64636D74)
       handler_name    : Apple Video Media Handler
       timecode        : 00:57:30:00
 Stream mapping:
   Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
   Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native))
 Press [q] to stop, [?] for help
 Output #0, null, to '/dev/null':
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2avc1mp41
     encoder         : Lavf58.45.100
     Stream #0:0(eng): Video: wrapped_avframe, yuv422p, 640x480 [SAR 4:3
 DAR 16:9], q=2-31, 200 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc (default)
       handler_name    : Apple Video Media Handler
       timecode        : 00:57:30:00
       encoder         : Lavc58.91.100 wrapped_avframe
     Stream #0:1(eng): Audio: pcm_s16le, 48000 Hz, mono, s16, 768 kb/s
       handler_name    : Apple Sound Media Handler
       encoder         : Lavc58.91.100 pcm_s16le
 [blackdetect @ 0x7fc080c0f7c0] black_start:0 black_end:20.02
 frame= 1426 fps=1425 q=-0.0 size=N/A time=00:01:00.09 bitrate=N/A speed=
 60x   frame= 2190 fps=1459 q=-0.0 size=N/A time=00:01:31.94 bitrate=N/A
 speed=61.2x   frame= 2953 fps=1475 q=-0.0 size=N/A time=00:02:03.77
 bitrate=N/A speed=61.8x   [blackdetect @ 0x7fc080c0f7c0] black_start:90.09
 black_end:150.275 black_duration:60.1851
 frame= 3690 fps=1475 q=-0.0 size=N/A time=00:02:34.51 bitrate=N/A
 speed=61.8x   [blackdetect @ 0x7fc080c0f7c0] black_start:155.489
 black_end:156.114 black_duration:0.625625
 [blackdetect @ 0x7fc080c0f7c0] black_start:164.873 black_end:167.417
 frame= 4413 fps=1470 q=-0.0 size=N/A time=00:03:04.68 bitrate=N/A
 speed=61.5x   frame= 5121 fps=1462 q=-0.0 size=N/A time=00:03:34.20
 bitrate=N/A speed=61.2x   [blackdetect @ 0x7fc080c0f7c0]
 black_start:227.519 black_end:229.396 black_duration:1.87687
 frame= 5836 fps=1458 q=-0.0 size=N/A time=00:04:04.01 bitrate=N/A speed=
 61x   frame= 6568 fps=1459 q=-0.0 size=N/A time=00:04:34.56 bitrate=N/A
 speed=  61x   frame= 7305 fps=1460 q=-0.0 size=N/A time=00:05:05.30
 bitrate=N/A speed=  61x   frame= 8000 fps=1454 q=-0.0 size=N/A
 time=00:05:34.27 bitrate=N/A speed=60.7x   frame= 8719 fps=1452 q=-0.0
 size=N/A time=00:06:04.26 bitrate=N/A speed=60.7x   frame= 9432 fps=1450
 q=-0.0 size=N/A time=00:06:34.00 bitrate=N/A speed=60.6x   frame=10173
 fps=1452 q=-0.0 size=N/A time=00:07:04.91 bitrate=N/A speed=60.7x
 frame=10899 fps=1452 q=-0.0 size=N/A time=00:07:35.18 bitrate=N/A
 speed=60.6x   frame=11630 fps=1453 q=-0.0 size=N/A time=00:08:05.67
 bitrate=N/A speed=60.7x   frame=12370 fps=1454 q=-0.0 size=N/A
 time=00:08:36.54 bitrate=N/A speed=60.7x   frame=13117 fps=1456 q=-0.0
 size=N/A time=00:09:07.71 bitrate=N/A speed=60.8x   frame=13867 fps=1459
 q=-0.0 size=N/A time=00:09:38.98 bitrate=N/A speed=60.9x   frame=14612
 fps=1460 q=-0.0 size=N/A time=00:10:10.04 bitrate=N/A speed=  61x
 frame=15356 fps=1461 q=-0.0 size=N/A time=00:10:41.08 bitrate=N/A speed=
 61x   frame=16076 fps=1460 q=-0.0 size=N/A time=00:11:11.12 bitrate=N/A
 speed=  61x   [blackdetect @ 0x7fc080c0f7c0] black_start:679.095
 black_end:686.853 black_duration:7.75775
 frame=16809 fps=1461 q=-0.0 size=N/A time=00:11:41.69 bitrate=N/A speed=
 61x   frame=17540 fps=1461 q=-0.0 size=N/A time=00:12:12.18 bitrate=N/A
 speed=  61x   frame=18278 fps=1461 q=-0.0 size=N/A time=00:12:42.96
 bitrate=N/A speed=  61x   frame=18977 fps=1459 q=-0.0 size=N/A
 time=00:13:12.10 bitrate=N/A speed=60.9x   frame=19705 fps=1459 q=-0.0
 size=N/A time=00:13:42.48 bitrate=N/A speed=60.9x   [blackdetect @
 0x7fc080c0f7c0] black_start:835.126 black_end:838.546
 frame=20432 fps=1458 q=-0.0 size=N/A time=00:14:12.80 bitrate=N/A
 speed=60.9x   frame=21172 fps=1459 q=-0.0 size=N/A time=00:14:43.66
 bitrate=N/A speed=60.9x   frame=21855 fps=1456 q=-0.0 size=N/A
 time=00:15:12.14 bitrate=N/A speed=60.8x   [blackdetect @ 0x7fc080c0f7c0]
 black_start:925.258 black_end:925.508 black_duration:0.25025
 frame=22560 fps=1454 q=-0.0 size=N/A time=00:15:41.54 bitrate=N/A
 speed=60.7x   frame=23286 fps=1454 q=-0.0 size=N/A time=00:16:11.84
 bitrate=N/A speed=60.7x   frame=23992 fps=1453 q=-0.0 size=N/A
 time=00:16:41.28 bitrate=N/A speed=60.6x   frame=24720 fps=1453 q=-0.0
 size=N/A time=00:17:11.63 bitrate=N/A speed=60.6x   frame=25422 fps=1452
 q=-0.0 size=N/A time=00:17:40.92 bitrate=N/A speed=60.6x   frame=26143
 fps=1451 q=-0.0 size=N/A time=00:18:10.98 bitrate=N/A speed=60.6x
 frame=26869 fps=1451 q=-0.0 size=N/A time=00:18:41.28 bitrate=N/A
 speed=60.6x   frame=27601 fps=1452 q=-0.0 size=N/A time=00:19:11.80
 bitrate=N/A speed=60.6x   frame=28320 fps=1451 q=-0.0 size=N/A
 time=00:19:41.80 bitrate=N/A speed=60.6x   frame=29053 fps=1452 q=-0.0
 size=N/A time=00:20:12.37 bitrate=N/A speed=60.6x   frame=29780 fps=1452
 q=-0.0 size=N/A time=00:20:42.68 bitrate=N/A speed=60.6x   frame=30516
 fps=1452 q=-0.0 size=N/A time=00:21:13.38 bitrate=N/A speed=60.6x
 frame=31255 fps=1453 q=-0.0 size=N/A time=00:21:44.21 bitrate=N/A
 speed=60.6x   [blackdetect @ 0x7fc080c0f7c0] black_start:1301.05
 black_end:1303.93 black_duration:2.87787
 frame=31981 fps=1453 q=-0.0 size=N/A time=00:22:14.48 bitrate=N/A
 speed=60.6x   frame=32722 fps=1453 q=-0.0 size=N/A time=00:22:45.39
 bitrate=N/A speed=60.6x   frame=33455 fps=1454 q=-0.0 size=N/A
 time=00:23:15.96 bitrate=N/A speed=60.7x   frame=34165 fps=1453 q=-0.0
 size=N/A time=00:23:45.57 bitrate=N/A speed=60.6x   frame=34891 fps=1453
 q=-0.0 size=N/A time=00:24:15.87 bitrate=N/A speed=60.6x   frame=35619
 fps=1453 q=-0.0 size=N/A time=00:24:46.22 bitrate=N/A speed=60.6x
 frame=36336 fps=1452 q=-0.0 size=N/A time=00:25:16.13 bitrate=N/A
 speed=60.6x   frame=37056 fps=1452 q=-0.0 size=N/A time=00:25:46.15
 bitrate=N/A speed=60.6x   frame=37771 fps=1452 q=-0.0 size=N/A
 time=00:26:15.97 bitrate=N/A speed=60.6x   frame=38507 fps=1452 q=-0.0
 size=N/A time=00:26:46.67 bitrate=N/A speed=60.6x   frame=39200 fps=1451
 q=-0.0 size=N/A time=00:27:15.58 bitrate=N/A speed=60.5x   frame=39888
 fps=1450 q=-0.0 size=N/A time=00:27:44.27 bitrate=N/A speed=60.5x
 frame=40551 fps=1447 q=-0.0 size=N/A time=00:28:11.92 bitrate=N/A
 speed=60.4x   frame=41291 fps=1448 q=-0.0 size=N/A time=00:28:42.79
 bitrate=N/A speed=60.4x   frame=41997 fps=1447 q=-0.0 size=N/A
 time=00:29:12.23 bitrate=N/A speed=60.4x   frame=42710 fps=1447 q=-0.0
 size=N/A time=00:29:41.97 bitrate=N/A speed=60.4x   frame=43421 fps=1446
 q=-0.0 size=N/A time=00:30:11.62 bitrate=N/A speed=60.3x   [blackdetect @
 0x7fc080c0f7c0] black_start:1815.19 black_end:1817.44
 Patches should be submitted to the ffmpeg-devel mailing list and not this
 bug tracker.

Ticket URL: <https://trac.ffmpeg.org/ticket/9164>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list