bytedeco / javacpp-presets

The missing Java distribution of native C++ libraries
Other
2.65k stars 736 forks source link

Nvidia CUDA "scale_npp" filter #857

Open egorapolonov opened 4 years ago

egorapolonov commented 4 years ago

Hi @saudet ,

I'm using ffmpeg.class wrapper for reaching completely GPU-based transcoding.

Actually, I'm trying to repeat command which described here in tutorial https://devblogs.nvidia.com/nvidia-ffmpeg-transcoding-guide/

ffmpeg -vsync 0 –hwaccel cuvid -c:v h264_cuvid -i input.mp4 \ -c:a copy –vf scale_npp=1280:720 -c:v h264_nvenc -b:v 5M output_720.mp4

I see errors that there is no "scale_npp" filter. The ffmpeg should be configured with "--enable-libnpp". Are there any maven-modules which contains libnpp. I'd like to include them into JavaCV

saudet commented 4 years ago

Yes, NPP is being bundled in the presets for CUDA, so it would be possible to update the presets for FFmpeg with a "-gpu" extension as is already done for OpenCV, etc and use it that way.

devjeonghwan commented 2 years ago

Create and initialize AVFilterContext using nppscale_init and then define in, out frame informations(pixel format, size, etc..) to NPPScaleStageContext.

Now, you can call npp resize function like this.

static int nppscale_resize(AVFilterContext *ctx, NPPScaleStageContext *stage, AVFrame *out, AVFrame *in)

Let's check vf_scale_npp.c in ffmpeg.