How to Get Data from YT-DLP to Browser Using PHP

I’m trying to Get YT-DLP data using PHP
Using SSH yt-dlp BaW_jenozKc I’m able to generate download codes, however same thing for PHP is not working on browser.

Have tried this code

<?php
$proc = popen('yt-dlp -o - BaW_jenozKc', 'r');
header("Content-Type: video/mp4");
while (!feof($proc))
{
    echo fread($proc, 4096);
}
pclose($proc);
?>

The above code expect to generate streaming link but its giving me error with no video with supported format and mime type found

On the other side when I use this PHP code

<?php
echo shell_exec("wget -O speedtest.py https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py && chmod +x speedtest.py && ./speedtest.py");
?>

It works great, can anybody tell me what’s wrong with the code or is there any permission issue for displaying data on browser?