1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 04:08:59 +01:00

Use best quality

This commit is contained in:
Daniil Gentili 2024-02-13 21:57:14 +01:00
parent be02cbb1e9
commit 563a9b2ef7

View File

@ -138,15 +138,16 @@ class MyEventHandler extends SimpleEventHandler
$process->join(); $process->join();
if (isset($info['title'])) { if (isset($info['title'])) {
$name ??= $info['title'].".mp4"; $name ??= $info['title'].".mp4";
$url = Process::start([ $url = escapeshellarg($url);
'yt-dlp', $process = Process::start([
$url, 'bash',
'-o', '-c',
'-', "yt-dlp $url -f bestvideo*+bestaudio/best -o - | ffmpeg -i - -f mp4 -acodec copy -vcodec copy -movflags isml+frag_keyframe pipe:1",
]); ]);
async(pipe(...), $url->getStderr(), getStderr())->ignore(); async(pipe(...), $process->getStderr(), getStderr())->ignore();
$finally = $url->join(...);
$url = $url->getStdout(); $finally = $process->join(...);
$url = $process->getStdout();
} else { } else {
$name ??= $url; $name ??= $url;
if (Uri::new($url)->getScheme() === null) { if (Uri::new($url)->getScheme() === null) {