Azure video streaming: Custom encode format using REST API? - azure

i'm using below REST call to encode the video uploaded,
POST https://wamsbayclus001rest-hs.cloudapp.net/api/Jobs HTTP/1.1
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json
Accept: application/json;odata=verbose
Accept-Charset: UTF-8
Authorization: Bearer http%3a%2f%2fschemas.xmlsoap.org%2fws%2f2005%2f05%2fidentity%2fclaims%2fnameidentifier=amstestaccount001&urn%3aSubscriptionId=z7f09258-2233-4ca2-b1ae-193798e2c9d8&http%3a%2f%2fschemas.microsoft.com%2faccesscontrolservice%2f2010%2f07%2fclaims%2fidentityprovider=https%3a%2f%2fwamsprodglobal001acs.accesscontrol.windows.net%2f&Audience=urn%3aWindowsAzureMediaServices&ExpiresOn=1421675491&Issuer=https%3a%2f%2fwamsprodglobal001acs.accesscontrol.windows.net%2f&HMACSHA256=9hUudHYnATpi5hN3cvTfgw%2bL4N3tL0fdsRnQnm6ZYIU%3d
x-ms-version: 2.8
Host: wamsbayclus001rest-hs.cloudapp.net
Content-Length: 482
{
"Name":"NewTestJob",
"InputMediaAssets":[
{
"__metadata":{
"uri":"https://wamsbayclus001rest-hs.net/api/Assets('nb%3Acid%3AUUID%3A9bc8ff20-24fb-4fdb-9d7c-b04c7ee573a1')"
}
}
],
"Tasks":[
{
"Configuration":"H264 Adaptive Bitrate MP4 Set 720p",
"MediaProcessorId":"nb:mpid:UUID:1b1da727-93ae-4e46-a8a1-268828765609",
"TaskBody":"<?xml version=\"1.0\" encoding=\"utf-8\"?><taskBody><inputAsset>JobInputAsset(0)</inputAsset>
<outputAsset>JobOutputAsset(0)</outputAsset></taskBody>"
}
]
}
But the built in encode formats of H264 Adaptive Bitrate are - H264 Adaptive Bitrate MP4 Set 720p,H264 Adaptive Bitrate MP4 Set 1080p,H264 Adaptive Bitrate MP4 SD 16*9,H264 Adaptive Bitrate MP4 Set SD 4*3 , these 4 formats encode the uploaded video into various output format, which results in larger encode data and takes more time to complete single encoding task. So i'm trying to encode the uploaded video file to only lower resolution formats, to reduce cost and time. Is there a way to implement it ?

