WWBN / AVideo-Encoder

Encoder Server for AVideo Platform Open-Source
https://platform.avideo.com
GNU Affero General Public License v3.0
152 stars 189 forks source link

Using Hardware Accelerated Encoding (CUDA) with Dynamic MP4 #448

Open rfraedrich opened 2 years ago

rfraedrich commented 2 years ago

I like to utilize an RTX 3090 on a virtualized Encoder instance and need to customize the encoding parameters. Otherwise than MP4 Low, SD & HD the dynamic encoding seems to have the command prefix "ffmpeg -i {$pathFileName}..." somehow "hardcoded".

image

In order to get hardware encoding to work, i need to place "-hwaccel cuda -hwaccel_output_format cuda" inbetween ffmpeg and -i so that my string will look something like this:

ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i {$pathFileName} -vf scale_npp=-2:{$resolution} -c:a copy -c:v h264_nvenc -b:v 8M -y {$destinationFile}

Where can i modify this? Thanks in advance.

DanielnetoDotCom commented 2 years ago

Check this ...

https://github.com/WWBN/AVideo-Encoder/wiki/Configuration.php-variable-(-some-are-hidden-)

add this in your videos/configuration.php file

$global['ffmpeg'] = 'ffmpeg -hwaccel cuda -hwaccel_output_format cuda ';

akhilleusuggo commented 1 year ago

@DanielnetoDotCom Actually the variable $global['ffmpeg'] is missing from the documentation page you have linked, or it's misleading? To my understanding, it's only to point to the executable location, and not to customize the encoder ffmpeg command line attributes.

$global['ffmpeg'] = '/usr/bin/ffmpeg'; // Location of the FFMPEG executable

https://github.com/WWBN/AVideo-Encoder/wiki/Configuration.php-variable-(-some-are-hidden-)

DanielnetoDotCom commented 1 year ago

you can add some custom parameters like hardware acceleration , for example

$global['ffmpeg'] = '/usr/bin/ffmpeg -hwaccel cuvid ';