mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 10:19:00 +01:00
Fixup
This commit is contained in:
parent
ec15ca4084
commit
b959240788
@ -40,7 +40,9 @@ use danog\MadelineProto\Settings;
|
||||
use danog\MadelineProto\TL\Types\Bytes;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
use function Amp\async;
|
||||
use function Amp\ByteStream\buffer;
|
||||
use function Amp\ByteStream\getStderr;
|
||||
use function Amp\ByteStream\pipe;
|
||||
|
||||
/**
|
||||
@ -601,14 +603,14 @@ trait FilesAbstraction
|
||||
if ($thumb === null) {
|
||||
$ffmpeg = 'ffmpeg -i pipe: -ss 00:00:01.000 -frames:v 1 -f image2pipe -vcodec mjpeg pipe:1';
|
||||
$process = Process::start($ffmpeg);
|
||||
pipe($file, $process->getStdin());
|
||||
async(fn () => pipe($file, $process->getStdin()))->finally(fn () => $process->getStdin()->close());
|
||||
$thumb = buffer($process->getStdout());
|
||||
$thumb = new ReadableBuffer($thumb);
|
||||
}
|
||||
if ($attributes[0]['duration'] === null || $attributes[0]['w'] === null || $attributes[0]['h'] === null) {
|
||||
$ffmpeg = 'ffmpeg -i pipe: 2>&1';
|
||||
$process = Process::start($ffmpeg);
|
||||
pipe($file, $process->getStdin());
|
||||
async(fn () => pipe($file, $process->getStdin()))->finally(fn () => $process->getStdin()->close());
|
||||
$output = buffer($process->getStdout());
|
||||
if (preg_match('/(\d{3,4})x(\d{3,4})/', $output, $whMatch) and preg_match('/Duration: (\d{2}):(\d{2}):(\d{2})/', $output, $dMatch)) {
|
||||
$width = $whMatch[1];
|
||||
|
Loading…
Reference in New Issue
Block a user