Ok, so this is a little hackish, but hopefully it will give you an idea of what sort of configuration you'll need to provide to your job.
I fired up Azure Media Services Explorer and created an encoding job while running fiddler and using one of the encoding preset xml file provided. This is the body of the POST:
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
<id />
<title />
<updated>2015-08-12T20:46:59Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:Configuration>
<?xml version="1.0" encoding="utf-16"?><!--Created for Azure Media Encoder, July 30 2014 -->
<Presets>
<Preset Version="5.0">
<Job />
<MediaFile DeinterlaceMode="AutoPixelAdaptive" ResizeQuality="Super" AudioGainLevel="1" VideoResizeMode="Stretch">
<Metadata MergeCollection="True">
<Item Name="WM/EncodedBy" Value="Azure Media Encoder 4 - H264 Adaptive Bitrate MP4 Set 720p, 07/30/2014 " />
</Metadata>
<OutputFormat>
<MP4OutputFormat StreamCompatibility="Standard">
<VideoProfile>
<MainH264VideoProfile BFrameCount="3" EntropyMode="Cabac" RDOptimizationMode="Speed" HadamardTransform="False" SubBlockMotionSearchMode="Speed" MultiReferenceMotionSearchMode="Balanced" ReferenceBFrames="False" AdaptiveBFrames="False" SceneChangeDetector="False" FastIntraDecisions="False" FastInterDecisions="False" SubPixelMode="Quarter" SliceCount="0" KeyFrameDistance="00:00:02" InLoopFilter="True" MEPartitionLevel="EightByEight" ReferenceFrames="4" SearchRange="64" AutoFit="True" Force16Pixels="False" FrameRate="0" SeparateFilesPerStream="True" SmoothStreaming="False" NumberOfEncoderThreads="0">
<Streams AutoSize="False" FreezeSort="False">
<StreamInfo Size="1280, 720">
<Bitrate>
<ConstantBitrate Bitrate="3400" IsTwoPass="False" BufferWindow="00:00:05" />
</Bitrate>
</StreamInfo>
<StreamInfo Size="960, 540">
<Bitrate>
<ConstantBitrate Bitrate="2250" IsTwoPass="False" BufferWindow="00:00:05" />
</Bitrate>
</StreamInfo>
<StreamInfo Size="960, 540">
<Bitrate>
<ConstantBitrate Bitrate="1500" IsTwoPass="False" BufferWindow="00:00:05" />
</Bitrate>
</StreamInfo>
<StreamInfo Size="640, 360">
<Bitrate>
<ConstantBitrate Bitrate="1000" IsTwoPass="False" BufferWindow="00:00:05" />
</Bitrate>
</StreamInfo>
<StreamInfo Size="640, 360">
<Bitrate>
<ConstantBitrate Bitrate="650" IsTwoPass="False" BufferWindow="00:00:05" />
</Bitrate>
</StreamInfo>
<StreamInfo Size="320, 180">
<Bitrate>
<ConstantBitrate Bitrate="400" IsTwoPass="False" BufferWindow="00:00:05" />
</Bitrate>
</StreamInfo>
</Streams>
</MainH264VideoProfile>
</VideoProfile>
<AudioProfile>
<AacAudioProfile Codec="AAC" Channels="2" BitsPerSample="16" SamplesPerSecond="44100">
<Bitrate>
<ConstantBitrate Bitrate="96" IsTwoPass="False" BufferWindow="00:00:00" />
</Bitrate>
</AacAudioProfile>
</AudioProfile>
</MP4OutputFormat>
</OutputFormat>
</MediaFile>
</Preset>
<Preset Version="5.0">
<Job />
<MediaFile AudioGainLevel="1">
<Metadata MergeCollection="True">
<Item Name="WM/EncodedBy" Value="Azure Media Encoder 3 - H264 Adaptive Bitrate MP4 Set 720p, 07/30/2014 " />
</Metadata>
<OutputFormat>
<MP4OutputFormat StreamCompatibility="Standard">
<AudioProfile>
<AacAudioProfile Codec="AAC" Channels="2" BitsPerSample="16" SamplesPerSecond="44100">
<Bitrate>
<ConstantBitrate Bitrate="96" IsTwoPass="False" BufferWindow="00:00:00" />
</Bitrate>
</AacAudioProfile>
</AudioProfile>
</MP4OutputFormat>
</OutputFormat>
</MediaFile>
</Preset>
<Preset Version="5.0">
<Job />
<MediaFile AudioGainLevel="1">
<Metadata MergeCollection="True">
<Item Name="WM/EncodedBy" Value="Azure Media Encoder 3 - H264 Adaptive Bitrate MP4 Set 720p, 07/30/2014 " />
</Metadata>
<OutputFormat>
<MP4OutputFormat StreamCompatibility="Standard">
<AudioProfile>
<AacAudioProfile Codec="AAC" Channels="2" BitsPerSample="16" SamplesPerSecond="44100">
<Bitrate>
<ConstantBitrate Bitrate="56" IsTwoPass="False" BufferWindow="00:00:00" />
</Bitrate>
</AacAudioProfile>
</AudioProfile>
</MP4OutputFormat>
</OutputFormat>
</MediaFile>
</Preset>
</Presets>
</d:Configuration>
<d:EncryptionKeyId m:null="true" />
<d:EncryptionScheme m:null="true" />
<d:EncryptionVersion m:null="true" />
<d:EndTime m:null="true" />
<d:ErrorDetails />
<d:HistoricalEvents />
<d:Id></d:Id>
<d:InitializationVector m:null="true" />
<d:MediaProcessorId>nb:mpid:UUID:1b1da727-93ae-4e46-a8a1-268828765609</d:MediaProcessorId>
<d:Name>AME (adv) Encoding of Jenkins_Under_Two_Min.mp4 with Azure Media Encoder v4.7</d:Name>
<d:Options m:type="Edm.Int32">0</d:Options>
<d:PerfMessage m:null="true" />
<d:Priority m:type="Edm.Int32">0</d:Priority>
<d:Progress m:type="Edm.Double">0</d:Progress>
<d:RunningDuration m:type="Edm.Double">0</d:RunningDuration>
<d:StartTime m:null="true" />
<d:State m:type="Edm.Int32">0</d:State>
<d:TaskBody><?xml version="1.0" encoding="utf-16"?>
<taskBody>
<inputAsset>JobInputAsset(0)</inputAsset>
<outputAsset assetCreationOptions="0" assetName="Jenkins_Under_Two_Min.mp4-AME (adv) encoded" storageAccountName="ianphil">JobOutputAsset(0)</outputAsset>
</taskBody></d:TaskBody>
</m:properties>
</content>
</entry>
The "configuration" section contains the XML from the preset you can find here on GitHub. Hope this will lead you to the exact configuration you need to provide in the POST to create your job.

