2
0
Fork 0
forked from flashii/eeprom
eeprom-nabucco/src/FFMPEG.php

22 lines
573 B
PHP

<?php
namespace EEPROM;
use Index\IO\Stream;
use Index\IO\ProcessStream;
final class FFMPEG {
public static function grabVideoFrame(string $path): Stream {
return new ProcessStream(
sprintf('ffmpeg -i %s -ss 00:00:01.000 -vframes 1 -c:v png -f image2pipe -', escapeshellarg($path)),
'rb'
);
}
public static function grabAudioCover(string $path): Stream {
return new ProcessStream(
sprintf('ffmpeg -i %s -an -vcodec copy -f image2pipe -', escapeshellarg($path)),
'rb'
);
}
}