lakshmaji / Thumbnail

Thumbnail for a given video using FFMpeg
http://lakshmaji.github.io/Thumbnail
MIT License
110 stars 25 forks source link

# Lost after installation #3

Closed jaybxyz closed 7 years ago

jaybxyz commented 7 years ago

I am trying to make a thumbnail from live streaming video, and i ended up here to try using it. I followed the instruction of installation up to composer require lakshmajim/thumbnail.

Should I create a php file in my server and copy all the codes you provide in Thumbnail.php file that is in src folder?

Could you guide me a little bit for me?

lakshmaji commented 7 years ago

Hi @jaybkim1 ,

This package was well tested for local storage media files and unfortunately we haven't tested it for live streaming videos.

Anyway here are the instructions to follow to use this package with Laravel Framework based applications

Lakshmajim\Thumbnail\ThumbnailServiceProvider::class, to Service Providers array 'Thumbnail' => Lakshmajim\Thumbnail\Facade\Thumbnail::class, to Facade array

Next open up the controller class where you want to do the operations like converting video into thumbnails etc stuff what you wanted to do. (simply copy the contents of ThumbnailTest class code from here)

If you still want help , reach out here

jaybxyz commented 7 years ago

Thanks for your quick response.

Below is current set up in my server since I did not provide any details in the previous post.

Q A
Linux Ubuntu 16.04
PHP version 7.0
Nginx Version 1.10.3
FFmpeg Version FFmpeg 2.8.11

I follwed the instructions of installing FFMpeg, and checked the location of ffmpeg (/usr/bin/ffmpeg), and I installed the package using composer.

It seems like I was missing the critical point. I did not set up the Laravel Framework Application... I will get back to this later. So, If I set up the Laravel Framework Application, there should be app.php file, right?

May I ask you the unrelated question? Do you think the below API will solve my need (capturing a thumbnail from a live streaming video)? https://github.com/PHP-FFMpeg/PHP-FFMpeg

Thank you again for guiding me through this step by step,

chrisbbreuer commented 7 years ago

Yes, it would. You can use FFMpeg's CLI as well. A lot easier for just capturing a screenshot IMO

lakshmaji commented 7 years ago

Hi @jaybkim1 ,

Yeah you can use this package. And this package was a compatibility bridge between laravel framework and the PHP-FFMpeg package. (The Thumbnail package was built on the top of PHP-FFMpeg only :) )

OR you can use the FFMpeg's CLI as suggested by @Chinese1904 too. (Here you can define your own methods too.)

jaybxyz commented 7 years ago

Thank you very much for both of your response.

As @Chinese1904 mentioned, I already tested using FFMpeg command line (FFMpeg's CLI) in my ubuntu server by using the below command line and it works fine, but the thing is i need to use that command line in php, so that my android app can use it to communicate with nginx streaming media server.

/usr/bin/ffmpeg -i /etc/nginx/html/Share/test.mp4 -ss 00:00:01 -vframes 1 -vf scale=350:300 /etc/nginx/html/thumbnails/test.png;

For the package, I believe I followed the instructions accordingly, but it is not working what it is supposed to be.

I really think I am missing something really important on how to use these API........

UPDATED: I now know what I was lack of. It was understanding of how to use composer. I should execute the given composer.json file to create vendor folder to be able to use it.

chrisbbreuer commented 7 years ago

why aren't you able to do something like this?

$ffmpeg_path = "/usr/bin/ffmpeg";
$video_path = "/etc/nginx/html/Share/test.mp4"
$parameters = "-ss 00:00:01 -vframes 1 -vf scale=350:300 ";
$output = "/etc/nginx/html/thumbnails/test.png";
$cmd = "$ffmpeg_path -i $video_path $parameters $output";
shell_exec($cmd);
lakshmaji commented 7 years ago

Hi @jaybkim1 , Are you able to use the PHP FFMpeg package ? @Chinese1904 has given actual implementation code too. Just comment here, so that I can close the issue