nystudio107 /
craft-transcoder
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * Transcoder plugin for Craft CMS |
||
| 5 | * |
||
| 6 | * Transcode videos to various formats, and provide thumbnails of the video |
||
| 7 | * |
||
| 8 | * @link https://nystudio107.com |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 9 | * @copyright Copyright (c) 2017 nystudio107 |
||
|
0 ignored issues
–
show
|
|||
| 10 | */ |
||
|
0 ignored issues
–
show
|
|||
| 11 | |||
| 12 | /** |
||
| 13 | * Transcoder config.php |
||
| 14 | * |
||
| 15 | * This file exists only as a template for the Transcoder settings. |
||
| 16 | * It does nothing on its own. |
||
| 17 | * |
||
| 18 | * Don't edit this file, instead copy it to 'craft/config' as 'transcoder.php' |
||
| 19 | * and make your changes there to override default settings. |
||
| 20 | * |
||
| 21 | * Once copied to 'craft/config', this file will be multi-environment aware as |
||
| 22 | * well, so you can have different settings groups for each environment, just as |
||
| 23 | * you do for 'general.php' |
||
| 24 | */ |
||
| 25 | |||
| 26 | return [ |
||
| 27 | |||
| 28 | // The path to the ffmpeg binary |
||
| 29 | 'ffmpegPath' => '/usr/bin/ffmpeg', |
||
| 30 | |||
| 31 | // The path to the ffprobe binary |
||
| 32 | 'ffprobePath' => '/usr/bin/ffprobe', |
||
| 33 | |||
| 34 | // The options to use for ffprobe |
||
| 35 | 'ffprobeOptions' => '-v quiet -print_format json -show_format -show_streams', |
||
| 36 | |||
| 37 | // The path where the transcoded videos are stored; must have a trailing / |
||
| 38 | // Yii2 aliases are supported here |
||
| 39 | 'transcoderPaths' => [ |
||
| 40 | 'default' => '@webroot/transcoder/', |
||
| 41 | 'video' => '@webroot/transcoder/video/', |
||
| 42 | 'audio' => '@webroot/transcoder/audio/', |
||
| 43 | 'thumbnail' => '@webroot/transcoder/thumbnail/', |
||
| 44 | 'gif' => '@webroot/transcoder/gif/', |
||
| 45 | ], |
||
| 46 | |||
| 47 | // The URL where the transcoded videos are stored; must have a trailing / |
||
| 48 | // Yii2 aliases are supported here |
||
| 49 | 'transcoderUrls' => [ |
||
| 50 | 'default' => '@web/transcoder/', |
||
| 51 | 'video' => '@web/transcoder/video/', |
||
| 52 | 'audio' => '@web/transcoder/audio/', |
||
| 53 | 'thumbnail' => '@web/transcoder/thumbnail/', |
||
| 54 | 'gif' => '@web/transcoder/gif/', |
||
| 55 | ], |
||
| 56 | |||
| 57 | // Determines whether the download file endpoint should be enabled for anonymous frontend access |
||
| 58 | 'enableDownloadFileEndpoint' => false, |
||
| 59 | |||
| 60 | // Use a md5 hash for the filenames instead of parameterized naming |
||
| 61 | 'useHashedNames' => false, |
||
| 62 | |||
| 63 | // if a upload location has a subfolder defined, add this to the transcoder paths too |
||
| 64 | 'createSubfolders' => true, |
||
| 65 | |||
| 66 | // Add the Clear Caches utility to the CP? |
||
| 67 | 'clearCaches' => false, |
||
| 68 | |||
| 69 | // Preset video encoders |
||
| 70 | 'videoEncoders' => [ |
||
| 71 | 'h264' => [ |
||
| 72 | 'fileSuffix' => '.mp4', |
||
| 73 | 'fileFormat' => 'mp4', |
||
| 74 | 'videoCodec' => 'libx264', |
||
| 75 | 'videoCodecOptions' => '-vprofile high -preset slow -crf 22', |
||
| 76 | 'audioCodec' => 'libfdk_aac', |
||
| 77 | 'audioCodecOptions' => '-async 1000', |
||
| 78 | 'threads' => '0', |
||
| 79 | ], |
||
| 80 | 'webm' => [ |
||
| 81 | 'fileSuffix' => '.webm', |
||
| 82 | 'fileFormat' => 'webm', |
||
| 83 | 'videoCodec' => 'libvpx', |
||
| 84 | 'videoCodecOptions' => '-quality good -cpu-used 0', |
||
| 85 | 'audioCodec' => 'libvorbis', |
||
| 86 | 'audioCodecOptions' => '-async 1000', |
||
| 87 | 'threads' => '0', |
||
| 88 | ], |
||
| 89 | 'gif' => [ |
||
| 90 | 'fileSuffix' => '.mp4', |
||
| 91 | 'fileFormat' => 'mp4', |
||
| 92 | 'videoCodec' => 'libx264', |
||
| 93 | 'videoCodecOptions' => '-pix_fmt yuv420p -movflags +faststart -filter:v crop=\'floor(in_w/2)*2:floor(in_h/2)*2\' ', |
||
| 94 | 'threads' => '0', |
||
| 95 | ], |
||
| 96 | ], |
||
| 97 | |||
| 98 | // Preset audio encoders |
||
| 99 | 'audioEncoders' => [ |
||
| 100 | 'mp3' => [ |
||
| 101 | 'fileSuffix' => '.mp3', |
||
| 102 | 'fileFormat' => 'mp3', |
||
| 103 | 'audioCodec' => 'libmp3lame', |
||
| 104 | 'audioCodecOptions' => '', |
||
| 105 | 'threads' => '0', |
||
| 106 | ], |
||
| 107 | 'aac' => [ |
||
| 108 | 'fileSuffix' => '.m4a', |
||
| 109 | 'fileFormat' => 'aac', |
||
| 110 | 'audioCodec' => 'libfdk_aac', |
||
| 111 | 'audioCodecOptions' => '', |
||
| 112 | 'threads' => '0', |
||
| 113 | |||
| 114 | ], |
||
| 115 | 'ogg' => [ |
||
| 116 | 'fileSuffix' => '.ogg', |
||
| 117 | 'fileFormat' => 'ogg', |
||
| 118 | 'audioCodec' => 'libvorbis', |
||
| 119 | 'audioCodecOptions' => '', |
||
| 120 | 'threads' => '0', |
||
| 121 | ], |
||
| 122 | ], |
||
| 123 | |||
| 124 | // Default options for encoded videos |
||
| 125 | 'defaultVideoOptions' => [ |
||
| 126 | // Video settings |
||
| 127 | 'videoEncoder' => 'h264', |
||
| 128 | 'videoBitRate' => '800k', |
||
| 129 | 'videoFrameRate' => 15, |
||
| 130 | // Audio settings |
||
| 131 | 'audioBitRate' => '', |
||
| 132 | 'audioSampleRate' => '', |
||
| 133 | 'audioChannels' => '', |
||
| 134 | // Spatial settings |
||
| 135 | 'width' => '', |
||
| 136 | 'height' => '', |
||
| 137 | 'sharpen' => true, |
||
| 138 | // Can be 'none', 'crop', or 'letterbox' |
||
| 139 | 'aspectRatio' => 'letterbox', |
||
| 140 | 'letterboxColor' => '', |
||
| 141 | ], |
||
| 142 | |||
| 143 | // Default options for video thumbnails |
||
| 144 | 'defaultThumbnailOptions' => [ |
||
| 145 | 'fileSuffix' => '.jpg', |
||
| 146 | 'timeInSecs' => 10, |
||
| 147 | 'width' => '', |
||
| 148 | 'height' => '', |
||
| 149 | 'sharpen' => true, |
||
| 150 | // Can be 'none', 'crop', or 'letterbox' |
||
| 151 | 'aspectRatio' => 'letterbox', |
||
| 152 | 'letterboxColor' => '', |
||
| 153 | ], |
||
| 154 | |||
| 155 | // Default options for encoded audio |
||
| 156 | 'defaultAudioOptions' => [ |
||
| 157 | 'audioEncoder' => 'mp3', |
||
| 158 | 'audioBitRate' => '128k', |
||
| 159 | 'audioSampleRate' => '44100', |
||
| 160 | 'audioChannels' => '2', |
||
| 161 | 'timeInSecs' => '', |
||
| 162 | 'seekInSecs' => '', |
||
| 163 | 'synchronous' => false, |
||
| 164 | 'stripMetadata' => false, |
||
| 165 | ], |
||
| 166 | |||
| 167 | // Default options for Gif encoding |
||
| 168 | 'defaultGifOptions' => [ |
||
| 169 | 'videoEncoder' => 'gif', |
||
| 170 | 'fileSuffix' => '.mp4', |
||
| 171 | 'fileFormat' => 'gif', |
||
| 172 | 'videoCodec' => 'libx264', |
||
| 173 | 'videoCodecOptions' => '-pix_fmt yuv420p -movflags +faststart -filter:v crop=\'floor(in_w/2)*2:floor(in_h/2)*2\' ', |
||
| 174 | ], |
||
| 175 | ]; |
||
| 176 |