[FFmpeg-user] Does "-hwaccel auto" option function on Mac?

Moyo cflbzn at 0mel.com
Mon Oct 9 05:57:37 EEST 2017


Hello

"Either hw_frames_ctx or hw_device_ctx must be set." appears, the color format of output is not nv12 but yuv420p and CPU usage is high in Active Monitor when I use "-hwaccel auto" option.
Does "-hwaccel auto" option function on Mac?
These don't appear when I use "-hwaccel videotoolbox" option.

A binary is from https://evermeet.cx/ffmpeg/
A sample movie is from http://samples.mplayerhq.hu/V-codecs/h264/mp4_h264/h264_parser.mp4

ffmpeg -hwaccel auto -i h264_parser.mp4 -f null /dev/null
ffmpeg version N-87743-g7d141e2-tessus Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-libzvbi --enable-version3 --disable-ffplay
  libavutil      55. 77.101 / 55. 77.101
  libavcodec     57.106.104 / 57.106.104
  libavformat    57. 82.102 / 57. 82.102
  libavdevice    57.  9.101 / 57.  9.101
  libavfilter     6.106.101 /  6.106.101
  libswscale      4.  7.103 /  4.  7.103
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'h264_parser.mp4':
  Metadata:
    major_brand     : avc1
    minor_version   : 0
    compatible_brands: avc1isom
    creation_time   : 2008-01-01T00:01:58.000000Z
  Duration: 00:00:04.90, start: 0.000000, bitrate: 1631 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 10603 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2008-01-01T00:01:58.000000Z
      handler_name    :  Ambarella AVC
      encoder         : Ambarella AVC encoder
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      creation_time   : 2008-01-01T00:01:58.000000Z
      handler_name    :  Ambarella AAC
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
[h264 @ 0x7fabcf01f400] Either hw_frames_ctx or hw_device_ctx must be set.
Output #0, null, to '/dev/null':
  Metadata:
    major_brand     : avc1
    minor_version   : 0
    compatible_brands: avc1isom
    encoder         : Lavf57.82.102
    Stream #0:0(eng): Video: wrapped_avframe, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc (default)
    Metadata:
      creation_time   : 2008-01-01T00:01:58.000000Z
      handler_name    :  Ambarella AVC
      encoder         : Lavc57.106.104 wrapped_avframe
    Stream #0:1(eng): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2008-01-01T00:01:58.000000Z
      handler_name    :  Ambarella AAC
      encoder         : Lavc57.106.104 pcm_s16le
[h264 @ 0x7fabcf057a00] Invalid NAL unit size (36048 > 26380).
[h264 @ 0x7fabcf057a00] Error splitting the input into NAL units.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fabcf001000] stream 1, offset 0xfe045: partial file
h264_parser.mp4: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fabcf001000] stream 0, offset 0xfe19a: partial file
h264_parser.mp4: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fabcf001000] stream 0, offset 0x103874: partial file
h264_parser.mp4: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fabcf001000] stream 1, offset 0x108cad: partial file
h264_parser.mp4: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fabcf001000] stream 0, offset 0x108e02: partial file
h264_parser.mp4: Invalid data found when processing input
Error while decoding stream #0:0: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fabcf001000] stream 1, offset 0x1194c0: partial file
h264_parser.mp4: Invalid data found when processing input
frame=   21 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.70 bitrate=N/A speed=3.44x    
video:11kB audio:132kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

ffmpeg -y -i h264_parser.mp4 test.mp4
ffmpeg version N-87743-g7d141e2-tessus Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-libzvbi --enable-version3 --disable-ffplay
  libavutil      55. 77.101 / 55. 77.101
  libavcodec     57.106.104 / 57.106.104
  libavformat    57. 82.102 / 57. 82.102
  libavdevice    57.  9.101 / 57.  9.101
  libavfilter     6.106.101 /  6.106.101
  libswscale      4.  7.103 /  4.  7.103
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'h264_parser.mp4':
  Metadata:
    major_brand     : avc1
    minor_version   : 0
    compatible_brands: avc1isom
    creation_time   : 2008-01-01T00:01:58.000000Z
  Duration: 00:00:04.90, start: 0.000000, bitrate: 1631 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 10603 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2008-01-01T00:01:58.000000Z
      handler_name    :  Ambarella AVC
      encoder         : Ambarella AVC encoder
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      creation_time   : 2008-01-01T00:01:58.000000Z
      handler_name    :  Ambarella AAC
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7fc10481ee00] using SAR=1/1
[libx264 @ 0x7fc10481ee00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7fc10481ee00] profile High, level 4.0
[libx264 @ 0x7fc10481ee00] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test.mp4':
  Metadata:
    major_brand     : avc1
    minor_version   : 0
    compatible_brands: avc1isom
    encoder         : Lavf57.82.102
    Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default)
    Metadata:
      creation_time   : 2008-01-01T00:01:58.000000Z
      handler_name    :  Ambarella AVC
      encoder         : Lavc57.106.104 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2008-01-01T00:01:58.000000Z
      handler_name    :  Ambarella AAC
      encoder         : Lavc57.106.104 aac
