Closed mj43 closed 5 years ago
@mj43
Writegear uses libx264 or libx265 encoders.
That's incorrect, WriteGear DOES NOT exclusively use libx264 or libx265 encoders, but only use them as fallback encoders when no -vcodec
parameter is passed in output_param dict.
Is it possible to make use of existing hardware encoders - for example on an Intel CPU the h264_vaapi encoder.
(The solution is in docs, kindly refer it for more details.)
Changing codec is a piece of cake in VidGear, just pass the encoder -vcodec:h264_vaapi
in output_param dict in WriteGear class. Also you can specify the device/harware to be used with '-vaapi_device':'/dev/dri/renderD128'
or other features such as '-vf':'format=nv12,hwupload'
in outputparam dict. You can easily find such options in FFmpeg docs with a little bit of googling. But first remember to check if your FFmpeg supports VAAPI encoders as below.
Kindly first confirm that your FFmpeg supports VAAPI encoders, with command as follows:
ffmpeg -hide_banner -encoders | grep vaapi
V..... h264_vaapi H.264/AVC (VAAPI) (codec h264)
V..... hevc_vaapi H.265/HEVC (VAAPI) (codec hevc)
V..... mjpeg_vaapi MJPEG (VAAPI) (codec mjpeg)
V..... mpeg2_vaapi MPEG-2 (VAAPI) (codec mpeg2video)
V..... vp8_vaapi VP8 (VAAPI) (codec vp8)
:bulb: Finally, Remember You can alter almost any parameter that is supported by FFmpeg itself with VidGear library!
Many thanks for this guidance.
Writegear uses libx264 or libx265 encoders. Is it possible to make use of existing hardware encoders - for example on an Intel CPU the h264_vaapi encoder. I ask as using libx264 my CPU is saturating and the output video is dropping frames. In tests I have done outside of Writegear, using the h264_vaapi encoder significantly reduces the CPU load.