Streampunk / beamcoder

Node.js native bindings to FFmpeg.
GNU General Public License v3.0
397 stars 76 forks source link

Can't pass hwaccel flag, cuda overlay filter broken #48

Open jpietek opened 4 years ago

jpietek commented 4 years ago

Hi,

I'm experimenting with beamcoder and cuda. Previously got gpu scaling and nvenc up and running (#43), but no luck so far with overlay_cuda filter. The working ffmpeg overlay cmd (as described in this ffmpeg patch)

ffmpeg -y -hwaccel cuvid -c:v h264_cuvid -i v.ts -i o.png -filter_complex "[1:v]format=yuva420p,hwupload_cuda[overlay],[0:v]scale_npp=format=yuv420p[video],[video][overlay]overlay_cuda" -an -c:v h264_nvenc /data/out.mp4

I haven't found a way to pass the -hwaccel cuvid option to beamcoder, but assumed that hwuploading the nv-decoded frames would work:

[1:v]format=yuva420p,hwupload_cuda[overlay],[0:v]hwupload_cuda,scale_npp=format=yuv420p[video]

Unfortunately this breaks the alpha blending of the overlay, which is perfectly fine with the global hwaccel flag. No luck with format=yuv420p,hwupload_cuda too. I would be super grateful for any hints on how to get it done with beamcoder.

thanks in advance, Janek