This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (encodingInstructions.videoEncoder === constants.ENCODER_TYPES.X265) { | |
const ffmpegCommand = ffmpeg() | |
.input(inputAsset) | |
.videoBitrate(encodingInstructions.videoBitrate) | |
.videoCodec(encodingInstructions.videoEncoder) | |
.size(encodingInstructions.videoSize) | |
.audioCodec(encodingInstructions.audioEncoder) | |
.audioBitrate(encodingInstructions.audioBitrate) | |
.audioFrequency(encodingInstructions.audioFrequency) | |
.withOutputOptions('-force_key_frames "expr:gte(t,n_forced*2)"') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.processEncodingTasks = function processEncodingTasks() { | |
encoderEngine.searchTasks((searchErr, encoderInstructions) => { | |
if (!searchErr && encoderInstructions) { | |
log.info(`Got encoder instructions, started encoder for task '${encoderInstructions.name}' id:${encoderInstructions._id}`); | |
encoderEngine.startEncoder(encoderInstructions, (startErr) => { | |
if (!startErr) { | |
encoderEngine.setTaskToFinished(encoderInstructions._id, (finishErr) => { | |
if (finishErr) { | |
log.error(`An error occurred while trying to set the task to finished. ${finishErr.message}`); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scalingEngine.getNumberOfNeededEncoders = (numberOfEncodingTasks, numberOfEncoders) => { | |
if (numberOfEncodingTasks >= 0 && numberOfEncodingTasks <= 10) { | |
if (numberOfEncoders >= 1 && numberOfEncodingTasks < 1) { | |
return 0; | |
} | |
return numberOfEncoders; | |
} | |
if (numberOfEncodingTasks > 10 && numberOfEncodingTasks <= 50) { | |
if (numberOfEncoders < 4) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: encoderscaler | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: encoderscaler | |
strategy: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import k8s from '@kubernetes/client-node'; | |
import log from './log.js'; | |
const kubernetesClient = {}; | |
kubernetesClient.setNumberOfEncoders = async (numberOfEncoders) => { | |
try { | |
const kubeconfig = new k8s.KubeConfig(); | |
if (process.env.NODE_ENV === 'production') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16:9 aspect ratio | Bitrate | Frame rate | |
---|---|---|---|
416 x 234 | 145 | ≤ 30 fps | |
640 x 360 | 365 | ≤ 30 fps | |
768 x 432 | 730 | ≤ 30 fps | |
768 x 432 | 1100 | ≤ 30 fps | |
960 x 540 | 2000 | Same as source | |
1280 x 720 | 3000 | Same as source | |
1280 x 720 | 4500 | Same as source | |
1920 x 1080 | 6000 | Same as source | |
1920 x 1080 | 7800 | Same as source |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<ContentValues> parseMovies(JSONArray videoArray) throws JSONException { | |
List<ContentValues> videosToInsert = new ArrayList<>(); | |
String title = video.optString(TAG_TITLE); | |
String description = video.optString(TAG_DESCRIPTION); | |
String short_description = video.optString(TAG_SHORT_DESCRIPTION); | |
if (description.isEmpty()) { | |
description = short_description; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<ContentValues> parseMedia(JSONArray videoArray) throws JSONException { | |
List<ContentValues> videosToInsert = new ArrayList<>(); | |
for (int j = 0; j < videoArray.length(); j++) { | |
JSONObject video = videoArray.getJSONObject(j); | |
String videoUrl = video.optString(TAG_URL); | |
String titleId = video.optString(TAG_TITLE_ID); | |
if (videoUrl.isEmpty()) { | |
if (!titleId.isEmpty()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Get the ip address from the ip-addresses.json and give these access to all the | |
app services in the given resource group. | |
.DESCRIPTION | |
Get the ip address from the ip-addresses.json and give these access to all the | |
app services in the given resource group. | |
.PARAMETER JsonFilename |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Add-AccessRestrictionToAppService([string] $ResourceGroupName, [string] $Name, [string] $IpFilterRuleName, [string] $IpAddress, [string] $Priority) | |
{ | |
Write-Information "Adding rule $IpFilterRuleName to allow api management service with ip $IpAddress and $Priority access to $Name" | |
Add-AzWebAppAccessRestrictionRule -ResourceGroupName $ResourceGroupName -WebAppName $Name -Name $IpFilterRuleName -Priority $Priority -Action Allow -IpAddress $IpAddress | |
Update-AzWebAppAccessRestrictionConfig -Name $appService.Name -ResourceGroupName $ResourceGroupName -ScmSiteUseMainSiteRestrictionConfig | |
# Also add the access restriction to the staging slots | |
$allSlots = Get-AzWebAppSlot -ResourceGroupName $ResourceGroupName -Name $Name | |
Foreach ($slot in $allSlots) | |
{ |