Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using ffmpeg without hardware acceleration (C++)

Tags:

c++

video

ffmpeg

I'm working on an application (c++/Linux) that uses the ffmpeg 3.4 libraries to do video encoding. Since version 3.3 hardware acceleration is enabled by default if the platform supports it. The graphics card in my dev system has hardware acceleration support, but the tool also has to run on older systems that do not. How can i configure ffmpeg to disable hardware acceleration for video encoding? There is a ton of info about enabling, but i just cant find how to disable it.

ps. There already is a similar question: How to turn off ffmpeg hardware acceleration but its a year old and unfortunately still unanswered.

like image 313
MadMarky Avatar asked Feb 23 '26 18:02

MadMarky


1 Answers

I can't find any reference so I think the support for hardware acceleration is enabled by default (there's a configure option to disable it, --disable-hwaccels). You still need to code to make it happen. The wiki covers command-line usage as far as I can see.

Decoding (internal):

  • for the internal HW decoders you would have to follow the example in doc/examples/hw_decode.c

Decoding / Encoding (external):

  • you must specifically choose a hardware accelerated encoder/decoder using the avcodec_find_decoder_by_name / avcodec_find_encoder_by_name functions
  • the naming convention for these encoders is generally codec_api (eg: h264_nvenc) and they have specific options based on the SDK they use.
  • there's no software fallback so you must check device capabilities beforehand.
like image 165
aergistal Avatar answered Feb 26 '26 09:02

aergistal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!