Skip to content
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

feature request ffmpeg hwaccel #6

Open
sintaxx opened this issue Aug 19, 2020 · 4 comments
Open

feature request ffmpeg hwaccel #6

sintaxx opened this issue Aug 19, 2020 · 4 comments

Comments

@sintaxx
Copy link

sintaxx commented Aug 19, 2020

this is one of the best gallery generators i've found that handles images/videos and its very simple.

my request being adding support for the -hwaccel flag for ffmpeg to use GPU to speed up transcoding greatly.

i tried modifying the mediautils.py to add in the -hwaccel flag but i'm not much familar with python but it seems like it would be easy to specify hwaccel and possibly more flags for nvidia specific cards.

@niol
Copy link
Owner

niol commented Aug 19, 2020

Thanks for your feedback.

I just added what I think would enable hwaccel in ae5dad7 . I do not have the hardware to test. Please tell me how it works for you.

@sintaxx
Copy link
Author

sintaxx commented Aug 19, 2020

After some testing and reading more into the GPU decoder/encoder it unfortunately appears that WEBM is not supported for hardware acceleration, only H264 and H265. Would it be possible to add options to either use your default of WEBM (libvpx-vp9) or to just leave the video files as-is, with no converting ? worst case they could be resized by a percentage to H264 and use full GPU acceleration in the future, or even H265 but if they could be left as-is and only have thumbs generated i think that would work better. I love webm but they also have some issues with iOS playback last time i checked. Another option which is probably more troublesome would be to allow flags to be passed to lazygal to fully specify to use GPU or not, as well as letting the user choose which video/audio codec and resize percentage. In the meantime if you'd allow an option to disable transcoding and copying the files, generating thumbnails that would be amazing.

if you need a machine to use to test gpu params i could always spin up a docker container with a debian system in it with access to my GPU, just an idea.

I tested -hwaccel cuda and -hwaccel cuvid and they both DO use the GPU but offer no speed improvements from what I observed. Tested on an 11MB MP4 video file.

It turns out that some newer Intel CPU's offer encoding acceleration for VP8/VP9 via Intel Quicksync (QSV). I can do some testing with this later on, my servers use Xeons and they do not have QSV extensions.

Update: after messing with this all day i've not had any success at hardware accelerating encoding using GPU or CPU(QSV Intel), it's a huge pain in the ass. I personally think the best thing would be to just have an option to disable the transcoding altogether since it appears that most webm files become fairly low quality with defaults, so i'm not sure if the time involved is worth it, for me at least.

@niol
Copy link
Owner

niol commented Aug 20, 2020

Then I understand that this issue is about the following requests:

  • improve webm transcoding quality
  • provide a configuration parameter to copy original video if already readable by a web browser
  • provide a configuration parameter to add/replace what is passed on ffmpeg

@sintaxx
Copy link
Author

sintaxx commented Aug 25, 2020

sounds perfect !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants