Opened 16 months ago

Last modified 6 months ago

#8735 new defect

videotoolbox causes chroma artifacts in comparison to sw decoding

Reported by: der_richter Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: videotoolbox
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

in the following sample, at around 3:16 (as an example), the red rectangle has visible chroma artifacts/aliasing when decoded with videotoolbox.

videotoolbox output:
https://0x0.st/iVhk.png

sw decode output:
https://0x0.st/iVhd.png

sample file: https://0x0.st/sDVT.mkv
related mpv issue: https://github.com/mpv-player/mpv/issues/6369

ffmpeg -hwaccel videotoolbox -i "/Volumes/AkemiData/Downloads/ffmpeg_videotoolbox_issues/sDVT.mkv" -f null -
ffmpeg version git-2020-06-11-bc8ab084 Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.12)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-bc8ab08 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=/usr/bin/clang --host-cflags='-Os -w -pipe -march=nehalem -mmacosx-version-min=10.14 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -fno-stack-check' --host-ldflags='-L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/libxml2/lib -L/usr/local/opt/python@3.8/lib -L/usr/local/opt/sqlite/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk' --enable-ffplay --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-gpl --enable-nonfree --enable-hardcoded-tables --enable-libfdk-aac --enable-libgme --enable-libbs2b --enable-libgsm --enable-libxml2 --enable-openssl --enable-libwavpack --enable-libzmq --enable-libzimg --enable-opencl
  libavutil      56. 54.100 / 56. 54.100
  libavcodec     58. 92.100 / 58. 92.100
  libavformat    58. 46.101 / 58. 46.101
  libavdevice    58. 11.100 / 58. 11.100
  libavfilter     7. 86.100 /  7. 86.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, matroska,webm, from '/Volumes/AkemiData/Downloads/ffmpeg_videotoolbox_issues/sDVT.mkv':
  Metadata:
    encoder         : libebml v1.3.5 + libmatroska v1.4.8
    creation_time   : 2017-11-20T03:32:29.000000Z
  Duration: 00:06:07.37, start: 0.000000, bitrate: 6643 kb/s
    Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709/unknown/unknown), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
    Metadata:
      BPS             : 5794944
      BPS-eng         : 5794944
      DURATION        : 00:06:07.367000000
      DURATION-eng    : 00:06:07.367000000
      NUMBER_OF_FRAMES: 8808
      NUMBER_OF_FRAMES-eng: 8808
      NUMBER_OF_BYTES : 266108920
      NUMBER_OF_BYTES-eng: 266108920
      _STATISTICS_WRITING_APP: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-20 03:32:29
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-20 03:32:29
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: flac, 48000 Hz, stereo, s32 (24 bit) (default)
    Metadata:
      BPS             : 846380
      BPS-eng         : 846380
      DURATION        : 00:06:07.365000000
      DURATION-eng    : 00:06:07.365000000
      NUMBER_OF_FRAMES: 4306
      NUMBER_OF_FRAMES-eng: 4306
      NUMBER_OF_BYTES : 38866300
      NUMBER_OF_BYTES-eng: 38866300
      _STATISTICS_WRITING_APP: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-20 03:32:29
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-20 03:32:29
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2: Subtitle: ass (default)
    Metadata:
      BPS             : 133
      BPS-eng         : 133
      DURATION        : 00:05:44.590000000
      DURATION-eng    : 00:05:44.590000000
      NUMBER_OF_FRAMES: 94
      NUMBER_OF_FRAMES-eng: 94
      NUMBER_OF_BYTES : 5745
      NUMBER_OF_BYTES-eng: 5745
      _STATISTICS_WRITING_APP: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-20 03:32:29
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-20 03:32:29
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> wrapped_avframe (native))
  Stream #0:1 -> #0:1 (flac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf58.46.101
    Stream #0:0: Video: wrapped_avframe, p010le(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc (default)
    Metadata:
      BPS             : 5794944
      BPS-eng         : 5794944
      DURATION        : 00:06:07.367000000
      DURATION-eng    : 00:06:07.367000000
      NUMBER_OF_FRAMES: 8808
      NUMBER_OF_FRAMES-eng: 8808
      NUMBER_OF_BYTES : 266108920
      NUMBER_OF_BYTES-eng: 266108920
      _STATISTICS_WRITING_APP: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-20 03:32:29
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-20 03:32:29
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      encoder         : Lavc58.92.100 wrapped_avframe
    Stream #0:1(eng): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      BPS             : 846380
      BPS-eng         : 846380
      DURATION        : 00:06:07.365000000
      DURATION-eng    : 00:06:07.365000000
      NUMBER_OF_FRAMES: 4306
      NUMBER_OF_FRAMES-eng: 4306
      NUMBER_OF_BYTES : 38866300
      NUMBER_OF_BYTES-eng: 38866300
      _STATISTICS_WRITING_APP: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-20 03:32:29
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-20 03:32:29
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      encoder         : Lavc58.92.100 pcm_s16le
frame= 8808 fps=153 q=-0.0 Lsize=N/A time=00:06:07.36 bitrate=N/A speed=6.38x    
video:4610kB audio:68881kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Attachments (2)

