Alfred E. Heggestad
2018-11-09 21:18:59 UTC
Hi,
I would like to provide some feedback regarding the
h264_videotoolbox encoder.
Version info first:
$ ffmpeg -version
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 8.1.0 (clang-802.0.38)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1 --enable-shared
--enable-pthreads --enable-version3 --enable-hardcoded-tables
--enable-avresample --cc=clang --host-cflags= --host-ldflags=
--enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus
--enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma
--enable-libfdk-aac --enable-opencl --enable-videotoolbox --enable-nonfree
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Hardware:
my machine is Macbook Pro with OSX 10.13.6
CPU: 2,3 GHz Intel Core i7
GPU: NVIDIA GeForce GT 750M 2048 MB and Intel Iris Pro 1536 MB
I tried to use the "h264_videotoolbox" encoder both from
an application and from the command line, but it always failed
with the error code "-12915". I verified that my GPU have
support for H.264 encoder hardware acceleration. So I was
a bit puzzled.
I tried different resolutions, and it suddenly started to work!
Here are some resolutions that I tested:
320 x 240 Not working
640 × 480 Working
1280 × 720 Working
1920 × 1080 Working
my assumption now is that there is a limitation regarding
supported resolutions in the Nvidia GPU. please correct me if
I am wrong. it appears that the limitation is in the VideoToolbox
framework, and not in libavcodec (I have tested using the
VideoToolbox API directly with the same results).
This email is mainly for information, in case other people
are trying to use the same h264_videotoolbox encoder.
The application using libavcodec is a SIP client
with video, please take a look if you want:
https://github.com/alfredh/baresip/tree/master/modules/avcodec
(Btw, my objective is to use HW-accelerated video codecs
for real-time video streaming)
Below are output from 2 ffmpeg sessions; one working
and one non-working:
#
# Not working
#
$ ffmpeg -y -i ik.mkv -c:v h264_videotoolbox output.mp4
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 8.1.0 (clang-802.0.38)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1 --enable-shared
--enable-pthreads --enable-version3 --enable-hardcoded-tables
--enable-avresample --cc=clang --host-cflags= --host-ldflags=
--enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus
--enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma
--enable-libfdk-aac --enable-opencl --enable-videotoolbox --enable-nonfree
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, matroska,webm, from 'ik.mkv':
Metadata:
COMPATIBLE_BRANDS: iso6avc1mp41
MAJOR_BRAND : dash
MINOR_VERSION : 0
ENCODER : Lavf58.12.100
Duration: 00:08:40.42, start: -0.007000, bitrate: 354 kb/s
Stream #0:0: Video: h264 (Main), yuv420p(progressive), 338x240, 25
fps, 25 tbr, 1k tbn, 50 tbc (default)
Metadata:
HANDLER_NAME : VideoHandler
DURATION : 00:08:40.360000000
Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
Metadata:
DURATION : 00:08:40.421000000
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_videotoolbox))
Stream #0:1 -> #0:1 (opus (native) -> aac (native))
Press [q] to stop, [?] for help
[h264_videotoolbox @ 0x7fe239009600] Error: cannot create compression
session: -12915
[h264_videotoolbox @ 0x7fe239009600] Try -allow_sw 1. The hardware
encoder may be busy, or not supported.
Error initializing output stream 0:0 -- Error while opening encoder for
output stream #0:0 - maybe incorrect parameters such as bit_rate, rate,
width or height
[aac @ 0x7fe23900a800] Qavg: 65536.000
[aac @ 0x7fe23900a800] 2 frames left in the queue on closing
Conversion failed!
#
# Working
#
$ ffmpeg -y -i TextInMotion-VideoSample-720p.mp4 -c:v h264_videotoolbox
output.mp4
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 8.1.0 (clang-802.0.38)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1 --enable-shared
--enable-pthreads --enable-version3 --enable-hardcoded-tables
--enable-avresample --cc=clang --host-cflags= --host-ldflags=
--enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus
--enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma
--enable-libfdk-aac --enable-opencl --enable-videotoolbox --enable-nonfree
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc868803000] stream 0, timescale not set
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'TextInMotion-VideoSample-720p.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.25.100
Duration: 00:00:30.23, start: 0.000000, bitrate: 3701 kb/s
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], 3509 kb/s, 25 fps, 25 tbr, 12800 tbn, 50
tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:2: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown),
1920x1080 [SAR 72:72 DAR 16:9], 90k tbr, 90k tbn, 90k tbc
Stream mapping:
Stream #0:1 -> #0:0 (h264 (native) -> h264 (h264_videotoolbox))
Stream #0:0 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[h264_videotoolbox @ 0x7fc86885b200] Color range not set for yuv420p.
Using MPEG range.
Output #0, mp4, to 'output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Stream #0:0(eng): Video: h264 (h264_videotoolbox) (avc1 /
0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25
fps, 12800 tbn, 25 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.35.100 h264_videotoolbox
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc58.35.100 aac
frame= 751 fps=497 q=-0.0 Lsize= 2824kB time=00:00:30.20 bitrate=
765.8kbits/s speed= 20x
video:2795kB audio:8kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.726365%
[aac @ 0x7fc86885c400] Qavg: 65536.000
---
Alfred
_______________________________________________
ffmpeg-user mailing list
ffmpeg-***@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email
ffmpeg-user-***@ff
I would like to provide some feedback regarding the
h264_videotoolbox encoder.
Version info first:
$ ffmpeg -version
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 8.1.0 (clang-802.0.38)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1 --enable-shared
--enable-pthreads --enable-version3 --enable-hardcoded-tables
--enable-avresample --cc=clang --host-cflags= --host-ldflags=
--enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus
--enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma
--enable-libfdk-aac --enable-opencl --enable-videotoolbox --enable-nonfree
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Hardware:
my machine is Macbook Pro with OSX 10.13.6
CPU: 2,3 GHz Intel Core i7
GPU: NVIDIA GeForce GT 750M 2048 MB and Intel Iris Pro 1536 MB
I tried to use the "h264_videotoolbox" encoder both from
an application and from the command line, but it always failed
with the error code "-12915". I verified that my GPU have
support for H.264 encoder hardware acceleration. So I was
a bit puzzled.
I tried different resolutions, and it suddenly started to work!
Here are some resolutions that I tested:
320 x 240 Not working
640 × 480 Working
1280 × 720 Working
1920 × 1080 Working
my assumption now is that there is a limitation regarding
supported resolutions in the Nvidia GPU. please correct me if
I am wrong. it appears that the limitation is in the VideoToolbox
framework, and not in libavcodec (I have tested using the
VideoToolbox API directly with the same results).
This email is mainly for information, in case other people
are trying to use the same h264_videotoolbox encoder.
The application using libavcodec is a SIP client
with video, please take a look if you want:
https://github.com/alfredh/baresip/tree/master/modules/avcodec
(Btw, my objective is to use HW-accelerated video codecs
for real-time video streaming)
Below are output from 2 ffmpeg sessions; one working
and one non-working:
#
# Not working
#
$ ffmpeg -y -i ik.mkv -c:v h264_videotoolbox output.mp4
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 8.1.0 (clang-802.0.38)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1 --enable-shared
--enable-pthreads --enable-version3 --enable-hardcoded-tables
--enable-avresample --cc=clang --host-cflags= --host-ldflags=
--enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus
--enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma
--enable-libfdk-aac --enable-opencl --enable-videotoolbox --enable-nonfree
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, matroska,webm, from 'ik.mkv':
Metadata:
COMPATIBLE_BRANDS: iso6avc1mp41
MAJOR_BRAND : dash
MINOR_VERSION : 0
ENCODER : Lavf58.12.100
Duration: 00:08:40.42, start: -0.007000, bitrate: 354 kb/s
Stream #0:0: Video: h264 (Main), yuv420p(progressive), 338x240, 25
fps, 25 tbr, 1k tbn, 50 tbc (default)
Metadata:
HANDLER_NAME : VideoHandler
DURATION : 00:08:40.360000000
Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
Metadata:
DURATION : 00:08:40.421000000
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_videotoolbox))
Stream #0:1 -> #0:1 (opus (native) -> aac (native))
Press [q] to stop, [?] for help
[h264_videotoolbox @ 0x7fe239009600] Error: cannot create compression
session: -12915
[h264_videotoolbox @ 0x7fe239009600] Try -allow_sw 1. The hardware
encoder may be busy, or not supported.
Error initializing output stream 0:0 -- Error while opening encoder for
output stream #0:0 - maybe incorrect parameters such as bit_rate, rate,
width or height
[aac @ 0x7fe23900a800] Qavg: 65536.000
[aac @ 0x7fe23900a800] 2 frames left in the queue on closing
Conversion failed!
#
# Working
#
$ ffmpeg -y -i TextInMotion-VideoSample-720p.mp4 -c:v h264_videotoolbox
output.mp4
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 8.1.0 (clang-802.0.38)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1 --enable-shared
--enable-pthreads --enable-version3 --enable-hardcoded-tables
--enable-avresample --cc=clang --host-cflags= --host-ldflags=
--enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus
--enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma
--enable-libfdk-aac --enable-opencl --enable-videotoolbox --enable-nonfree
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc868803000] stream 0, timescale not set
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'TextInMotion-VideoSample-720p.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.25.100
Duration: 00:00:30.23, start: 0.000000, bitrate: 3701 kb/s
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], 3509 kb/s, 25 fps, 25 tbr, 12800 tbn, 50
tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:2: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown),
1920x1080 [SAR 72:72 DAR 16:9], 90k tbr, 90k tbn, 90k tbc
Stream mapping:
Stream #0:1 -> #0:0 (h264 (native) -> h264 (h264_videotoolbox))
Stream #0:0 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[h264_videotoolbox @ 0x7fc86885b200] Color range not set for yuv420p.
Using MPEG range.
Output #0, mp4, to 'output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Stream #0:0(eng): Video: h264 (h264_videotoolbox) (avc1 /
0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25
fps, 12800 tbn, 25 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.35.100 h264_videotoolbox
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc58.35.100 aac
frame= 751 fps=497 q=-0.0 Lsize= 2824kB time=00:00:30.20 bitrate=
765.8kbits/s speed= 20x
video:2795kB audio:8kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.726365%
[aac @ 0x7fc86885c400] Qavg: 65536.000
---
Alfred
_______________________________________________
ffmpeg-user mailing list
ffmpeg-***@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email
ffmpeg-user-***@ff