下载YouTube视频而不将其存储在服务器上

I have a personal php script that allows me to download the videos of my choice. Currently, this runs youtube-dl and if necessary convert the video, ffmpeg then.

I'm looking for a way to allow my script to download/convert the video without even storing it on the server. Make sure that youtube-dl/ffmpeg acts as a gateway but without downloading the file.

Do you have any idea how to do this? The idea would be to run ffmpeg on the youtube link and not on the video after it has been downloaded, and allow the user to download it at the same time as the conversion is in progress.

We can see that this site for example www.onlinevideoconverter.com uses this method, because if we ask for a video of 2 hours or more, it allows us to download it immediately.

You can tell youtube-dl to output to stdout using -o - and then pipe it thru ffmpeg. But there are some tricky things to consider like not all formats can or needs to be tweaked to be playable as a stream.