[FFmpeg-user] overlay_qsv with hardware decode and encode

Vladimir Mishonov me at player701.net
Fri Feb 28 07:48:42 EET 2025


On 2025-02-28 02:36, Greg Oliver wrote:

> On Thu, Feb 27, 2025 at 11:25 AM Vladimir Mishonov via ffmpeg-user <
> ffmpeg-user at ffmpeg.org> wrote:
> 
> 
> https://ffmpeg.org/pipermail/ffmpeg-user/2024-August/058638.html
> 

Thanks for the link. Unfortunately, that seems to be only tangentially 
related to my scenario because:

1) The resolutions of each input stream do not change over time.

2) I can use software decoding and I do not need to insert any scale 
filters before sending the streams to hardware:

ffmpeg -init_hw_device vaapi=hw -filter_hw_device hw \
 -i rtmp://localhost/stream1 \
 -i rtmp://localhost/stream2 \
 -filter_complex 
"[0:v]format=nv12,hwupload=extra_hw_frames=120[i0];[1:v]format=nv12,hwupload=extra_hw_frames=120[i1];[i0][i1]overlay_vaapi=w=500" 
\
 -c:v h264_vaapi -global_quality 25 -g 50 -r 25 -an -f null -
 
The above command works regardless of whether the input resolutions are 
the same, or different. The CPU usage is quite low, but still 
noticeable. Note that even if some kind of filter does get automatically 
inserted, it does not interfere with the videos themselves in any way - 
otherwise, I would have noticed it long ago either because of excessive 
CPU usage, or the resolution and/or the content of the output stream 
being different from what is expected, or both.

It would also be, in principle, fundamentally wrong to apply any kind of 
software processing in a (theoretically) purely hardware filter pipeline 
- not to mention pointless due to the overlay filter in the end, which 
performs its own scaling anyway.

P.S. sorry for top-posting the previous response, I forget it's not 
customary because I very rarely use mailing lists, only when there is no 
other option.

---
Kind regards,
Vladimir


More information about the ffmpeg-user mailing list