I'm currently trying to achieve a mosaic including 4 videos using FFmpeg and hardware acceleration.
I'm working on Ubuntu 16.04, I've installed NVIDIA drivers using apt repo aswell as CUDA. I'm using FFmpeg in version 3.3.
I've succeeded to create it without hardware acceleration but I'm stuck. Here is the command line I use :
ffmpeg -hwaccel cuvid -c:v h264_cuvid \
-i bbb_sunflower_2160p_30fps_normal.mp4 \
-i bbb_sunflower_2160p_30fps_normal.mp4 \
-i bbb_sunflower_2160p_30fps_normal.mp4 \
-i bbb_sunflower_2160p_30fps_normal.mp4 \
-filter_complex "nullsrc=size=1440x960 [base]; \
[0:v] hwdownload, format=nv12, scale_npp=720x480 [upperleft]; \
[1:v] hwdownload, format=nv12, scale_npp=720x480 [upperright]; \
[2:v] hwdownload, format=nv12, scale_npp=720x480 [lowerleft]; \
[3:v] hwdownload, format=nv12, scale_npp=720x480 [lowerright]; \
[base][upperleft] overlay=shortest=1 [tmp1]; \
[tmp1][upperright] overlay=shortest=1:x=720 [tmp2]; \
[tmp2][lowerleft] overlay=shortest=1:y=480 [tmp3]; \
[tmp3][lowerright] overlay=shortest=1:x=720:y=480; \
hwupload_cuda" \
-c:v h264_nvenc -f matroska pipe:1 | ffplay -i -
It doesn't work and I get :
Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_hwupload_cuda_17
I think the issue is about the upload of modified frames by filters into the card but I can't figure how to achieve it. I've tried to add [base]
before hwupload_cuda
but it doesn't help, and honestly, I'm a bit lost.
-hwaccel cuvid -c:v h264_cuvid
before each-i
and and a comma instead of a semi-colon after the last overlay.Impossible to convert between the formats supported by the filter 'Parsed_format_2' and the filter 'auto_scaler_0'
andFailed to inject frame into filter network: Function not implemented
. I may have to specify a hardware compliant format ?scale_npp
.