ffplay how to play HEVC or H264 with hardware acceleration on Mac?
5,383
You can pipe the result of ffmpeg
to ffplay
. I tested on an 1080p video using VAAPI acceleration, the CPU rate decreased about 10% altogether.
See HWAccelIntro here. It talks about ffmpeg
, but you can pipe the result of ffmpeg
to ffplay
.
For example, play test.mp4 using VAAPI on Linux:
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -i test.mp4 \
-vcodec rawvideo -acodec copy -f matroska - | ffplay -i -
Use rawvideo
for video encoding, and use -f
to specify a container. Videotoolbox
should be similar. If you managed to decode a video with Videotoolbox
in ffmpeg, just pipe to ffplay
in this way.
Author by
Chen OT
Updated on September 18, 2022Comments
-
Chen OT almost 2 years
In FFmpeg, I can specific encoder by
-c:v h264_videotoolbox
to use Videotoolbox with GPU acceleration to do transcode.But I don't know what commands I should give to ffplay to utilize Videotoolbox with hardware decoding?
ffplay -hwaccel_flags my.mp4 // no GPU usage up ffplay -pixel_format videotoolbox_vld my.mp4 // Option pixel_format not found ffplay -decoders | grep "box" // only decoders with (AudioToolbox) shows ffplay -buildconf // the --enable-videotoolbox is showed
-
Gyan almost 5 yearsWhat's the output of
ffplay -decoders | grep "264"
-
Chen OT almost 5 yearsonly one row: "VFS..D h264 H.264/AVC/MPEG-4 AVC/MPEG-4 part10". It does not indicate whether it support HW or not. ffplay/ffmpeg is installed from brew. I also tried static build from official site and build from GitHub source code in 4.2 branch. Those seems the same.
-
Chen OT almost 5 yearsMy platform is iMac 21" 4K 2019. Tested another App, when playing the HEVC on VLC app, the I have GPU rate raised to 70%~80%.
-