1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-26 19:45:01 +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();
if (isset($info['title'])) {
$name ??= $info['title'].".mp4";
$url = Process::start([
'yt-dlp',
$url,
'-o',
'-',
$url = escapeshellarg($url);
$process = Process::start([
'bash',
'-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();
$finally = $url->join(...);
$url = $url->getStdout();
async(pipe(...), $process->getStderr(), getStderr())->ignore();
$finally = $process->join(...);
$url = $process->getStdout();
} else {
$name ??= $url;
if (Uri::new($url)->getScheme() === null) {