bytedeco / javacpp-presets

The missing Java distribution of native C++ libraries
Other
2.68k stars 743 forks source link

Hardware Accell in ffmpeg #389

Open CraziFuzzy opened 7 years ago

CraziFuzzy commented 7 years ago

Is there a technical or licensing reason that would prevent enabling the various hardware accelerated codecs in the ffmpeg.jar?

saudet commented 7 years ago

If we can build them easily and FFmpeg can fall back on software when the hardware is missing, that is fine. Check pull #388, for example, this is one being investigated for ARM at the moment.

CraziFuzzy commented 7 years ago

Hmmm. I'll have to investigate that. I don't believe ffmpeg ever will fallback to using a codec that is not specified. nvenc_h264, h264_qsv, and h264 are all completely separate encoders. It would probably be up to the application to make sure it's requesting the right encoder.

saudet commented 7 years ago

If they show up as additional encoders, yeah, doesn't sound like that would cause any issues.

CraziFuzzy commented 7 years ago

Yeah, as far as I know, they are pretty independent from the existing software codecs. What I don't know is how difficult it would be to build, I have always used pre-built binaries, on both windows and linux. I don't know if it's as simple as enabling an additional switch, or if other 3rd party libraries need to be included as well. The first source of info I know of on it is here: https://trac.ffmpeg.org/wiki/HWAccelIntro Might make more sense to you than I.

saudet commented 7 years ago

Ok, let's keep this issue open so others can check this out as well and weigh in. Thanks for the link!

saudet commented 6 years ago

FYI, support for Intel QSV as been merged with pull https://github.com/bytedeco/javacpp-presets/pull/485.

saudet commented 6 years ago

MMAL and OpenMAX acceleration has also been merged with pull #388 for ARM platforms. Is there any other supported APIs worth adding?

n-kai-cj commented 6 years ago

I committed Nvidia NVENC as well. As far as I know, there is no other hardware codecs in ffmpeg. I think this issue can be closed.

saudet commented 6 years ago

There are a couple of others like OpenCL, but I remember having issues with that one previously...

n-kai-cj commented 6 years ago

As for OpenCL, it's currently only used for filtering, encoding/decoding is not supported for now. https://trac.ffmpeg.org/wiki/HWAccelIntro

And official ffmpeg seems not to be built with --enable-opencl for windows platform. Apparently I can't help this.

mifritscher commented 6 years ago

On Windows 7 64 bit, JavaCV 1.4, on Skylake (with switchable graphics, I've a AMD GPU as well), I get following: 40 [h264_qsv @ 00000000219bbde0] Initialized an internal MFX session using hardware accelerated implementation Could not open codec: Internal bug, should not have happened

Any ideas how to debug this? This happens both trying mpeg2_qsv and h264_qsv.

Edit: Same on a computer with only Intel graphics.

saudet commented 2 years ago

@mifritscher Please ask upstream about bugs in libmfx: https://github.com/lu-zero/mfx_dispatch/issues

bradh commented 2 years ago

Also, maybe try again with the new cmake-based build on git master if you can.