在laravel 5.5中创建视频缩略图

时间:2018-06-29 13:14:18

标签: php laravel laravel-5

我正在laravel的一个项目中工作 并且我想在上传视频时创建缩略图

我正在关注这篇文章

  

https://packagist.org/packages/pawlox/video-thumbnail

     

pawlox / video-thumbnail

当我称呼它

 $thumb = VideoThumbnail::createThumbnail(asset('public/stories/videos/21530251287.mp4'), asset("public/images/"), 'thumb.jpg', 2, 600, 600);

返回

Pawlox\VideoThumbnail\VideoThumbnail Object(
[FFMpeg:protected] => 
[videoObject:protected] => 
[videoURL:protected] => http://localhost/sunbay/yms/public/stories/2/videos/21530251287.mp4
[storageURL:protected] => http://localhost/sunbay/yms/public/images
[thumbName:protected] => thumb.jpg
[fullFile:protected] => http://localhost/sunbay/yms/public/images/thumb.jpg
[height:protected] => 600
[width:protected] => 600
[screenShotTime:protected] => 2 )

但不会产生拇指。

请让我知道我在做什么错。以及解决方法。

谢谢。

5 个答案:

答案 0 :(得分:1)

您需要安装 FFMpeg
对于Ubuntu 16.04:

sudo apt-get update
sudo apt-get install ffmpeg
sudo service apache2 restart

答案 1 :(得分:0)

import urllib2, cookielib, json, io import datetime url = "JSON URL - REMOVED" sportsFeed = r"c:\feeds\results.txt" try: scorepro = urllib2.urlopen(url) wjson = scorepro.read() wjdata = json.loads(wjson) today = str(datetime.datetime.today().strftime('%Y-%m-%d')) matches = wjdata['list']['Sport']['2']['Matchday'][today]['Match'] for id, match in matches.items(): player_name = match['Home']['name'] print "player = " + player_name except: print "error" 生成一个URL,您需要一个文件路径,尝试:

asset

答案 2 :(得分:0)

我认为问题在于缩略图没有保存。它实际上是创建但未存储。如果选中<!-- Show and write Quantity --> <div formArrayName="quantity"> <ion-item-sliding *ngFor="let quantityCtrl of itemsCtrl.get('quantity').controls; let qtyIndex = index"> <ion-item> <ion-input type="text" placeholder="Add a quantity ..." [formControlName]="qtyIndex"></ion-input> <!-- QUANTITY remove Button --> <ion-item-options side="start"> <ion-item-option color="danger" expandable (click)="removeItem(itemsCtrl, qtyIndex)"> <ion-icon slot="icon-only" name="remove-circle-outline"></ion-icon> </ion-item-option> </ion-item-options> </ion-item> <br> </ion-item-sliding> ,则将看到此方法。

/var/www/html/theevent/vendor/pawlox/video-thumbnail/src/VideoThumbnail.php

答案 3 :(得分:0)

重新启动xampp服务器。

您正在添加:

       FFMPEG="/usr/bin/ffmpeg"
       FFPROBE="/usr/bin/ffprobe"

转到您的环境,并在.env文件中进行更改后,您需要重新启动服务器。

答案 4 :(得分:0)

我还使用此程序包连续生成缩略图和面部错误,然后使用此程序包并消除了这些错误。

https://packagist.org/packages/lakshmajim/thumbnail

https://github.com/lakshmaji/Thumbnail
相关问题