Related

DocuSign API - Creating an envelope with a Document that has an Approve button

I am creating a draft envelope with a TXT document - which needs to display an Approve button to allow the signer to sign without placing a signature/initials on the document itself. Unfortunately I can't get the Approve button to show on the document, where have I gone wrong?
Here is the Request XML:
<ns1:envelopeDefinition xmlns:ns1="http://www.docusign.com/restapi">
<ns1:emailSubject>Test from iPaaS</ns1:emailSubject>
<ns1:documents>
<ns1:document>
<ns1:name>TestDocument</ns1:name>
<ns1:documentId>1</ns1:documentId>
<ns1:documentBase64><Base64BytesHere></ns1:documentBase64>
<ns1:fileExtension>txt</ns1:fileExtension>
</ns1:document>
</ns1:documents>
<ns1:recipients>
<ns1:signers>
<ns1:signer>
<ns1:routingOrder>1</ns1:routingOrder>
<ns1:recipientId>1</ns1:recipientId>
<ns1:name>John Smith</ns1:name>
<ns1:email>nobody#nobody.com</ns1:email>
</ns1:signer>
</ns1:signers>
</ns1:recipients>
<ns1:tabs>
<ns1:approveTabs>
<ns1:approve>
<anchorCaseSensitive />
<anchorHorizontalAlignment />
<anchorIgnoreIfNotPresent />
<anchorMatchWholeWord />
<anchorString />
<anchorUnits />
<anchorXOffset />
<anchorYOffset />
<conditionalParentLabel />
<conditionalParentValue />
<customTabId />
<documentId>1</documentId>
<mergeField />
<pageNumber>1</pageNumber>
<recipientId>1</recipientId>
<tabId />
<tabOrder />
<templateLocked />
<templateRequired />
<xPosition>100</xPosition>
<yPosition>100</yPosition>
<bold />
<font />
<fontColor />
<fontSize />
<italic />
<tabLabel />
<underline />
<buttonText />
<height>30</height>
<width>50</width>
</ns1:approve>
</ns1:approveTabs>
</ns1:tabs>
</ns1:envelopeDefinition>
Essentially I am looking for something that looks like the attached screenshot
The <tabs> node should be inside the <signer> node. The following example should work.
<ns1:envelopeDefinition xmlns:ns1="http://www.docusign.com/restapi">
<ns1:emailSubject>Test from iPaaS</ns1:emailSubject>
<ns1:documents>
<ns1:document>
<ns1:name>TestDocument</ns1:name>
<ns1:documentId>1</ns1:documentId>
<ns1:fileExtension>txt</ns1:fileExtension>
<ns1:documentBase64>RG9jIFRXTyBUV08gVFdP</ns1:documentBase64>
<ns1:fileExtension>txt</ns1:fileExtension>
</ns1:document>
</ns1:documents>
<ns1:recipients>
<ns1:signers>
<ns1:signer>
<ns1:routingOrder>1</ns1:routingOrder>
<ns1:recipientId>1</ns1:recipientId>
<ns1:name>John Smith</ns1:name>
<ns1:email>johnsmith#acme.com</ns1:email>
<ns1:tabs>
<ns1:approveTabs>
<ns1:approve>
<documentId>1</documentId>
<pageNumber>1</pageNumber>
<xPosition>100</xPosition>
<yPosition>100</yPosition>
<height>30</height>
<width>50</width>
</ns1:approve>
</ns1:approveTabs>
</ns1:tabs>
</ns1:signer>
</ns1:signers>
</ns1:recipients>
</ns1:envelopeDefinition>

Check security header in Mule http:listener

I have a need to check some security HTTP header (called for example X-MyApp-Security) value before processing it after Mule http:listener. Header should be checked like basic auth header but more simply.
I found some Mule documentation about this but don't understand how to use it my simple flow:
<http:listener-config name="HTTP_Listener_Configuration" host="${httpServer.host}" port="${httpServer.port}" doc:name="HTTP Listener Configuration" />
<flow name="planadoWebhookFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP" allowedMethods="POST"/>
<set-payload value="Hello from security area!" doc:name="Set Payload"/>
</flow>
Please help me with header authentication in Mule 3.7.
You can use the "http:basic-security-filter" element, here you have an example:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:jms="http://www.mulesoft.org/schema/mule/jms"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:ftp="http://www.mulesoft.org/schema/mule/ftp"
xmlns:db="http://www.mulesoft.org/schema/mule/db"
xmlns:mule-xml="http://www.mulesoft.org/schema/mule/xml"
xmlns:jersey="http://www.mulesoft.org/schema/mule/jersey"
xmlns:json="http://www.mulesoft.org/schema/mule/json"
xmlns:ws="http://www.mulesoft.org/schema/mule/ws"
xmlns:smtps="http://www.mulesoft.org/schema/mule/smtps"
xmlns:email="http://www.mulesoft.org/schema/mule/email"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
xmlns:ss="http://www.springframework.org/schema/security"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/ftp http://www.mulesoft.org/schema/mule/ftp/current/mule-ftp.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/jersey http://www.mulesoft.org/schema/mule/jersey/current/mule-jersey.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/ws http://www.mulesoft.org/schema/mule/ws/current/mule-ws.xsd
http://www.mulesoft.org/schema/mule/smtps http://www.mulesoft.org/schema/mule/smtps/current/mule-smtps.xsd
http://www.mulesoft.org/schema/mule/email http://www.mulesoft.org/schema/mule/email/current/mule-email.xsd
http://www.mulesoft.org/schema/mule/spring-security http://www.mulesoft.org/schema/mule/spring-security/3.1/mule-spring-security.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
">
<spring:beans>
<ss:authentication-manager alias="authenticationManager">
<ss:authentication-provider>
<ss:user-service id="userService">
<ss:user name="user" password="password" authorities="ROLE_ADMIN" />
<ss:user name="anon" password="anon" authorities="ROLE_ANON" />
</ss:user-service>
</ss:authentication-provider>
</ss:authentication-manager>
</spring:beans>
<mule-ss:security-manager>
<mule-ss:delegate-security-provider name="memory-provider" delegate-ref="authenticationManager" />
</mule-ss:security-manager>
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="9091" doc:name="HTTP Listener Configuration"/>
<flow name="testingFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/*" doc:name="HTTP"/>
<logger message="Before Authentication" level="INFO" doc:name="Log Failure"/>
<http:basic-security-filter realm="mule-realm"/>
<logger message="After Authentication" level="INFO" doc:name="Log Failure"/>
</flow>
</mule>
You can find more information in the next link:
https://docs.mulesoft.com/mule-user-guide/v/3.7/http-listener-connector#authentication

Azure Media Services Video Rotation

