Opened 9 months ago

Last modified 4 months ago

#9599 new defect

VideoToolbox VP9 hwaccel freezes ffmpeg

Reported by: Eric Karnes Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: videotoolbox vp9
Cc: Eric Karnes Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Eric Karnes)

Summary of the bug:

When testing the new videotoolbox VP9 decoder support I ran into an issue on my machine where ffmpeg freezes.

ffmpeg doesn't respond to [q] or ? however I'm able to hard exit.

I'm using a 2017 iMac, imac18,3.

The input is a VP9 YouTube video, I've observed this issue with every VP9 YouTube video I've tried.

How to reproduce:

% ffmpeg -v 9 -loglevel 99 -hwaccel videotoolbox -threads 1 -i /Users/eric/Downloads/test.webm -f null - -benchmark -report
ffmpeg version N-105288-g45e45a6060
built on 01/15/2022

Here is my output

ffmpeg started on 2022-01-15 at 15:34:58
Report written to "ffmpeg-20220115-153458.log"
Log level: 99
Command line:
./ffmpeg -v 9 -loglevel 99 -hwaccel videotoolbox -threads 1 -i /Users/eric/Downloads/test.webm -f null - -benchmark -report
ffmpeg version N-105288-g45e45a6060 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 13.0.0 (clang-1300.0.29.30)
  configuration: --enable-gpl --enable-libaom --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-demuxer=dash --enable-opencl --enable-videotoolbox --disable-htmlpages --enable-libfdk-aac --enable-librav1e --enable-librubberband --enable-libspeex --enable-libwebp --enable-nonfree
  libavutil      57. 18.100 / 57. 18.100
  libavcodec     59. 20.100 / 59. 20.100
  libavformat    59. 17.101 / 59. 17.101
  libavdevice    59.  5.100 / 59.  5.100
  libavfilter     8. 25.100 /  8. 25.100
  libswscale      6.  5.100 /  6.  5.100
  libswresample   4.  4.100 /  4.  4.100
  libpostproc    56.  4.100 / 56.  4.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-hwaccel' ... matched as option 'hwaccel' (use HW accelerated decoding) with argument 'videotoolbox'.
Reading option '-threads' ... matched as AVOption 'threads' with argument '1'.
Reading option '-i' ... matched as input url with argument '/Users/eric/Downloads/test.webm'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'null'.
Reading option '-' ... matched as output url.
Reading option '-benchmark' ... matched as option 'benchmark' (add timings for benchmarking) with argument '1'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Applying option loglevel (set logging level) with argument 99.
Applying option benchmark (add timings for benchmarking) with argument 1.
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url /Users/eric/Downloads/test.webm.
Applying option hwaccel (use HW accelerated decoding) with argument videotoolbox.
Successfully parsed a group of options.
Opening an input file: /Users/eric/Downloads/test.webm.
[NULL @ 0x7faf14704100] Opening '/Users/eric/Downloads/test.webm' for reading
[file @ 0x7faf247046c0] Setting default whitelist 'file,crypto,data'
Probing matroska,webm score:100 size:2048
[matroska,webm @ 0x7faf14704100] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
[matroska,webm @ 0x7faf14704100] Before avformat_find_stream_info() pos: 636 bytes read:32768 seeks:0 nb_streams:2
[vp9 @ 0x7faf24705580] Format yuv420p chosen by get_format().
[opus @ 0x7faf24705e80] skip 312/960 samples
[matroska,webm @ 0x7faf14704100] All info found
[matroska,webm @ 0x7faf14704100] stream 0: start_time: 0 duration: NOPTS
[matroska,webm @ 0x7faf14704100] stream 1: start_time: -0.007 duration: NOPTS
[matroska,webm @ 0x7faf14704100] format: start_time: -0.007 duration: 15.021 (estimate from stream) bitrate=1336 kb/s
[matroska,webm @ 0x7faf14704100] After avformat_find_stream_info() pos: 1483 bytes read:32768 seeks:0 frames:2
Input #0, matroska,webm, from '/Users/eric/Downloads/test.webm':
  Metadata:
    ENCODER         : Lavf58.76.100
  Duration: 00:00:15.02, start: -0.007000, bitrate: 1336 kb/s
  Stream #0:0(eng), 1, 1/1000: Video: vp9 (Profile 0), 1 reference frame, yuv420p(tv, bt709), 720x1280, 0/1, SAR 1:1 DAR 9:16, 30 fps, 30 tbr, 1k tbn (default)
    Metadata:
      DURATION        : 00:00:14.999000000
  Stream #0:1(eng), 1, 1/1000: Audio: opus, 48000 Hz, stereo, fltp, delay 312 (default)
    Metadata:
      DURATION        : 00:00:15.021000000
