1

I was trying to generate video thumbnail in Laravel using ffmpeg, but the shared hosting (like Godady) doesn't support ffmpeg due to its consuming a lot of resources! So, is there anyway to do this (like reading the file byte after byte). Thanks.

  • There are 3rd party services you could use such as [AWS Elastic Transcoder](https://aws.amazon.com/elastictranscoder/) which among other things can create thumbnails for a video. – dbrumann Aug 11 '19 at 07:03
  • Thanks for your reply, I'm looking for a solution that I can code it (if that was possible). – Philip Haddad Aug 11 '19 at 07:12
  • and why would you thought you can't code using aws elastic transcoder? – Ghiffari Assamar Aug 11 '19 at 07:21
  • I meant that I need a solution without any 3rd party, there is no enough budget for that (at this moment) :/ – Philip Haddad Aug 11 '19 at 07:28
  • Generating video thumbnail in php without ffmpeg is very difficult. but you can use javascript to generate a thumbnail and store it with php. If you think this is a good idea, I put a snippets code in answer. – mshomali Aug 11 '19 at 07:45
  • My project is RESTFul API (Laravel) and I need the thumbnail for the Android application, is there any way to get the thumbnail from the Android (Java)? And please, put the Javascript snippets maybe I'll need it later :D! Thanks – Philip Haddad Aug 11 '19 at 10:53

1 Answers1

2

If the video can be played back in the browser you could try using the Canvas feature of html5 to playback the video in a canvas and then post a still from that video to your server using javascript... Maybe you could even automate it, or if you only have a few dozen videos do it by hand...

abokor hassan
  • 356
  • 6
  • 17
  • My project is RESTFul API (Laravel) and I need the thumbnail for the Android application, is there any way to get the thumbnail from the Android (Java)? – Philip Haddad Aug 11 '19 at 10:54
  • Yes, https://stackoverflow.com/questions/4317665/how-to-get-thumbnail-for-video-in-my-sdcard-android-data-mypackage-files-folder, but that is for another question – AlexVestin Aug 11 '19 at 11:34