-
Notifications
You must be signed in to change notification settings - Fork 1
/
zencoder-common.php
81 lines (76 loc) · 2.63 KB
/
zencoder-common.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
use Xi\Filelib\Plugin\Video\ZencoderPlugin;
use Xi\Filelib\Publisher\Adapter\Filesystem\SymlinkFilesystemPublisherAdapter;
use Xi\Filelib\Publisher\Linker\CreationTimeLinker;
use Xi\Filelib\Publisher\Publisher;
use Aws\S3\S3Client;
$zencoderPlugin = new ZencoderPlugin(
ZENCODER_KEY,
ZENCODER_BUCKET,
new S3Client([
'credentials' => [
'key' => S3_KEY,
'secret' => S3_SECRETKEY,
],
'region' => 'us-east-1',
'version' => '2006-03-01',
]),
array(
'720p_webm' => array(
'extension' => 'webm',
'output' => array(
'label' => '720p_webm',
'format' => 'webm',
'video_codec' => 'vp8',
'audio_codec' => 'vorbis',
'size' => '1280x720',
'aspect_mode' => 'preserve',
'deinterlace' => 'detect',
'max_video_bitrate' => 3600,
'max_frame_rate' => 25,
'keyframe_interval' => 50,
'audio_bitrate' => 224,
'audio_channels' => 2,
'audio_sample_rate' => 44100,
'watermarks' => array(
'url' => 's3://puuppafilelibzencoder/watermark.png',
'height' => 19,
'x' => -10,
'y' => -10
)
)
),
'720p_ogv' => array(
'extension' => 'ogv',
'output' => array(
'label' => '720p_ogv',
'format' => 'ogv',
'video_codec' => 'theora',
'audio_codec' => 'vorbis',
'size' => '1280x720',
'aspect_mode' => 'preserve',
'deinterlace' => 'detect',
'max_video_bitrate' => 3600,
'max_frame_rate' => 25,
'keyframe_interval' => 50,
'audio_bitrate' => 224,
'audio_channels' => 2,
'audio_sample_rate' => 44100,
'watermarks' => array(
'url' => 's3://puuppafilelibzencoder/watermark.png',
'height' => 36,
'x' => -10,
'y' => -10
)
)
),
)
);
$filelib->addPlugin($zencoderPlugin);
$publisher = new Publisher(
new SymlinkFilesystemPublisherAdapter(__DIR__ . '/web/files', '600', '700', 'files'),
new CreationTimeLinker()
);
$publisher->attachTo($filelib);
// $automaticPublisherPlugin = new AutomaticPublisherPlugin($publisher, new SimpleAuthorizationAdapter());
// $filelib->addPlugin($automaticPublisherPlugin);