<p>Regarding,</p>

<pre><code>Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_hwupload_cuda_17
</code></pre>

<p>in</p>

<pre><code>[tmp3][lowerright] overlay=shortest=1:x=720:y=480;hwupload_cuda
</code></pre>

<p>you have to replace the <code>;</code> with a <code>,</code> else the overlay filterchain is terminated and the hwupload starts a new chain.</p>

<p>Input options like <code>-hwaccel cuvid -c:v h264_cuvid</code> only apply to the input immediately following them. These options have to be prefixed before each input for which they're intended.</p>

<p><code>scale_npp</code> is a CUDA scaler, so for a hardware-decoded stream, no filter is required to transfer frames. After scaling, frames will have to be transported to system memory using <code>hwdownload,format=nv12</code>.</p>

CC BY-SA 4.0
2018-10-23T08:38:01.637Z
2018-10-23T08:38:01.637Z
Gyan
<p>I'm currently trying to achieve a mosaic including 4 videos using FFmpeg and hardware acceleration.</p>

<p>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.</p>

<p>I've succeeded to create it without hardware acceleration but I'm stuck. Here is the command line I use : </p>

<pre><code>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 -
</code></pre>

<p>It doesn't work and I get :</p>

<pre><code>Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_hwupload_cuda_17
</code></pre>

<p>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 <code>[base]</code> before <code>hwupload_cuda</code> but it doesn't help, and honestly, I'm a bit lost.</p>

CC BY-SA 4.0
2018-10-22T14:51:13.740Z
Do you mean to decode the same video four times?
Gyan
CC BY-SA 4.0
2018-10-22T15:03:54.073Z
I work with the same video 4 times for test purpose, but the goal is to decode 4 differents video and display it in a mosaic.
c.censier
CC BY-SA 4.0
2018-10-22T15:07:30.770Z
Ok. You'll need `-hwaccel cuvid -c:v h264_cuvid` before each `-i` and and a comma instead of a semi-colon after the last overlay.
Gyan
CC BY-SA 4.0
2018-10-23T06:34:44.920Z
I got an error `Impossible to convert between the formats supported by the filter 'Parsed_format_2' and the filter 'auto_scaler_0'` and `Failed to inject frame into filter network: Function not implemented`. I may have to specify a hardware compliant format ?
c.censier
CC BY-SA 4.0
2018-10-23T07:16:39.893Z
You're scaling on the GPU so you need hwdownload and the format *after* `scale_npp`.
Gyan
<ffmpeg><nvidia>
FFmpeg mosaic with hardware acceleration on Quadro P4000
c.censier
# FFmpeg mosaic with hardware acceleration on Quadro P4000

(Asked by: username_0 on 2018-10-22)

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.

**Tags:** ffmpeg, nvidia

> **Comments:**
> **username_1**: Do you mean to decode the same video four times?  
> **username_0**: I work with the same video 4 times for test purpose, but the goal is to decode 4 differents video and display it in a mosaic.  
> **username_1**: Ok. You'll need `-hwaccel cuvid -c:v h264_cuvid` before each `-i` and and a comma instead of a semi-colon after the last overlay.  
> **username_0**: I got an error `Impossible to convert between the formats supported by the filter 'Parsed_format_2' and the filter 'auto_scaler_0'` and `Failed to inject frame into filter network: Function not implemented`. I may have to specify a hardware compliant format ?  
> **username_1**: You're scaling on the GPU so you need hwdownload and the format *after* `scale_npp`.  

---

## 1 answers

### Answer by username_1 on 2018-10-23. Score: 2 | Accepted answer

Regarding,
Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_hwupload_cuda_17

in
[tmp3][lowerright] overlay=shortest=1:x=720:y=480;hwupload_cuda

you have to replace the ; with a , else the overlay filterchain is terminated and the hwupload starts a new chain.
Input options like -hwaccel cuvid -c:v h264_cuvid only apply to the input immediately following them. These options have to be prefixed before each input for which they're intended.
scale_npp is a CUDA scaler, so for a hardware-decoded stream, no filter is required to transfer frames. After scaling, frames will have to be transported to system memory using hwdownload,format=nv12.


---