videotoolbox (499.0 KB ) - added by der_richter 16 months ago.
videotoolbox
swdecodep010 (499.0 KB ) - added by Carl Eugen Hoyos 16 months ago.

Download all attachments as: .zip

Change History (10)

comment:1 by der_richter, 16 months ago

Component: undeterminedavcodec
Keywords: videotoolbox added
Version: unspecifiedgit-master

comment:2 by Carl Eugen Hoyos, 16 months ago

Why do you think this behaviour can be changed in FFmpeg?

comment:3 by der_richter, 16 months ago

this is again a question only someone can answer that knows the internals of ffmpeg and the limitations of the videotoolbox API. since i don't know what the videotoolbox API exactly returns i can only guess. though it looks like wrongly sampled chroma planes.

as a test i reencoded the file to a format that the quicktime player can decode and playback. https://0x0.st/iW-I.mp4
this file also has the same problem as mentioned above, though with quicktime player the artifacts are a lot less pronounced. see screenshot below. i also verified that it used hwdec/videotoolbox for decoding. so if Apple doesn't use a private API it should be possible to fix or lessen the problem considerably.

https://0x0.st/iW-l.png

comment:4 by Carl Eugen Hoyos, 16 months ago

this is again a question only someone can answer that knows the internals of ffmpeg and the limitations of the videotoolbox API.

Then why did you open a bug report? Questions are answered on the user mailing list, not this bug tracker.

