Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 传递给FFMpeg\FFProbe::\uuu construct()的SonataMediaBundle SONATAMEDIProviderVideobundle参数1必须是FFProbeDriver实例,数组给定_Php_Symfony_Sonata Media Bundle - Fatal编程技术网

Php 传递给FFMpeg\FFProbe::\uuu construct()的SonataMediaBundle SONATAMEDIProviderVideobundle参数1必须是FFProbeDriver实例,数组给定

Php 传递给FFMpeg\FFProbe::\uuu construct()的SonataMediaBundle SONATAMEDIProviderVideobundle参数1必须是FFProbeDriver实例,数组给定,php,symfony,sonata-media-bundle,Php,Symfony,Sonata Media Bundle,我刚刚安装了SonateMadiproviderVideobundle和所有相关软件 当我试图通过sonata media后端上传视频时,出现以下错误(Sf 3.1.5): 可捕获的致命错误:传递给FFMpeg\FFProbe::\uu construct()的参数1必须是FFMpeg\Driver\FFProbeDriver的实例,给定数组,在D:\wamp\www\test-sf3\TestSonata\var\cache\dev\appDevDebugProjectContainer.ph

我刚刚安装了SonateMadiproviderVideobundle和所有相关软件

当我试图通过sonata media后端上传视频时,出现以下错误(Sf 3.1.5):

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

数组取自providers.yml第41行

下面是等待第47行的FFMpeg\Driver\FFProbeDriver实例的uu构造:在git hub->PHP FFMpeg/PHP FFMpeg/blob/master/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-我将providers.yml中的服务更改为删除xmon_ffmpeg.ffmpeg et xmon_ffmpeg.ffprobe服务。我为视频提供商提供的服务如下:

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 } ] ]
 public function __construct($name, Filesystem $filesystem, CDNInterface $cdn, GeneratorInterface $pathGenerator, ThumbnailInterface $thumbnail, array $allowedExtensions = array(), array $allowedMimeTypes = array(), ResizerInterface $resizer, MetadataBuilderInterface $metadata = null, Container $container, EntityManager $entityManager) {
    ...

    $this->container = $container;
    $this->ffmpeg = FFMpeg::create([
        'ffmpeg.binaries' => $this->container->getParameter('xmon_ffmpeg.binary'), 
        'ffprobe.binaries' => $this->container->getParameter('xmon_ffprobe.binary'), 
        'timeout' => $this->container->getParameter('xmon_ffmpeg.binary_timeout'), 
        'ffmpeg.threads' => $this->container->getParameter('xmon_ffmpeg.threads_count')
    ]);
    $this->ffprobe =  FFProbe::create([
        'ffmpeg.binaries' => $this->container->getParameter('xmon_ffmpeg.binary'), 
        'ffprobe.binaries' => $this->container->getParameter('xmon_ffprobe.binary')
    ]);

    ...
}
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 } ] ]
 public function __construct($name, Filesystem $filesystem, CDNInterface $cdn, GeneratorInterface $pathGenerator, ThumbnailInterface $thumbnail, array $allowedExtensions = array(), array $allowedMimeTypes = array(), ResizerInterface $resizer, MetadataBuilderInterface $metadata = null, Container $container, EntityManager $entityManager) {
    ...

    $this->container = $container;
    $this->ffmpeg = FFMpeg::create([
        'ffmpeg.binaries' => $this->container->getParameter('xmon_ffmpeg.binary'), 
        'ffprobe.binaries' => $this->container->getParameter('xmon_ffprobe.binary'), 
        'timeout' => $this->container->getParameter('xmon_ffmpeg.binary_timeout'), 
        'ffmpeg.threads' => $this->container->getParameter('xmon_ffmpeg.threads_count')
    ]);
    $this->ffprobe =  FFProbe::create([
        'ffmpeg.binaries' => $this->container->getParameter('xmon_ffmpeg.binary'), 
        'ffprobe.binaries' => $this->container->getParameter('xmon_ffprobe.binary')
    ]);

    ...
}

不要张贴图片,请将stacktrace粘贴为格式正确的文本(代码)