Completed
Push — master ( e68911...94616b )
by Sébastien
05:58
created

FFMpegAdapter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 76
ccs 0
cts 63
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
B getParamsOptions() 0 63 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Soluble\MediaTools\Video\Converter\Adapter;
6
7
use Soluble\MediaTools\Config\FFMpegConfig;
8
use Soluble\MediaTools\Video\Converter\ParamsInterface;
9
10
class FFMpegAdapter implements AdapterInterface
11
{
12
    /** @var FFMpegConfig */
13
    protected $ffmpegConfig;
14
15
    public function __construct(FFMpegConfig $ffmpegConfig)
16
    {
17
        $this->ffmpegConfig = $ffmpegConfig;
18
    }
19
20
    /**
21
     * @return array<string, array<string, string>>
22
     */
23
    public static function getParamsOptions(): array
24
    {
25
        return [
26
            ParamsInterface::PARAM_OUTPUT_FORMAT => [
27
                'cli_pattern' => '-f %s',
28
            ],
29
30
            ParamsInterface::PARAM_VIDEO_CODEC => [
31
                'cli_pattern' => '-vcodec %s',
32
            ],
33
            ParamsInterface::PARAM_VIDEO_BITRATE => [
34
                'cli_pattern' => '-b:v %s',
35
            ],
36
            ParamsInterface::PARAM_VIDEO_MIN_BITRATE => [
37
                'cli_pattern' => '-minrate %s',
38
            ],
39
            ParamsInterface::PARAM_VIDEO_MAX_BITRATE => [
40
                'cli_pattern' => '-maxrate %s',
41
            ],
42
43
            ParamsInterface::PARAM_AUDIO_CODEC => [
44
                'cli_pattern' => '-acodec %s',
45
            ],
46
            ParamsInterface::PARAM_AUDIO_BITRATE => [
47
                'cli_pattern' => '-b:a %s',
48
            ],
49
            ParamsInterface::PARAM_PIX_FMT => [
50
                'cli_pattern' => '-pix_fmt %s',
51
            ],
52
            ParamsInterface::PARAM_PRESET => [
53
                'cli_pattern' => '-preset %s',
54
            ],
55
            ParamsInterface::PARAM_SPEED => [
56
                'cli_pattern' => '-speed %s',
57
            ],
58
            ParamsInterface::PARAM_THREADS => [
59
                'cli_pattern' => '-threads %s',
60
            ],
61
62
            ParamsInterface::PARAM_KEYFRAME_SPACING => [
63
                'cli_pattern' => '-g %s',
64
            ],
65
            ParamsInterface::PARAM_QUALITY => [
66
                'cli_pattern' => '-quality %s',
67
            ],
68
            ParamsInterface::PARAM_CRF => [
69
                'cli_pattern' => '-crf %s',
70
            ],
71
            ParamsInterface::PARAM_STREAMABLE => [
72
                'cli_pattern' => '-movflags +faststart',
73
            ],
74
75
            ParamsInterface::PARAM_FRAME_PARALLEL => [
76
                'cli_pattern' => '-frame-parallel %s',
77
            ],
78
            ParamsInterface::PARAM_TILE_COLUMNS => [
79
                'cli_pattern' => '-tile-columns %s',
80
            ],
81
            ParamsInterface::PARAM_TUNE => [
82
                'cli_pattern' => '-tune %s',
83
            ],
84
            ParamsInterface::PARAM_VIDEO_FILTER => [
85
                'cli_pattern' => '-vf %s',
86
            ],
87
        ];
88
    }
89
}
90