-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hardware Transcoding #592
Comments
Hi, I made a config to add custom input options to ffmpeg. Api doc that I'm using: https://www.npmjs.com/package/fluent-ffmpeg#inputoptionsoption-add-custom-input-options. pigallery2/src/backend/model/threading/VideoConverterWorker.ts Lines 57 to 59 in e7983a6
Can you report back about your findings? Like: are you using docker and Raspberry pi 4? Could you make hardware acceleration work? If yes, with what configuration. If its an easy addition I will make it a default settings. |
Looking a bit around. Might not work out of the box as size breaks with vaapi according to this: fluent-ffmpeg/node-fluent-ffmpeg#1120 I'm using size: pigallery2/src/backend/model/threading/VideoConverterWorker.ts Lines 67 to 69 in e7983a6
Also if you set logging to silly, it should print executed ffmpeg command. |
Hello! Thanks a lot for great gallery! I can confirm that the options specified in the field This was tested with version 1.9.5 using Alpine Docker image. Here are options I specified for VAAPI video conversion: Pigallery2 runs ffmpeg with the following command line (taken from logs): As you see, the specified options are placed before the output file. The correct location would be before the input file, as below: Also a change in scaling filter is needed: instead of Can you consider making ffmpeg options more customizable? |
I've just noticed the input options are already added in the nightly builds. With that I've managed to workaround other issues and enable HW acceleration with the following approach.
Note the absence of spaces in the options near
This may be done with The PR has a bug when videoCodec is not the first option, as in pigallery2. To fix the bug apply the following patch to diff --git a/lib/options/videosize.js b/lib/options/videosize.js
--- a/lib/options/videosize.js
+++ b/lib/options/videosize.js
@@ -7,8 +7,8 @@
function getScaleFilter(output) {
- if (output.video.get('-vcodec').length > 1) {
- let codec = output.video.get('-vcodec')[1];
+ if (!!output.video.find('-vcodec', 1)) {
+ let codec = output.video.find('-vcodec', 1)[0];
if (codec.endsWith('_vaapi')) {
return 'scale_vaapi'; After those steps are done HW acceleration works fine in my case. |
I'm not sure what is the status of this issue. Looking at the cod of the current "fluent-ffmpeg": "2.1.2", I'm closing this bug with the assumption that no further action is needed. |
Hey,
I'm trying to enable hw transcoding (vaapi) for video converting.
Tried to add -hwaccel vaapi; -hwaccel_output_format vaapi; -vaapi_device /dev/dri/renderD128 to custom options and h264_vaapi to codec but log tells me;
[FFmpeg] Error: ffmpeg exited with code 1: Option hwaccel (use HW accelerated decoding) cannot be applied to output url -hwaccel_output_format vaapi -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.
So is it possible to send custom options before "-i" of ffmpeg?
The text was updated successfully, but these errors were encountered: