I have a site where users can upload videos to be encoded and viewed in azure media player. Some of the videos uploaded do not have audio tracks which azure media player can't play. How can I encode an empty audio track with these videos? I'm using v3 of the REST api.
My current code for transforms is:
private async Task<string> CreateTransformAsync(string transform)
{
JObject body = new JObject(
new JProperty("properties",
new JObject(
new JProperty("description", "Basic Transform using an Adaptive Streaming encoding preset from the libray of built-in Standard Encoder presets"),
new JProperty("outputs",
new JArray(
new JObject(
new JProperty("onError", "StopProcessingJob"),
new JProperty("relativePriority", "Normal"),
new JProperty("preset",
new JObject(
new JProperty("@odata.type", "#Microsoft.Media.BuiltInStandardEncoderPreset"),
new JProperty("presetName", "H264MultipleBitrate720p")
)
)
)
)
)
)
)
);
var jsonBody = new StringContent(body.ToString(), Encoding.UTF8, "application/json");
HttpResponseMessage responseMsg = await _httpClient.PutAsync($"subscriptions/{_config.Value.SubscriptionId}/resourceGroups/{_config.Value.ResourceGroup}/providers/Microsoft.Media/mediaServices/{_config.Value.MediaAccountName}/transforms/{transform}/?api-version={_config.Value.ApiVersion}", jsonBody);
string responseContent = await responseMsg.Content.ReadAsStringAsync();
var response = JObject.Parse(responseContent);
if (response["error"] == null)
{
return response["name"].ToString();
} else
{
throw new Exception(response["error"].ToString());
}
}
UPDATE:
After scouring the documentation, I've gotten a little further with this: https://docs.microsoft.com/en-us/azure/media-services/latest/custom-preset-rest-howto#define-a-custom-preset
I now define a custom preset, read it in and send that in the body instead. Problem now is I can't find a similiar option for "condition": "InsertSilenceIfNoAudio" like in v2 of the API. I've opened a github issue about it here: https://github.com/MicrosoftDocs/azure-docs/issues/28133