[FFmpeg-trac] #9599(undetermined:reopened): VideoToolbox VP9 hwaccel freezes ffmpeg

FFmpeg trac at avcodec.org
Sun Aug 20 16:34:11 EEST 2023


#9599: VideoToolbox VP9 hwaccel freezes ffmpeg
-------------------------------------+-------------------------------------
             Reporter:  Eric Karnes  |                    Owner:  (none)
                 Type:  defect       |                   Status:  reopened
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  git-master   |               Resolution:
             Keywords:               |               Blocked By:
  videotoolbox vp9                   |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Comment (by FreezyLemon):

 The osu-framework is another project that is affected by this, and is
 [https://github.com/ppy/osu-framework/issues/5051 waiting for a fix or
 workaround] before upgrading its ffmpeg libraries.

 Thanks to low-batts extensive information, I have an idea on a possible
 workaround on the consumer end. Looking at the chromium issue,
 [https://chromium.googlesource.com/chromium/src.git/+/71d8568305da075bf8282f3baf72212aca923b19
 this] is how they fixed the issue:
 > This assembles superframes from vp9 alt ref frames since that's what the
 macOS VP9 decoder is expecting.

 More specifically, they use a bitstream filter (BSF) to modify the encoded
 bitstream before sending it to the HW decoder. I noticed that the ffmpeg
 libraries also include a bitstream filter called [https://ffmpeg.org
 /ffmpeg-bitstream-filters.html#vp9_005fsuperframe vp9_superframe] that
 seems to do the exact same thing, though I haven't looked at the
 implementation to confirm this.

 I do not have any Apple hardware, so I cannot confirm whether this
 workaround works. But the idea would be to change from this:

 {{{
 ffmpeg -hide_banner -hwaccel videotoolbox -i test.webm -f null -
 }}}

 to this:
 {{{
 ffmpeg -hide_banner -i test.webm -c:v copy -bsf:v vp9_superframe -f webm -
 | ffmpeg -hide_banner -f webm -hwaccel videotoolbox -i pipe: -f null -
 }}}

 Something like this should also be doable through libavcodec (BSFs, though
 named "filters", are part of avcodec, not avfilter), but again, I can't
 try this myself. I'd appreciate if someone could test this, as it would be
 a relatively simple workaround.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9599#comment:19>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list