Successfully opened the file.
Parsing a group of options: output url -.
Applying option f (force format) with argument null.
Successfully parsed a group of options.
Opening an output file: -.
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (vp9 (native) -> wrapped_avframe (native))
  Stream #0:1 -> #0:1 (opus (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[vp9 @ 0x7faf04704100] Format videotoolbox_vld chosen by get_format().
[vp9 @ 0x7faf04704100] Format videotoolbox_vld requires hwaccel initialisation.
detected 8 logical cores
[graph 0 input from stream 0:0 @ 0x7faf24723e40] Setting 'video_size' to value '720x1280'
[graph 0 input from stream 0:0 @ 0x7faf24723e40] Setting 'pix_fmt' to value '23'
[graph 0 input from stream 0:0 @ 0x7faf24723e40] Setting 'time_base' to value '1/1000'
[graph 0 input from stream 0:0 @ 0x7faf24723e40] Setting 'pixel_aspect' to value '1/1'
[graph 0 input from stream 0:0 @ 0x7faf24723e40] Setting 'frame_rate' to value '30/1'
[graph 0 input from stream 0:0 @ 0x7faf24723e40] w:720 h:1280 pixfmt:nv12 tb:1/1000 fr:30/1 sar:1/1
[AVFilterGraph @ 0x7faf247198c0] query_formats: 3 queried, 2 merged, 0 already done, 0 delayed
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:1 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[opus @ 0x7faf04704980] skip 312/960 samples
[graph_1_in_0_1 @ 0x7faf247258c0] Setting 'time_base' to value '1/48000'
[graph_1_in_0_1 @ 0x7faf247258c0] Setting 'sample_rate' to value '48000'
[graph_1_in_0_1 @ 0x7faf247258c0] Setting 'sample_fmt' to value 'fltp'
[graph_1_in_0_1 @ 0x7faf247258c0] Setting 'channel_layout' to value '0x3'
[graph_1_in_0_1 @ 0x7faf247258c0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
[format_out_0_1 @ 0x7faf24725e80] Setting 'sample_fmts' to value 's16'
[format_out_0_1 @ 0x7faf24725e80] auto-inserting filter 'auto_aresample_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_1'
[AVFilterGraph @ 0x7faf247253c0] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
[auto_aresample_0 @ 0x7faf24726540] [SWR @ 0x7faef8050000] Using fltp internally between filters
[auto_aresample_0 @ 0x7faf24726540] ch:2 chl:stereo fmt:fltp r:48000Hz -> ch:2 chl:stereo fmt:s16 r:48000Hz
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf59.17.101
  Stream #0:0(eng), 0, 1/30: Video: wrapped_avframe, 1 reference frame, nv12(tv, bt709, progressive), 720x1280 (0x0) [SAR 1:1 DAR 9:16], 0/1, q=2-31, 200 kb/s, 30 fps, 30 tbn (default)
    Metadata:
      DURATION        : 00:00:14.999000000
      encoder         : Lavc59.20.100 wrapped_avframe
  Stream #0:1(eng), 0, 1/48000: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      DURATION        : 00:00:15.021000000
      encoder         : Lavc59.20.100 pcm_s16le
frame=    1 fps=0.0 q=-0.0 size=N/A time=00:00:00.03 bitrate=N/A speed=0.383x    

Change History (5)

comment:1 by Eric Karnes, 9 months ago

Description: modified (diff)

comment:2 by Peter Xia, 9 months ago

I'm able to reproduce this. It's working on my apple silicon mac but freezing on my intel one.

in reply to:  2 comment:3 by Eric Karnes, 9 months ago

Replying to Peter Xia:

I'm able to reproduce this. It's working on my apple silicon mac but freezing on my intel one.

What model Mac are you able to reproduce this with? I'm trying to figure out if this is an issue with all Intel Macs with VP9 decode support or specifically ones that use the Intel iGPU for VP9 decode.

comment:4 by WindowPain, 8 months ago

I'm having the same problem. My machine is 2017 MacBook Pro.

comment:5 by Eric Karnes, 4 months ago

Bug is still present on macOS 13.0 Beta

Note: See TracTickets for help on using tickets.