[h264 @ 0x7fc10485a400] Invalid NAL unit size (36048 > 26380).
[h264 @ 0x7fc10485a400] Error splitting the input into NAL units.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc103800400] stream 1, offset 0xfe045: partial file
h264_parser.mp4: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc103800400] stream 0, offset 0xfe19a: partial file
h264_parser.mp4: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc103800400] stream 0, offset 0x103874: partial file
h264_parser.mp4: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc103800400] stream 1, offset 0x108cad: partial file
h264_parser.mp4: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc103800400] stream 0, offset 0x108e02: partial file
h264_parser.mp4: Invalid data found when processing input
Error while decoding stream #0:0: Invalid data found when processing input
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc103800400] stream 1, offset 0x1194c0: partial file
h264_parser.mp4: Invalid data found when processing input
frame=   21 fps=0.0 q=-1.0 Lsize=     515kB time=00:00:00.70 bitrate=5997.7kbits/s speed=0.711x    
video:502kB audio:11kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.406538%
[libx264 @ 0x7fc10481ee00] frame I:1     Avg QP:24.45  size: 86850
[libx264 @ 0x7fc10481ee00] frame P:5     Avg QP:24.68  size: 36697
[libx264 @ 0x7fc10481ee00] frame B:15    Avg QP:25.67  size: 16209
[libx264 @ 0x7fc10481ee00] consecutive B-frames:  4.8%  0.0%  0.0% 95.2%
[libx264 @ 0x7fc10481ee00] mb I  I16..4: 12.7% 70.1% 17.2%
[libx264 @ 0x7fc10481ee00] mb P  I16..4:  4.6% 21.0%  2.6%  P16..4: 36.8%  6.4%  4.5%  0.0%  0.0%    skip:24.2%
[libx264 @ 0x7fc10481ee00] mb B  I16..4:  0.6%  2.0%  0.2%  B16..8: 41.7%  2.9%  0.7%  direct: 3.5%  skip:48.5%  L0:45.9% L1:50.8% BI: 3.3%
[libx264 @ 0x7fc10481ee00] 8x8 transform intra:72.5% inter:87.8%
[libx264 @ 0x7fc10481ee00] coded y,uvDC,uvAC intra: 70.4% 39.5% 7.5% inter: 15.5% 14.9% 0.8%
[libx264 @ 0x7fc10481ee00] i16 v,h,dc,p: 14% 51%  4% 32%
[libx264 @ 0x7fc10481ee00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 21% 24%  5%  4%  4%  6%  5%  5%
[libx264 @ 0x7fc10481ee00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 61%  7%  3%  3%  2%  4%  2%  2%
[libx264 @ 0x7fc10481ee00] i8c dc,h,v,p: 60% 14% 24%  2%
[libx264 @ 0x7fc10481ee00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7fc10481ee00] ref P L0: 56.9% 17.9% 18.5%  6.7%
[libx264 @ 0x7fc10481ee00] ref B L0: 92.5%  6.4%  1.1%
[libx264 @ 0x7fc10481ee00] ref B L1: 96.3%  3.7%
[libx264 @ 0x7fc10481ee00] kb/s:5862.38
[aac @ 0x7fc104820600] Qavg: 61960.633

ffmpeg -hwaccel auto -i test.mp4 -f null /dev/null
ffmpeg version N-87743-g7d141e2-tessus Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-libzvbi --enable-version3 --disable-ffplay
  libavutil      55. 77.101 / 55. 77.101
  libavcodec     57.106.104 / 57.106.104
  libavformat    57. 82.102 / 57. 82.102
  libavdevice    57.  9.101 / 57.  9.101
  libavfilter     6.106.101 /  6.106.101
  libswscale      4.  7.103 /  4.  7.103
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.82.102
  Duration: 00:00:00.73, start: 0.000000, bitrate: 5815 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 5870 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 126 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
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
[h264 @ 0x7fa6a80e4800] Either hw_frames_ctx or hw_device_ctx must be set.
Output #0, null, to '/dev/null':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.82.102
    Stream #0:0(eng): Video: wrapped_avframe, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.106.104 wrapped_avframe
    Stream #0:1(eng): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc57.106.104 pcm_s16le
frame=   21 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.70 bitrate=N/A speed=9.61x    
video:11kB audio:132kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Thanks,
Moyo



More information about the ffmpeg-user mailing list