Opened 21 months ago

Closed 21 months ago

Last modified 21 months ago

#10182 closed defect (worksforme)

prores_videotoolbox results are inaccurate color

Reported by: Mils Owned by:
Priority: normal Component: avcodec
Version: 5.1.2 Keywords: prores, prores_videotoolbox, videotoolbox
Cc: Mils Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Mils)

Summary of the bug:
Hi,
I would like to utilise the hardware acceleration of the Apple Silicon.
I have tried using hevc_videotoolbox h264_videotoolbox both came out fine. Even the old -c:v prores_ks is also fine (just very slow at 0.2x)
But when I use the prores_videotoolbox the results came like it has been applied too much exposure/gamma

Hardware: M2 Pro Mac Mini (Ventura 13.2)
FFMPEG version 5.1.2
Video source: 3840x1610, HEVC (Main 10@L5), HDR10

Attached are the comparison and YES I own the movie right through Bluray AND Digital iTunes. This is for personal use/project.

How to reproduce:

% ffmpeg  -i H2-30s.mkv -c:v prores_videotoolbox H2-30sPR.mov
ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 14.0.0 (clang-1400.0.29.202)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1.2_4 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, matroska,webm, from 'H2-30s.mkv':
  Metadata:
    ENCODER         : Lavf59.27.100
  Duration: 00:00:32.50, start: 0.009000, bitrate: 20065 kb/s
  Chapters:
    Chapter #0:0: start 0.000000, end 30.000000
      Metadata:
        title           : Chapter 05
  Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x1608, SAR 1:1 DAR 160:67, 23.98 fps, 23.98 tbr, 1k tbn (default)
    Metadata:
      BPS-eng         : 16298452
      DURATION-eng    : 03:06:34.517000000
      NUMBER_OF_FRAMES-eng: 268400
      NUMBER_OF_BYTES-eng: 22806662308
      _STATISTICS_WRITING_APP-eng: mkvmerge v38.0.0 ('The Silent Type') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2020-12-10 01:14:57
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      DURATION        : 00:00:30.257000000

===============RESOLUTION: Works for me==================
Hi all,
I found by adding -pix_fmt and the following formats solved the issue: uyvy422, p210le, p216le, ayuv64le.

Supported pixel formats: videotoolbox_vld yuv420p nv12 ayuv64le uyvy422 p010le nv16 p210le p216le nv24 p410le p416le bgra

The rest of the available formats gave the same issue as auto.

So in summary, the following ffmpeg line works for me (I exclude Audio conversion / -an):
ffmpeg -i [input.mkv] -c:v prores_videotoolbox -profile:v 3 -vendor apl0 -pix_fmt uyvy422 -an [output.mov]
ffmpeg -i [input.mkv] -c:v prores_videotoolbox -profile:v 3 -vendor apl0 -pix_fmt p010le -an [output.mov]
ffmpeg -i [input.mkv] -c:v prores_videotoolbox -profile:v 3 -vendor apl0 -pix_fmt p210le -an [output.mov]
ffmpeg -i [input.mkv] -c:v prores_videotoolbox -profile:v 3 -vendor apl0 -pix_fmt p216le -an [output.mov]

I'm going to close the ticket.
Thank you all.

Attachments (3)

prores_videotoolbox.jpg (435.3 KB ) - added by Mils 21 months ago.
prores_videotoolbox
hevc_videotoolbox.jpg (297.8 KB ) - added by Mils 21 months ago.
hevc_videotoolbox
H-3sPR.txt (3.2 KB ) - added by Mils 21 months ago.
Mediainfo of H-3sPR.mov

Download all attachments as: .zip

Change History (8)

by Mils, 21 months ago

Attachment: prores_videotoolbox.jpg added

prores_videotoolbox

by Mils, 21 months ago

Attachment: hevc_videotoolbox.jpg added

hevc_videotoolbox

comment:1 by Mils, 21 months ago

Description: modified (diff)

comment:2 by Balling, 21 months ago

We need H2-30sPR.mov and mediainfo output for it.

by Mils, 21 months ago

Attachment: H-3sPR.txt added

Mediainfo of H-3sPR.mov

comment:3 by Mils, 21 months ago

Hi Balling,
I've converted the original footage to just 3 seconds (instead of 30 seconds) so I don't have to send 1.26GB of ProRes. I've also created a mediainfo.
I'm not sure how to upload more than 2.5MB in trac.ffmpeg.org so I upload it to my dropbox.
Please find the following link: [redacted]

In the .zip file there'll be the original footage, then the HEVC version that I converted using hevc_videotoolbox and then the ProRes version that I converted using prores_videotoolbox. Each footage has its mediainfo in .txt format.
With the original footage is there, hopefully you can also reproduce the issue if you have an Apple Silicon machine and help me figure out why the prores_videotoolbox resulted in terrible output.
Thank you.

(edit: wrong dropbox link before)
(edit2: Provided note that the original footage/source is included)
(edit3: redacted the link as ticket is closed0

Last edited 21 months ago by Mils (previous) (diff)

comment:4 by Mils, 21 months ago

Description: modified (diff)
Resolution: worksforme
Status: newclosed

Hi all,
I found by adding -pix_fmt and the following formats solved the issue: uyvy422, p210le, p216le, ayuv64le. The rest of the available formats gave the same issue as auto.

So in summary, the following ffmpeg line works for me (I exclude Audio conversion / -an):
ffmpeg -i [input.mkv] -c:v prores_videotoolbox -profile:v 3 -vendor apl0 -pix_fmt uyvy422 -an [output.mov]
ffmpeg -i [input.mkv] -c:v prores_videotoolbox -profile:v 3 -vendor apl0 -pix_fmt p010le -an [output.mov]
ffmpeg -i [input.mkv] -c:v prores_videotoolbox -profile:v 3 -vendor apl0 -pix_fmt p210le -an [output.mov]
ffmpeg -i [input.mkv] -c:v prores_videotoolbox -profile:v 3 -vendor apl0 -pix_fmt p216le -an [output.mov]

I'm going to close the ticket.
Thank you all.

comment:5 by Balling, 21 months ago

The rest of the available formats gave the same issue as auto.

Then those must not be selected for HDR, which is logical.

Note: See TracTickets for help on using tickets.