Natsumi-sama / VRChat-YouTube-dl-stub

Use a local web server to serve cached videos to VRChat
MIT License
8 stars 1 forks source link

Can't get this to work #1

Open alkaris2 opened 2 years ago

alkaris2 commented 2 years ago

I tried this out to see if I could get VR Chat in-game media to play, but I've had nothing but issues with getting it to work.

So my process was that I created a light Apache server with httpd I made sure to dump the PHP file into server directory, set in the Program.cs file the server IP, once compiled with monodevelop I loaded up VR Chat and loaded into a world that has video/music media players, I made sure I added GST_DEBUG=5 WINEDEBUG=+mfplat and --enable-debug-gui to the Launch Options just to be sure, and disabled after trying things out. As I check the debug console log I end up getting errors as it cannot open the media streams, which are of course encoded in the .m3u8 format. I tried in a different world where it let me load media from a YouTube URL instead, and the result was that it failed to decode the URL, or ended up with Access Denied, I did check if it was a permissions problem of the server directory, but it had write access enabled.

Natsumi-sama commented 2 years ago

I've updated everything to reference yt-dlp now so use that if you aren't already. Check each step along the way to make sure each part is working correctly. Test the webserver by opening http://localhost/VRCYoutubedl.php?url=https://www.youtube.com/watch?v=dQw4w9WgXcQ and make sure it is only returning a url to a video. Test the stub exe to make sure it's doing the same yt-dlp.exe --get-url https://www.youtube.com/watch?v=dQw4w9WgXcQ. If both are working corretly check your VRChat log located here %AppData%/../LocalLow/VRChat/VRChat/output_log_*.txt for a more detailed error.

alkaris2 commented 2 years ago

When I do try to open up the test server with the URL it just shows me the php script. When I just run yt-dlp it returns the URL, but still in VRChat it fails to load anything, it just gets Sync Timeout.

Here's the log output I've received from VRChat. output_log_07-33-22.txt

$ wine ./yt-dlp.exe --get-url https://www.youtube.com/watch?v=NOwCyNR4yfc

003c:fixme:service:scmdatabase_autostart_services Auto-start service L"edgeupdate" failed to start: 2
0024:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
0024:fixme:ntdll:EtwEventSetInformation (deadbeef, 2, 100042E1, 28) stub
0024:fixme:ntdll:EtwEventSetInformation (deadbeef, 2, 013EEC3A, 28) stub
0024:fixme:heap:GetNumaHighestNodeNumber semi-stub: 0021FC58
0024:fixme:seh:WerRegisterRuntimeExceptionModule (L"C:\\windows\\Microsoft.NET\\Framework\\v4.0.30319\\mscordacwks.dll", 013D0000) stub
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 4 00455464 0021D0DC 0021D748 00000000
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 3 00455450 0021D2CC 0021D938 00000000
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 3 00455450 0021D2CC 0021D938 00000000
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 2 0045B4E4 0021D58C 0021DBF8 00000000
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 2 0045B4E4 0021D77C 0021DDE8 00000000
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 2 0045B4E4 0021D77C 0021DDE8 00000000
0024:fixme:nls:get_dummy_preferred_ui_language (0x8 0021EB88 00000000 0021EB84) returning a dummy value (current locale)
0024:fixme:nls:get_dummy_preferred_ui_language (0x8 0021EB88 004550A0 0021EB84) returning a dummy value (current locale)
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 4 0046119C 0021D45C 0021DAC8 00000000
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 3 00459878 0021D64C 0021DCB8 00000000
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 3 00459878 0021D64C 0021DCB8 00000000
0024:fixme:ras:RasEnumConnectionsW (0046A168,0021F29C,0021F2A0),stub!
0024:fixme:ras:RasEnumConnectionsW RAS support is not implemented! Configure program to use LAN connection/winsock instead!
0024:fixme:ras:RasConnectionNotificationW (FFFFFFFF,000001B4,0x00000003),stub!
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 2 00461178 0021CE1C 0021D488 00000000
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 2 00461178 0021D00C 0021D678 00000000
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 2 00461178 0021D00C 0021D678 00000000
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 2 0046117C 0021CF04 0021D570 00000000
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 2 0046117C 0021CFFC 0021D668 00000000
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 2 0046117C 0021CFFC 0021D668 00000000
0024:fixme:nls:LCMapStringEx unsupported lparam 45fd38
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 2 0046B030 0021C67C 0021CCE8 00000000
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 2 0046B030 0021C86C 0021CED8 00000000
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 2 0046B030 0021C86C 0021CED8 00000000
0024:fixme:ntdll:EtwEventSetInformation (deadbeef, 2, 0223ADFC, 53) stub
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 2 00464C48 0021D6E4 0021DD50 00000000
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 2 00464C58 0021D11C 0021D788 00000000
0024:fixme:combase:RoGetParameterizedTypeInstanceIID stub: 2 00464C58 0021D11C 0021D788 00000000
0024:fixme:nls:GetFileMUIPath stub: 0x10, L"C:\\windows\\system32\\tzres.dll", (null), 0021EFE8, 0046D160, 0021EFEC, 0021EFE0
0024:fixme:nls:GetFileMUIPath stub: 0x10, L"C:\\windows\\system32\\tzres.dll", (null), 0021EFE8, 0046D160, 0021EFEC, 0021EFE0
0024:fixme:nls:GetFileMUIPath stub: 0x10, L"C:\\windows\\system32\\tzres.dll", (null), 0021EFE8, 0046D160, 0021EFEC, 0021EFE0
<?php
if (!isset($_GET['url'])) {
    header("HTTP/1.0 404 Not Found");
    echo("404");
    die();
}
$url = $_GET['url'];
$file = "";
$newURL = "";
preg_match("#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=v\/)[^&\n]+(?=\?)|(?<=v=)[^&\n]+|(?<=youtu.be/)[^&\n]+#", $url, $matches);
if (substr($url, 0, 23) == "http://storage.llss.io/") {
    $file = substr($url, 23, strlen($url));
} else if (substr($url, 0, 33) == "http://jd.pypy.moe/api/v1/videos/") {
    $file = substr($url, 33, strlen($url));
} else if ($matches) {
    $file = "$matches[0].mp4";
}
if ($file) {
    $dirs = array_filter(glob("*"), 'is_dir');
    foreach ($dirs as $dir) {
        if (file_exists("$dir/$file")) {
            $newURL = "https://qwertyuiop.nz/pypy/$dir/$file";
        }
    }
}
if ($newURL) {
    echo $newURL;
} else {
    $shell_output = shell_exec("yt-dlp -f 'b[ext=mp4]' --no-playlist --no-warnings --get-url " . escapeshellarg($url) . " 2>&1");
    if (substr($shell_output, 0, 9) == "WARNING: ") {
        echo $url;
    } if (substr($shell_output, 0, 7) == "ERROR: ") {
        echo $url;
    } else {
        print_r($shell_output);
    }
}
?>

0024:fixme:virtual:NtFlushProcessWriteBuffers stub
Natsumi-sama commented 2 years ago

It looks like your websever doesn't have PHP installed/configured, it should be returning the output of yt-dlp not the contents of the PHP script.