Please attach the outputs of the following command line for both software and hardware decoding (and please do not attach more screenshots.

$ ffmpeg -vsync 0 -i sDVT.mkv -an -f framecrc outsw

by der_richter, 16 months ago

Attachment: videotoolbox added

videotoolbox

comment:5 by der_richter, 16 months ago

i reported it because it's clearly an issue and not a question. what exactly the issue is something i can't tell and needs to be analysed by someone else.

sure i am not going to link more images. obviously they were added to answer your question, to make my point and show the actual issue.

both terminal outputs in the case they might be in any way relevant. otherwise i attached both outputs.

ffmpeg -vsync 0 -i /Volumes/AkemiData/Downloads/ffmpeg_videotoolbox_issues/sDVT.mkv -an -f framecrc outsw
ffmpeg version git-2020-06-11-bc8ab084 Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.12)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-bc8ab08 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=/usr/bin/clang --host-cflags='-Os -w -pipe -march=nehalem -mmacosx-version-min=10.14 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -fno-stack-check' --host-ldflags='-L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/libxml2/lib -L/usr/local/opt/python@3.8/lib -L/usr/local/opt/sqlite/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk' --enable-ffplay --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-gpl --enable-nonfree --enable-hardcoded-tables --enable-libfdk-aac --enable-libgme --enable-libbs2b --enable-libgsm --enable-libxml2 --enable-openssl --enable-libwavpack --enable-libzmq --enable-libzimg --enable-opencl
  libavutil      56. 54.100 / 56. 54.100
  libavcodec     58. 92.100 / 58. 92.100
  libavformat    58. 46.101 / 58. 46.101
  libavdevice    58. 11.100 / 58. 11.100
  libavfilter     7. 86.100 /  7. 86.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, matroska,webm, from '/Volumes/AkemiData/Downloads/ffmpeg_videotoolbox_issues/sDVT.mkv':
  Metadata:
    encoder         : libebml v1.3.5 + libmatroska v1.4.8
    creation_time   : 2017-11-20T03:32:29.000000Z
  Duration: 00:06:07.37, start: 0.000000, bitrate: 6643 kb/s
    Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709/unknown/unknown), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
    Metadata:
      BPS             : 5794944
      BPS-eng         : 5794944
      DURATION        : 00:06:07.367000000
      DURATION-eng    : 00:06:07.367000000
      NUMBER_OF_FRAMES: 8808
      NUMBER_OF_FRAMES-eng: 8808
      NUMBER_OF_BYTES : 266108920
      NUMBER_OF_BYTES-eng: 266108920
      _STATISTICS_WRITING_APP: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-20 03:32:29
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-20 03:32:29
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: flac, 48000 Hz, stereo, s32 (24 bit) (default)
    Metadata:
      BPS             : 846380
      BPS-eng         : 846380
      DURATION        : 00:06:07.365000000
      DURATION-eng    : 00:06:07.365000000
      NUMBER_OF_FRAMES: 4306
      NUMBER_OF_FRAMES-eng: 4306
      NUMBER_OF_BYTES : 38866300
      NUMBER_OF_BYTES-eng: 38866300
      _STATISTICS_WRITING_APP: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-20 03:32:29
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-20 03:32:29
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2: Subtitle: ass (default)
    Metadata:
      BPS             : 133
      BPS-eng         : 133
      DURATION        : 00:05:44.590000000
      DURATION-eng    : 00:05:44.590000000
      NUMBER_OF_FRAMES: 94
      NUMBER_OF_FRAMES-eng: 94
      NUMBER_OF_BYTES : 5745
      NUMBER_OF_BYTES-eng: 5745
      _STATISTICS_WRITING_APP: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-20 03:32:29
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-20 03:32:29
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> rawvideo (native))
Press [q] to stop, [?] for help
Output #0, framecrc, to 'outsw':
  Metadata:
    encoder         : Lavf58.46.101
    Stream #0:0: Video: rawvideo (Y3[11][10] / 0xA0B3359), yuv420p10le, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 745750 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc (default)
    Metadata:
      BPS             : 5794944
      BPS-eng         : 5794944
      DURATION        : 00:06:07.367000000
      DURATION-eng    : 00:06:07.367000000
      NUMBER_OF_FRAMES: 8808
      NUMBER_OF_FRAMES-eng: 8808
      NUMBER_OF_BYTES : 266108920
      NUMBER_OF_BYTES-eng: 266108920
      _STATISTICS_WRITING_APP: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-20 03:32:29
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-20 03:32:29
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      encoder         : Lavc58.92.100 rawvideo
frame= 8808 fps=269 q=-0.0 Lsize=     499kB time=00:06:07.36 bitrate=  11.1kbits/s speed=11.2x    
video:53508600kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
 akemi$ ffmpeg -hwaccel videotoolbox -vsync 0 -i /Volumes/AkemiData/Downloads/ffmpeg_videotoolbox_issues/sDVT.mkv -an -f framecrc outsw2
