SonataMediaBundle SonataMediaProviderVideoBundle Argument 1传递给FFMpeg \ FFProbe :: __ construct()必须是FFProbeDriver实例,给定

时间:2017-01-11 08:45:40

标签: php symfony sonata-media-bundle

我刚刚安装了SonataMediaProviderVideoBundle和所有相关的。

当我尝试通过奏鸣曲媒体后端上传视频时,我有这个错误(Sf 3.1.5):

  

捕获致命错误:传递给FFMpeg \ FFProbe :: __ construct()的参数1必须是给定的数组FFMpeg \ Driver \ FFProbeDriver的实例,在D:\ wamp \ www \ test-sf3 \ TestSonata \ var \中调用缓存\ dev的\ appDevDebugProjectContainer.php

该数组来自providers.yml第41行https://github.com/xmon/SonataMediaProviderVideoBundle/blob/master/Resources/config/providers.yml

这是__construct,它在第47行等待FFMpeg \ Driver \ FFProbeDriver实例:在git hub上 - > PHP-FFmpeg的/ PHP-FFmpeg的/斑点/主/ SRC / FFmpeg的/ FFProbe.php

这是我的堆栈跟踪:

Exception detected!
Catchable Fatal Error: Argument 1 passed to FFMpeg\FFProbe::__construct() must be an instance of FFMpeg\Driver\FFProbeDriver, array given, called in D:\wamp\www\test-sf3\TestSonata\var\cache\dev\appDevDebugProjectContainer.php on line 10246 and defined
500 Internal Server Error - ContextErrorException
Stack Trace

in vendor\php-ffmpeg\php-ffmpeg\src\FFMpeg\FFProbe.php at line 47  -
        /** @var MapperInterface */
        private $mapper;
        public function __construct(FFProbeDriver $ffprobe, Cache $cache)
        {
            $this->ffprobe = $ffprobe;
            $this->optionsTester = new OptionsTester($ffprobe, $cache);
at ErrorHandler ->handleError ('4096', 'Argument 1 passed to FFMpeg\FFProbe::__construct() must be an instance of FFMpeg\Driver\FFProbeDriver, array given, called in D:\wamp\www\test-sf3\TestSonata\var\cache\dev\appDevDebugProjectContainer.php on line 10246 and defined', 'D:\wamp\www\test-sf3\TestSonata\vendor\php-ffmpeg\php-ffmpeg\src\FFMpeg\FFProbe.php', '47', array())
in vendor\php-ffmpeg\php-ffmpeg\src\FFMpeg\FFProbe.php at line 47  +
at FFProbe ->__construct (array('ffmpeg.binaries' => 'D:/wamp/bin/ffmpeg/bin/ffmpeg.exe', 'ffprobe.binaries' => 'D:/wamp/bin/ffmpeg/bin/ffprobe.exe'), object(Logger))
in var\cache\dev\appDevDebugProjectContainer.php at line 10246  +
at appDevDebugProjectContainer ->getXmonFfmpeg_FfprobeService (false)
in var\cache\dev\appDevDebugProjectContainer.php at line 10237  +
at appDevDebugProjectContainer ->{closure} (null, object(FFMpegFFProbe_0000000055a8e24d00000000163507555ab0ef05b0b9e546824f0bb3e27d88c9), 'streams', array('pathfile' => 'D:\wamp\tmp\phpA9E3.tmp'), object(Closure))
in var\cache\dev\appDevDebugProjectContainer.php at line 13430  +
at Closure ->__invoke (null, object(FFMpegFFProbe_0000000055a8e24d00000000163507555ab0ef05b0b9e546824f0bb3e27d88c9), 'streams', array('pathfile' => 'D:\wamp\tmp\phpA9E3.tmp'), object(Closure))
in var\cache\dev\appDevDebugProjectContainer.php at line 13430  +
at FFMpegFFProbe_0000000055a8e24d00000000163507555ab0ef05b0b9e546824f0bb3e27d88c9 ->streams ('D:\wamp\tmp\phpA9E3.tmp')
in vendor\xmon\sonata-media-provider-video-bundle\Xmon\SonataMediaProviderVideoBundle\Provider\VideoProvider.php at line 142  +
at VideoProvider ->doTransform (object(Media))
in var\cache\dev\classes.php at line 17962  +
at BaseProvider ->transform (object(Media))
in vendor\sonata-project\media-bundle\Form\DataTransformer\ProviderDataTransformer.php at line 97  +
at ProviderDataTransformer ->reverseTransform (object(Media))
in vendor\symfony\symfony\src\Symfony\Component\Form\Form.php at line 1057  +
at Form ->normToModel (object(Media))
in vendor\symfony\symfony\src\Symfony\Component\Form\Form.php at line 633  +
at Form ->submit (array('providerName' => 'sonata.media.provider.video', 'thumbnailCapture' => '5', 'category' => '1', '_token' => 'CIunMwS122qjpqflpF4LSQH21TTztAPc0yeSHKtyuwE', 'binaryContent' => object(UploadedFile)), true)
in vendor\symfony\symfony\src\Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler.php at line 113  +
at HttpFoundationRequestHandler ->handleRequest (object(Form), object(Request))
in vendor\symfony\symfony\src\Symfony\Component\Form\Form.php at line 488  +
at Form ->handleRequest (object(Request))
in vendor\sonata-project\admin-bundle\Controller\CRUDController.php at line 504  +
at CRUDController ->createAction ()
in vendor\sonata-project\media-bundle\Controller\MediaAdminController.php at line 39  +
at MediaAdminController ->createAction (object(Request))
at call_user_func_array (array(object(MediaAdminController), 'createAction'), array(object(Request)))
in vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php at line 153  +
at HttpKernel ->handleRaw (object(Request), '1')
in vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php at line 68  +
at HttpKernel ->handle (object(Request), '1', true)
in vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php at line 169  +
at Kernel ->handle (object(Request))
in web\app_dev.php at line 30  +

1 个答案:

答案 0 :(得分:1)

找到解决方案:

1 - 我更改了providers.yml中的服务以删除xmon_ffmpeg.ffmpeg和xmon_ffmpeg.ffprobe服务。我为视频提供商提供的服务是这样的:

json

2 - 我重写了VideoProvider.php的构造函数,如下所示:

services:
    sonata.media.provider.video:
        class: %xmon_video.provider.video.class%
        tags:
            - { name: sonata.media.provider }
        arguments:
            - sonata.media.provider.video
            - '@sonata.media.filesystem.local'
            - '@sonata.media.cdn.server'
            - '@sonata.media.generator.default'
            - '@sonata.media.thumbnail.format'
            - [ mp4 ]
            - [ video/mp4 ]
            - '@sonata.media.resizer.custom'
            - '@sonata.media.metadata.proxy'
            - '@service_container'
            - '@doctrine.orm.entity_manager'
        calls:
            - [ setTemplates, [ { helper_thumbnail: XmonSonataMediaProviderVideoBundle:Provider:thumbnail.html.twig, helper_view: XmonSonataMediaProviderVideoBundle:Provider:video.html.twig } ] ]