Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
php-ffmpeg
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
php-ffmpeg
Commits
0bdb3cd5
Commit
0bdb3cd5
authored
8 years ago
by
Sascha Grossenbacher
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2777531
by Berdir: Added missing probe service, update and improve README
parent
1a9320b8
Branches
Branches containing commit
Tags
8.x-1.0
8.x-1.0-rc1
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+9
-10
9 additions, 10 deletions
README.md
php_ffmpeg.services.yml
+3
-0
3 additions, 0 deletions
php_ffmpeg.services.yml
src/PHPFFMpegFactory.php
+14
-20
14 additions, 20 deletions
src/PHPFFMpegFactory.php
with
26 additions
and
30 deletions
README.md
+
9
−
10
View file @
0bdb3cd5
...
...
@@ -4,26 +4,25 @@ This project is an API module that integrate with the [PHP FFmpeg library](admin
This module doesn't do anything by itself and is usually extended by other projects that do something useful with
FFmpeg.
[

](https://travis-ci.org/FloeDesignTechnologies/drupal-php-ffmpeg)
[

](https://travis-ci.org/FloeDesignTechnologies/drupal-php-ffmpeg)
## Installation
Follow the standard module installation guide (http://drupal.org/documentation/install/modules-themes/modules-7)
to install PHP FFmpeg. This module depends on the Composer Manager module (http://drupal.org/project/composer_manager),
so follow the instructions on its project page to install the third-party libraries that this module requires.
Follow the standard module installation guide (https://www.drupal.org/docs/8/extending-drupal/installing-contributed-modules)
to install PHP FFmpeg. This module has a composer dependency (php-ffmpeg/php-ffmpeg), see https://www.drupal.org/node/2404989 for more information.
After installation, visit the setting page at
`admin/config/development/php-ffmpeg`
to set the path to
## Usage
The module provides an administrative UI for the various configuration options exposed by PHP FFmpeg library. To
instantiate the PHP FFmpeg classes populated with the configuration options, call
`$ffmpeg = php_ffmpeg
(
);`
or
`$ffprobe = php_ffmpeg_probe`
in your module. Refer to the PHP FFmpeg library's documentation for details on how to use
instantiate the PHP FFmpeg classes populated with the configuration options, call
`$ffmpeg =
Drupal::service('
php_ffmpeg
'
);`
or
`$ffprobe =
Drupal::service('
php_ffmpeg_probe
');
`
in your module. Refer to the PHP FFmpeg library's documentation for details on how to use
the library.
Adapters are provided so the PHP FFmpeg library will use
s
Drupal for
logging and
caching. The
[
Monolog module
](
https://drupal.org/project/monolog
)
is also support
ed as
an alternative logging solution
.
Adapters are provided so the PHP FFmpeg library will use Drupal for caching. The
logger adapter that was part of Drupal 7
was remov
ed
,
as
Drupal 8 natively supports the PSR LoggerInterface
.
The PHP FFMpeg library uses
`ffmpeg`
and
`ffprobe`
CLI executable, all its method accepting file paths expect paths
usable are arguments for these executables. When using the library to process Drupal managed, developer have to ensure
usage of local files paths or URL supported by
`ffmpeg`
and
`ffprobe`
as sources, and local file paths as destinations.
\ No newline at end of file
usable are arguments for these executables. When using the library to process Drupal managed files, developer have to ensure
usage of local files paths or URL supported by
`ffmpeg`
and
`ffprobe`
as sources, and local file paths as destinations.
This diff is collapsed.
Click to expand it.
php_ffmpeg.services.yml
+
3
−
0
View file @
0bdb3cd5
...
...
@@ -2,6 +2,9 @@ services:
php_ffmpeg
:
class
:
\FFMpeg\FFMpeg
factory
:
php_ffmpeg.factory:getFFMpeg
php_ffmpeg_probe
:
class
:
\FFMpeg\FFMpeg
factory
:
php_ffmpeg.factory:getFFMpegProbe
php_ffmpeg.factory
:
class
:
Drupal\php_ffmpeg\PHPFFMpegFactory
arguments
:
[
'
@php_ffmpeg.cache'
,
'
@logger.channel.php_ffmpeg'
,
'
@config.factory'
]
...
...
This diff is collapsed.
Click to expand it.
src/PHPFFMpegFactory.php
+
14
−
20
View file @
0bdb3cd5
...
...
@@ -5,6 +5,8 @@ namespace Drupal\php_ffmpeg;
use
Drupal\Core\Config\ConfigFactoryInterface
;
use
Drupal\Core\Logger\LoggerChannelInterface
;
use
Doctrine\Common\Cache\Cache
;
use
FFMpeg\FFMpeg
;
use
FFMpeg\FFProbe
;
/**
* Factory class that provides a wrapper for the FFMpeg PHP extension.
...
...
@@ -21,7 +23,7 @@ class PHPFFMpegFactory {
/**
* Logger channel that logs execution within FFMpeg extension to watchdog.
*
* @var Drupal\Core\Logger\LoggerChannelInterface
* @var
\
Drupal\Core\Logger\LoggerChannelInterface
* The registered logger for this channel.
*/
protected
$logger
;
...
...
@@ -38,7 +40,7 @@ class PHPFFMpegFactory {
*
* @param \Doctrine\Common\Cache\Cache $cache
* The cache backend.
* @param Drupal\Core\Logger\LoggerChannelInterface $logger
* @param
\
Drupal\Core\Logger\LoggerChannelInterface $logger
* Prefix used for appending to cached item identifiers.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* A configuration factory instance.
...
...
@@ -55,15 +57,11 @@ class PHPFFMpegFactory {
* @return \FFMpeg\FFMpeg
*/
public
function
getFFMpeg
()
{
static
$ffmpeg
=
NULL
;
if
(
!
$ffmpeg
)
{
$ffmpeg
=
\FFMpeg\FFMpeg
::
create
(
$this
->
getFFMpegConfig
(),
$this
->
logger
,
$this
->
getFFMpegProbe
()
);
}
return
$ffmpeg
;
return
FFMpeg
::
create
(
$this
->
getFFMpegConfig
(),
$this
->
logger
,
$this
->
getFFMpegProbe
()
);
}
/**
...
...
@@ -72,15 +70,11 @@ class PHPFFMpegFactory {
* @return \FFMpeg\FFProbe
*/
public
function
getFFMpegProbe
()
{
static
$ffprobe
=
NULL
;
if
(
!
$ffprobe
)
{
$ffprobe
=
\FFMpeg\FFProbe
::
create
(
$this
->
getFFMpegConfig
(),
$this
->
logger
,
$this
->
cache
);
}
return
$ffprobe
;
return
FFProbe
::
create
(
$this
->
getFFMpegConfig
(),
$this
->
logger
,
$this
->
cache
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment