'Image Video Thumbnail creating using PHP-FFmpeg

I am using PHP-FFmpeg for video thumbnail genaration. My code is below

<?php

$video = "a.mp4";
$image = "thumb.jpg";
$frame = $video->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(42));
$frame->save($image);
?>

I am trying above code to generate video thumbnail it is showing

Fatal error: Call to a member function frame() on string in C:\xampp\htdocs\video-uploader\ImageGenerator.php on line 5


Solution 1:[1]

$video is a string, so you cannot access the method frame().

You want:

$ffmpeg = FFMpeg\FFMpeg::create();
$video = $ffmpeg->open("a.mp4");

See the basic usage example.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 slhck