Fix: the IO namespace doesn't exist anymore :)
This commit is contained in:
parent
26431aeb79
commit
2c265fa702
1 changed files with 16 additions and 13 deletions
|
@ -4,23 +4,26 @@ namespace Uiharu;
|
|||
use stdClass;
|
||||
use Imagick;
|
||||
use RuntimeException;
|
||||
use Index\IO\Stream;
|
||||
use Index\IO\ProcessStream;
|
||||
|
||||
final class FFMPEG {
|
||||
public static function grabFirstVideoFrame(string $url): Stream {
|
||||
return new ProcessStream(
|
||||
sprintf('ffmpeg -i %s -ss 00:00:00.000 -vframes 1 -c:v png -f image2pipe -', escapeshellarg($url)),
|
||||
'rb'
|
||||
);
|
||||
public static function grabFirstVideoFrame(string $url): string {
|
||||
try {
|
||||
$file = popen(sprintf('ffmpeg -i %s -f image2pipe -c:v png -frames:v 1 2>/dev/null -', escapeshellarg($url)), 'rb');
|
||||
return stream_get_contents($file);
|
||||
} finally {
|
||||
if(isset($file) && is_resource($file))
|
||||
pclose($file);
|
||||
}
|
||||
}
|
||||
|
||||
public static function grabFirstAudioCover(string $url): Stream {
|
||||
return self::grabFirstVideoFrame($url);
|
||||
/*return new ProcessStream(
|
||||
sprintf('ffmpeg -i %s -an -c:v png -f image2pipe -', escapeshellarg($url)),
|
||||
'rb'
|
||||
);*/
|
||||
public static function grabFirstAudioCover(string $url): string {
|
||||
try {
|
||||
$file = popen(sprintf('ffmpeg -i %s -an -f image2pipe -c:v copy -frames:v 1 2>/dev/null -', escapeshellarg($url)), 'rb');
|
||||
return stream_get_contents($file);
|
||||
} finally {
|
||||
if(isset($file) && is_resource($file))
|
||||
pclose($file);
|
||||
}
|
||||
}
|
||||
|
||||
public static function probe(string $url): ?object {
|
||||
|
|
Loading…
Reference in a new issue