I am trying to get my videos to play properly using Azure Media Services. Videos that are taken in Portrait mode do not play properly, they are not rotated. here is my codes (taken from the Azure Media Services Sample)
Dim filenamewithpath As String = Server.MapPath("." & "\video2.mp4")
Dim filename As String = Path.GetFileName(filenamewithpath)
Dim preset As String = "H264 Adaptive Bitrate MP4 Set 720p"
FileVideo.SaveAs(filenamewithpath)
' Create and cache the Media Services credentials in a static class variable.
Dim assetName = "UploadSingleFile_" + DateTime.UtcNow.ToString()
Dim asset As IAsset = _context.Assets.Create(assetName, AssetCreationOptions.None)
Dim assetFile = asset.AssetFiles.Create(filename)
Dim accessPolicy As IAccessPolicy = _context.AccessPolicies.Create(assetName, TimeSpan.FromDays(30), _
AccessPermissions.Write Or AccessPermissions.List)
Dim locator As ILocator = _context.Locators.CreateLocator(LocatorType.Sas, asset, accessPolicy)
assetFile.Upload(filenamewithpath)
' Declare a new job.
Dim job As IJob = _context.Jobs.Create(preset + " encoding job")
Dim mediaProcessors = _context.MediaProcessors.Where(Function(p) p.Name.Contains("Media Encoder")).ToList()
Dim latestMediaProcessor = mediaProcessors.OrderBy(Function(mp) New Version(mp.Version)).LastOrDefault()
' Create a task with the encoding details, using a string preset.
Dim task As ITask = job.Tasks.AddNew(preset + " encoding task", latestMediaProcessor, preset, Microsoft.WindowsAzure.MediaServices.Client.TaskOptions.ProtectedConfiguration)
' Specify the input asset to be encoded.
task.InputAssets.Add(asset)
' Add an output asset to contain the results of the job.
task.OutputAssets.AddNew("Output asset", AssetCreationOptions.None)
job.Submit()
' Check job execution and wait for job to finish.
Dim progressJobTask As Task = job.GetExecutionProgressTask(CancellationToken.None)
progressJobTask.Wait()
' If job state is Error the event handling
' method for job progress should log errors. Here we check
' for error state and exit if needed.
If job.State = JobState.[Error] Then
Throw New Exception(vbLf & "Exiting method due to job error.")
End If
Dim MP4Asset As IAsset = job.OutputMediaAssets(0)
' BuildSasUrlForMP4File creates a SAS Locator
' and builds the SAS Url that can be used to
' progressively download the MP4 file.
Dim fullSASURL As String = BuildSasUrlForMP4File(MP4Asset)
Dim streamingURL As String _
= GetStreamingOriginLocatorURL(MP4Asset)
fullSASURL = "http://aka.ms/azuremediaplayeriframe?url=" & fullSASURL _
& "&autoplay=false"
In this link:
http://azure.microsoft.com/blog/2014/08/21/advanced-encoding-features-in-azure-media-encoder/
It shows that Azure Media Services can rotate automatically with:
<Presets Rotation="Auto">
<Preset
Version="5.0">
But I can't figure out how to incorporate this in my code.
Thanks
OK, here is at least one solution that I have been able to dig up:
1) Obtain the XML for the preset you are trying to use. In my case, I was using the present for "H264 Adaptive Bitrate MP4 Set 720p". In my code above, this was in the string "preset".
2) Instead of using this string, use the entire XML file for the preset.
3) Change the xml Presets tag to Presets Rotation="Auto"
Here is link to get the presets (there may be others)
https://github.com/AzureMediaServicesSamples/Encoding-Presets/tree/master/VoD/Azure%20Media%20Encoder
Create a new XML file with (I put mine in the root directory of my website -named config1.xml). Here is the XML for my preset:
<Presets Rotation="Auto">
<Preset
Version="5.0">
<Job />
<MediaFile
DeinterlaceMode="AutoPixelAdaptive"
ResizeQuality="Super"
AudioGainLevel="1"
VideoResizeMode="Stretch">
<Metadata
MergeCollection="True">
<Item
Name="WM/EncodedBy"
Value="Azure Media Encoder 4 - H264 Adaptive Bitrate MP4 Set 720p, 07/30/2014 " />
</Metadata>
<OutputFormat>
<MP4OutputFormat
StreamCompatibility="Standard">
<VideoProfile>
<MainH264VideoProfile
BFrameCount="3"
EntropyMode="Cabac"
RDOptimizationMode="Speed"
HadamardTransform="False"
SubBlockMotionSearchMode="Speed"
MultiReferenceMotionSearchMode="Balanced"
ReferenceBFrames="False"
AdaptiveBFrames="False"
SceneChangeDetector="False"
FastIntraDecisions="False"
FastInterDecisions="False"
SubPixelMode="Quarter"
SliceCount="0"
KeyFrameDistance="00:00:02"
InLoopFilter="True"
MEPartitionLevel="EightByEight"
ReferenceFrames="4"
SearchRange="64"
AutoFit="True"
Force16Pixels="False"
FrameRate="0"
SeparateFilesPerStream="True"
SmoothStreaming="False"
NumberOfEncoderThreads="0">
<Streams
AutoSize="False"
FreezeSort="False">
<StreamInfo
Size="1280, 720">
<Bitrate>
<ConstantBitrate
Bitrate="3400"
IsTwoPass="False"
BufferWindow="00:00:05" />
</Bitrate>
</StreamInfo>
<StreamInfo
Size="960, 540">
<Bitrate>
<ConstantBitrate
Bitrate="2250"
IsTwoPass="False"
BufferWindow="00:00:05" />
</Bitrate>
</StreamInfo>
<StreamInfo
Size="960, 540">
<Bitrate>
<ConstantBitrate
Bitrate="1500"
IsTwoPass="False"
BufferWindow="00:00:05" />
</Bitrate>
</StreamInfo>
<StreamInfo
Size="640, 360">
<Bitrate>
<ConstantBitrate
Bitrate="1000"
IsTwoPass="False"
BufferWindow="00:00:05" />
</Bitrate>
</StreamInfo>
<StreamInfo
Size="640, 360">
<Bitrate>
<ConstantBitrate
Bitrate="650"
IsTwoPass="False"
BufferWindow="00:00:05" />
</Bitrate>
</StreamInfo>
<StreamInfo
Size="320, 180">
<Bitrate>
<ConstantBitrate
Bitrate="400"
IsTwoPass="False"
BufferWindow="00:00:05" />
</Bitrate>
</StreamInfo>
</Streams>
</MainH264VideoProfile>
</VideoProfile>
<AudioProfile>
<AacAudioProfile
Codec="AAC"
Channels="2"
BitsPerSample="16"
SamplesPerSecond="44100">
<Bitrate>
<ConstantBitrate
Bitrate="96"
IsTwoPass="False"
BufferWindow="00:00:00" />
</Bitrate>
</AacAudioProfile>
</AudioProfile>
</MP4OutputFormat>
</OutputFormat>
</MediaFile>
</Preset>
<Preset
Version="5.0">
<Job />
<MediaFile
AudioGainLevel="1">
<Metadata
MergeCollection="True">
<Item
Name="WM/EncodedBy"
Value="Azure Media Encoder 3 - H264 Adaptive Bitrate MP4 Set 720p, 07/30/2014 " />
</Metadata>
<OutputFormat>
<MP4OutputFormat
StreamCompatibility="Standard">
<AudioProfile>
<AacAudioProfile
Codec="AAC"
Channels="2"
BitsPerSample="16"
SamplesPerSecond="44100">
<Bitrate>
<ConstantBitrate
Bitrate="96"
IsTwoPass="False"
BufferWindow="00:00:00" />
</Bitrate>
</AacAudioProfile>
</AudioProfile>
</MP4OutputFormat>
</OutputFormat>
</MediaFile>
</Preset>
<Preset
Version="5.0">
<Job />
<MediaFile
AudioGainLevel="1">
<Metadata
MergeCollection="True">
<Item
Name="WM/EncodedBy"
Value="Azure Media Encoder 3 - H264 Adaptive Bitrate MP4 Set 720p, 07/30/2014 " />
</Metadata>
<OutputFormat>
<MP4OutputFormat
StreamCompatibility="Standard">
<AudioProfile>
<AacAudioProfile
Codec="AAC"
Channels="2"
BitsPerSample="16"
SamplesPerSecond="44100">
<Bitrate>
<ConstantBitrate
Bitrate="56"
IsTwoPass="False"
BufferWindow="00:00:00" />
</Bitrate>
</AacAudioProfile>
</AudioProfile>
</MP4OutputFormat>
</OutputFormat>
</MediaFile>
</Preset>
</Presets>
Here are the changes in my code from above:
Dim configuration1 As String = File.ReadAllText(Server.MapPath("config1.xml"))
Dim task As ITask = job.Tasks.AddNew(preset + " encoding task", _
latestMediaProcessor, configuration1, _
TaskOptions.None)
Note that you can remove the preset field as it is no longer needed.

