Discussion:
[FFmpeg-user] OpenCL? What Effect Does It Have
James Board
2013-08-05 16:29:58 UTC
Permalink
If I were to install a more powerful Nvidia graphics card on my
machine, and then configure and build ffmpeg with OpenCL
enabled, what effect would it have?  The main things I do
are

* Inverse telecine, or deinterlace filters
* Convert to a lossless format: ffvhuff, ljpeg, etc (I currently do this with mencoder, but would switch to ffmpeg if it's faster).  This takes a large amount of time.

* Cut edits with the Select filter
* Brightness filters
* Encode to mpeg4.Since my files are all stored in a lossless format like ffvhuff, much of the
time is spent compressing and decompressing that format.  Would
OpenGL help withthis or any of the other steps above?   What are the
types of things that OpenCL improves in ffmpeg?
Carl Eugen Hoyos
2013-08-05 17:47:25 UTC
Permalink
Post by James Board
If I were to install a more powerful Nvidia graphics
card on my machine, and then configure and build
ffmpeg with OpenCL enabled, what effect would it have?
In theory, you could use opencl for the deshake and
the unsharp filters but I don't know if sufficiently
new OpenCL drivers exist.
Post by James Board
* Inverse telecine, or deinterlace filters
Unrelated to your question:
I suspect that deinterlacing (yadif) is faster with
FFmpeg than MEncoder.
Post by James Board
* Convert to a lossless format: ffvhuff, ljpeg, etc
(I currently do this with mencoder, but would switch
to ffmpeg if it's faster).
Given that MEncoder uses the exact same source code
to encode ffvhuff and ljpeg (and most probably "etc")
how do you expect that FFmpeg could be faster?
Allow me to repeat that since MEncoder is not
actively maintained, it makes no sense to use it if
you don't have very special needs (like binary
codecs but you should be able to use them with
mplayer -vo yuv4mpeg and FFmpeg).

Carl Eugen
James Board
2013-08-05 18:32:11 UTC
Permalink
Post by Carl Eugen Hoyos
In theory, you could use opencl for the deshake and
the unsharp filters but I don't know if sufficiently
new OpenCL drivers exist.
Unrelated to my question.  I don't use deshake and I don't
use unsharp.  That's why I listed the filters I do use: so that
someone can tell me whether or not OpenCL will improve
performance for those filters (and codecs).  That was my
original question.
 
Post by Carl Eugen Hoyos
Post by James Board
* Inverse telecine, or deinterlace filters
 
No.  Not unrelated to my question.  In fact, that is my question:
Will ffmpeg+OpenCL improve the performance of the filters
and codecs I listed.
 
Post by Carl Eugen Hoyos
Given that MEncoder uses the exact same source code
to encode ffvhuff and ljpeg (and most probably "etc")
how do you expect that FFmpeg could be faster?
 
But I don't expect ffmpeg is faster then mencoder.  Possibly,
ffmpeg+OpenCL is faster.  That's the original question.
My original question was whether ot not ffmpeg+OpenCL
will improve my performance.  Will it?
 
Post by Carl Eugen Hoyos
Allow me to repeat that since MEncoder is not
actively maintained, it makes no sense to use it if
you don't have very special needs
 
I already know how to use mencoder.  Why learn another
tool which uses, as you claim, the exact same source code?
 
But that's besides the point.  The original question was whether
or not ffmpeg+OpenCL will improve my performance.  Not whether or
not it makes sense to switch from mencoder to ffmpeg.
Paul B Mahol
2013-08-06 09:56:55 UTC
Permalink
Post by Carl Eugen Hoyos
Post by James Board
If I were to install a more powerful Nvidia graphics
card on my machine, and then configure and build
ffmpeg with OpenCL enabled, what effect would it have?
In theory, you could use opencl for the deshake and
the unsharp filters but I don't know if sufficiently
new OpenCL drivers exist.
Post by James Board
* Inverse telecine, or deinterlace filters
I suspect that deinterlacing (yadif) is faster with
FFmpeg than MEncoder.
Yadif from libavfilter can also use multiple threads.
Post by Carl Eugen Hoyos
Post by James Board
* Convert to a lossless format: ffvhuff, ljpeg, etc
(I currently do this with mencoder, but would switch
to ffmpeg if it's faster).
I suppose those could be made multithread too.
Post by Carl Eugen Hoyos
Given that MEncoder uses the exact same source code
to encode ffvhuff and ljpeg (and most probably "etc")
how do you expect that FFmpeg could be faster?
Allow me to repeat that since MEncoder is not
actively maintained, it makes no sense to use it if
you don't have very special needs (like binary
codecs but you should be able to use them with
mplayer -vo yuv4mpeg and FFmpeg).
Carl Eugen
_______________________________________________
ffmpeg-user mailing list
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
James Board
2013-08-06 13:02:21 UTC
Permalink
Post by Paul B Mahol
Yadif from libavfilter can also use multiple threads.
Okay.  But are they accelerated with OpenCL?
Post by Paul B Mahol
Post by James Board
* Convert to a lossless format: ffvhuff, ljpeg, etc
(I currently do this with mencoder, but would switch
to ffmpeg if it's faster).
I suppose those could be made multithread too.
Multi-threaded is one thing.  OpenCL is another.  Are the
above converted to run with OpenCL?
Post by Paul B Mahol
Given that MEncoder uses the exact same source code
to encode ffvhuff and ljpeg (and most probably "etc")
how do you expect that FFmpeg could be faster?
Maybe my original question, and reply to Carl wasn't clear enough.

OpenCL is an API for using GPUs to do computationally
intensive tasks.  See this URL
    http://en.wikipedia.org/wiki/OpenCL
By coding expensiev tasks in OpenCL, especially image processing operations
which ffmpeg does all the time, you can achieve 10x to 100x performance
improvement.  I'd like to know what parts of ffmpeg have been
accelerated with OpenCL.  This could potentially improve the
performance and prestige of ffmpeg.  But it doesn't sound like much
work has been done in this area.  Is that true?
Tom Evans
2013-08-06 13:37:25 UTC
Permalink
Post by James Board
OpenCL is an API for using GPUs to do computationally
intensive tasks. See this URL
http://en.wikipedia.org/wiki/OpenCL
By coding expensiev tasks in OpenCL, especially image processing operations
which ffmpeg does all the time, you can achieve 10x to 100x performance
improvement. I'd like to know what parts of ffmpeg have been
accelerated with OpenCL. This could potentially improve the
performance and prestige of ffmpeg. But it doesn't sound like much
work has been done in this area. Is that true?
OpenCL can be used to accelerate the unsharp and deshake filters, as
documented in the filters documentation.

https://www.ffmpeg.org/ffmpeg-filters.html

Sometimes it gives worse results than using the CPU:

http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=10&t=1284

Generally the consensus (at least on here, as far as I can tell) is
that GPU assisted encoding is slow and gives crap results. YMMV.

Cheers

Tom
James Board
2013-08-07 00:27:14 UTC
Permalink
Post by Tom Evans
OpenCL can be used to accelerate the unsharp and deshake filters, as
documented in the filters documentation.
Okay.  I saw that.  But are you saying that only those components of
ffmpeg that are OpenCL accelerated?
Post by Tom Evans
Generally the consensus (at least on here, as far as I can tell) is
that GPU assisted encoding is slow and gives crap results. YMMV.
If optimized well, GPU assisted encoding would be extremely fast.
I bet the people that coded the OpenCL encoders didn't have much
GPU optimization experience.
Tom Evans
2013-08-07 09:05:11 UTC
Permalink
Post by Tom Evans
OpenCL can be used to accelerate the unsharp and deshake filters, as
documented in the filters documentation.
Okay. I saw that. But are you saying that only those components of
ffmpeg that are OpenCL accelerated?
Yes. Carl said it earlier too.
Post by Tom Evans
Generally the consensus (at least on here, as far as I can tell) is
that GPU assisted encoding is slow and gives crap results. YMMV.
If optimized well, GPU assisted encoding would be extremely fast.
I bet the people that coded the OpenCL encoders didn't have much
GPU optimization experience.
I'm not talking about GPU encoding in ffmpeg, but GPU encoding in
general. It's not an uncommon opinion:

"""
The primary comparison here is between Xilisoft’s Ultimate Video
Converter, Arcsoft Media Converter, and Cyberlink’s MediaEspresso.
Other potential options, including Avivo, Badaboom, and MediaCoder are
discussed at the end of the article.

The TL;DR version of this article is as follows: If you want a video
encoder that’ll run on virtually any system, has well-thought,
easy-to-use presets, and neatly balances quality and file size, go
download Handbrake. It’s fast, free, and efficient — it just doesn’t
use the GPU.
"""

http://www.extremetech.com/computing/128681-the-wretched-state-of-gpu-transcoding

Handbrake, of course, being based around libav.

Cheers

Tom

Continue reading on narkive:
Loading...