Convert video with FFmpeg using GPU
Asked Answered
M

3

19

I have a video sharing site and convert videos with FFmpeg but it takes a lot of time for converting.

How can do it fast and safe?

I think when FFmpeg uses the GPU it helps me but I find no good reference on how to use the that.

Which application or reference can help me that allow for good performance?

Medial answered 17/8, 2013 at 7:33 Comment(5)
What have you tried? You will have more chance at getting help if you provide the code you have tried.Conni
h264 converting format use VDPAU acceleration but I don`t know how can enable it and use.Medial
VDPAU (Video Decode and Presentation API for Unix) Not sure it will be useful for the encoding ... Look more like something to decode&play video!Aorist
Current state trac.ffmpeg.org/wiki/HWAccelIntro#CUDACUVIDNvDecodeLadle
See also this question.Afield
P
13

Update Q4 2017. Since my original answer GPU-based encoding has become widely available. If you have a modern NVIDIA video card and can compile ffmpeg then you should be good to go. Thanks to Dmytro Dzyubak for pointing out the FFmpeg docs stating that indeed "CPU based encoding generally produces better quality than GPU based encoding."

--

GPU based encoding is specific to a codec/GPU computing standard (CUDA, OpenCL) so you would need to specify what are you using in your case. ffmpeg is amongst other things a wrapper for popular codecs like x264 and VP8 for video.

Using x264 all attempts so far have produced mixed results at best. Nothing that could be passed on to production has come to see the light of day.

Main concept offers an SDK that can be used for H264 GPU based encoding. You can read here for more information. I have not seen the price tag for their SDK but it could be expensive I guess.

Depending on the codec you use you are better off tweaking the encoding settings to trade off quality for speed. On a side note CPU based encoding tends to produce better quality than GPU based encoding.

Pincushion answered 26/4, 2014 at 12:33 Comment(2)
"CPU based encoding produces better quality than GPU based encoding." - citation needed.Eatton
"Hardware encoders typically generate output of significantly lower quality than good software encoders like x264" - trac.ffmpeg.org/wiki/HWAccelIntroHomophone
W
4

If you're using an NVidia GPU this might be helpful:

https://developer.nvidia.com/nvidia-codec-libraries

Whereon answered 27/8, 2014 at 23:23 Comment(0)
A
2

It may be still "under development", but i found several doom9 thread taking about a huge improvement of the x264 encoder(the lib ffmpeg use) when the "LookAhead" function is "on GPU" But it use OpenCL.

It may help.

Aorist answered 17/8, 2013 at 13:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.