Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert video with ffmpeg using gpu

I have video sharing site and convert video with ffmpeg but it take a lot of time for converting. how can do it fast and safe? I think when ffmpeg match with GPU it helps me but I find no good reference to use. Which application or reference can help me that have good performance.

like image 842
sdnaghdi Avatar asked Aug 17 '13 07:08

sdnaghdi


People also ask

Can FFmpeg use the GPU?

FFmpeg with NVIDIA GPU acceleration is supported on all Linux platforms.

Does FFmpeg use GPU or CPU?

the CPU% has been more than 90 (375%). In case of ImageMagick, if I enable opencl while configuring, then the app will run in GPU, i.e., the CPU% will be less than 90. I noticed that. But in case of ffmpeg, it is GPU accelerated one.


Video Answer


3 Answers

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.

like image 191
Arnaud Leyder Avatar answered Oct 19 '22 17:10

Arnaud Leyder


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

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

like image 25
Justin Buser Avatar answered Oct 19 '22 18:10

Justin Buser


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.

  • http://forum.doom9.org/showthread.php?t=164960
  • http://forum.doom9.org/showthread.php?t=165984

It may help.

like image 2
alexbuisson Avatar answered Oct 19 '22 18:10

alexbuisson