Azure media Service Stitching Landscape and portrait videos

Im trying to stitch together 2 videos, the lead video being landscape and the second being portrait.
However Azure flips the portrait video sideways automatic. is there a way to stop this behaviour? and have the portrait part have black bars to make up the aspect ratio.
The second video is user generated so i have no control as to what size or orientation it will be.
Update 1:
Pre processing the Portrait video through the media service and then stitching the resulting file seems to work. but that makes it a 2 step operation. is there a faster way or is that the solution?
Update 2:
Yes the ones that are flipped are from smartphones
XML
<?xml version="1.0" encoding="utf-16"?>
<Preset
Version="4.0">
<Job />
<MediaFile
DeinterlaceMode="AutoPixelAdaptive"
ResizeQuality="Super"
NormalizeAudio="True"
AudioGainLevel="1"
VideoResizeMode="Stretch">
<Sources>
<Source>
</Source>
<Source
MediaFile="%1%">
</Source>
</Sources>
<OutputFormat>
<MP4OutputFormat
StreamCompatibility="Standard">
<AudioProfile Condition="SourceContainsAudio">
<AacAudioProfile
Codec="AAC"
Channels="2"
BitsPerSample="16"
SamplesPerSecond="44100">
<Bitrate>
<ConstantBitrate
Bitrate="128"
IsTwoPass="False"
BufferWindow="00:00:00" />
</Bitrate>
</AacAudioProfile>
</AudioProfile>
<VideoProfile Condition="SourceContainsVideo">
<MainH264VideoProfile
BFrameCount="3"
EntropyMode="Cabac"
RDOptimizationMode="Quality"
HadamardTransform="True"
SubBlockMotionSearchMode="Quality"
MultiReferenceMotionSearchMode="Quality"
ReferenceBFrames="False"
AdaptiveBFrames="True"
SceneChangeDetector="True"
FastIntraDecisions="False"
FastInterDecisions="False"
SubPixelMode="Quarter"
SliceCount="0"
KeyFrameDistance="00:00:05"
InLoopFilter="True"
MEPartitionLevel="EightByEight"
ReferenceFrames="4"
SearchRange="128"
AutoFit="True"
Force16Pixels="False"
FrameRate="0"
SeparateFilesPerStream="True"
SmoothStreaming="False"
NumberOfEncoderThreads="0">
<Streams
AutoSize="False">
<StreamInfo
Size="1280, 720">
<Bitrate>
<ConstantBitrate
Bitrate="4500"
IsTwoPass="False"
BufferWindow="00:00:05" />
</Bitrate>
</StreamInfo>
</Streams>
</MainH264VideoProfile>
</VideoProfile>
</MP4OutputFormat>
</OutputFormat>
</MediaFile>
</Preset>
Can you please try updating your preset as follows:
<?xml version="1.0" encoding="utf-16"?>
<Presets Rotation="Auto">
<Preset
Version="5.0">
...
</Preset>
</Presets>