ffmpeg version git-2020-06-11-bc8ab084 Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.12)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-bc8ab08 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=/usr/bin/clang --host-cflags='-Os -w -pipe -march=nehalem -mmacosx-version-min=10.14 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -fno-stack-check' --host-ldflags='-L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/libxml2/lib -L/usr/local/opt/python@3.8/lib -L/usr/local/opt/sqlite/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk' --enable-ffplay --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-gpl --enable-nonfree --enable-hardcoded-tables --enable-libfdk-aac --enable-libgme --enable-libbs2b --enable-libgsm --enable-libxml2 --enable-openssl --enable-libwavpack --enable-libzmq --enable-libzimg --enable-opencl
  libavutil      56. 54.100 / 56. 54.100
  libavcodec     58. 92.100 / 58. 92.100
  libavformat    58. 46.101 / 58. 46.101
  libavdevice    58. 11.100 / 58. 11.100
  libavfilter     7. 86.100 /  7. 86.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, matroska,webm, from '/Volumes/AkemiData/Downloads/ffmpeg_videotoolbox_issues/sDVT.mkv':
  Metadata:
    encoder         : libebml v1.3.5 + libmatroska v1.4.8
    creation_time   : 2017-11-20T03:32:29.000000Z
  Duration: 00:06:07.37, start: 0.000000, bitrate: 6643 kb/s
    Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709/unknown/unknown), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
    Metadata:
      BPS             : 5794944
      BPS-eng         : 5794944
      DURATION        : 00:06:07.367000000
      DURATION-eng    : 00:06:07.367000000
      NUMBER_OF_FRAMES: 8808
      NUMBER_OF_FRAMES-eng: 8808
      NUMBER_OF_BYTES : 266108920
      NUMBER_OF_BYTES-eng: 266108920
      _STATISTICS_WRITING_APP: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-20 03:32:29
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-20 03:32:29
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: flac, 48000 Hz, stereo, s32 (24 bit) (default)
    Metadata:
      BPS             : 846380
      BPS-eng         : 846380
      DURATION        : 00:06:07.365000000
      DURATION-eng    : 00:06:07.365000000
      NUMBER_OF_FRAMES: 4306
      NUMBER_OF_FRAMES-eng: 4306
      NUMBER_OF_BYTES : 38866300
      NUMBER_OF_BYTES-eng: 38866300
      _STATISTICS_WRITING_APP: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-20 03:32:29
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-20 03:32:29
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2: Subtitle: ass (default)
    Metadata:
      BPS             : 133
      BPS-eng         : 133
      DURATION        : 00:05:44.590000000
      DURATION-eng    : 00:05:44.590000000
      NUMBER_OF_FRAMES: 94
      NUMBER_OF_FRAMES-eng: 94
      NUMBER_OF_BYTES : 5745
      NUMBER_OF_BYTES-eng: 5745
      _STATISTICS_WRITING_APP: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-20 03:32:29
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-20 03:32:29
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> rawvideo (native))
Press [q] to stop, [?] for help
Output #0, framecrc, to 'outsw2':
  Metadata:
    encoder         : Lavf58.46.101
    Stream #0:0: Video: rawvideo, p010le, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 745750 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc (default)
    Metadata:
      BPS             : 5794944
      BPS-eng         : 5794944
      DURATION        : 00:06:07.367000000
      DURATION-eng    : 00:06:07.367000000
      NUMBER_OF_FRAMES: 8808
      NUMBER_OF_FRAMES-eng: 8808
      NUMBER_OF_BYTES : 266108920
      NUMBER_OF_BYTES-eng: 266108920
      _STATISTICS_WRITING_APP: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v18.0.0 ('Apricity') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2017-11-20 03:32:29
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-11-20 03:32:29
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      encoder         : Lavc58.92.100 rawvideo
frame= 8808 fps=138 q=-0.0 Lsize=     499kB time=00:06:07.36 bitrate=  11.1kbits/s speed=5.76x    
video:53508600kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

comment:6 by Carl Eugen Hoyos, 16 months ago

So some frames including first and last are bit-exact, most frames are not: How is this an indication for an issue that can be fixed in FFmpeg?

by Carl Eugen Hoyos, 16 months ago

Attachment: swdecodep010 added

comment:7 by der_richter, 16 months ago

the first and last few frames are probably bit-exact because they are complete black frames and whatever transformation videotoolbox does internally translates black to black (0 > 0 (full), or 16 > 16 (limited 8 bit), or 64 > 64 (limited 10bit)).

mentioning a transformation because there was a similar problem before with full range videos. https://github.com/FFmpeg/FFmpeg/commit/2a9d461abcc88ab74f2143aada1e366a0961830c#diff-c16efb3d450eaaeb30bd45f817966fc6
in that case videotoolbox internally converted the full range video stream to limited, but it was still treated as full range. leading to washed out output.

anyway, it's possible that videotoolbox does something unexpected because it doesn't get the appropriate information it needs to decode the stream properly. so basically it could be an inappropriate or wrong usage of the videotoolbox API, or it could just be that videtoolbox is completely at fault here.

Last edited 16 months ago by der_richter (previous) (diff)

comment:8 by Balling, 6 months ago

That was fixed by Apple. https://github.com/mpv-player/mpv/issues/6369#issuecomment-755039744

Can be closed I think.

Note: See TracTickets for help on using tickets.