GridPane: RowConstraints percentHeight not working as expected

Having a GridPane with 2 rows and 2 columns, setting the row constraints to 50 percent height results in unwanted behaviour.
Code:
<BorderPane xmlns:fx="http://javafx.com/fxml" fx:controller="..." stylesheets="#general.css" prefWidth="800" prefHeight="600">
<top>
<VBox>
<!-- ... -->
</VBox>
</top>
<bottom>
<HBox>
<!-- ... -->
</HBox>
</bottom>
<center>
<GridPane >
<children>
<ScrollPane fx:id="tilePane" GridPane.columnIndex="0" GridPane.rowIndex="0">
<content>
</content>
<GridPane.margin>
<Insets bottom="2" left="2" right="2" top="2" />
</GridPane.margin>
</ScrollPane>
<TreeView fx:id="listPane" GridPane.columnIndex="0" GridPane.rowIndex="1">
<root>
<TreeItem value="Stages" />
</root>
<GridPane.margin>
<Insets bottom="2" left="2" right="2" top="2" />
</GridPane.margin>
</TreeView>
<ScrollPane fx:id="mapPane" GridPane.columnIndex="1" GridPane.rowIndex="0" GridPane.rowSpan="2">
<content>
</content>
<GridPane.margin>
<Insets bottom="2" left="2" right="2" top="2" />
</GridPane.margin>
</ScrollPane>
</children>
<columnConstraints>
<ColumnConstraints hgrow="ALWAYS" percentWidth="25"/>
<ColumnConstraints hgrow="ALWAYS" />
</columnConstraints>
<rowConstraints>
<RowConstraints vgrow="ALWAYS" percentHeight="50" />
<RowConstraints vgrow="ALWAYS" percentHeight="50" />
</rowConstraints>
</GridPane>
</center>
</BorderPane>
(mentioned attribute at the bottom)
I expected that the two rows would share their available height at a 50% rate. They do this, but they also consume a lot more space than needed.
Picture of the result with, and without percentHeight specified:
Do I understand percentHeight wrong, or is there another approach?

Resources