Azure media Service Stitching Landscape and portrait videos - azure

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>

Related

OnSwipe is not detected by MotionLayout being a ViewPager the anchorId

My parent view is a Motion Layout. In it I have a ViewPager which has 2 pages. Each page has a vertical recycler view.
My desired effect is for a textView, which is a child of this motion layout, to change its color on page swipe (and to do it smoothly).
PROBLEM: Nothing happens on swipe. Just a regular ViewPager swipe
Here is my transition:
<Transition
app:constraintSetEnd="#id/end"
app:constraintSetStart="#id/start">
<OnSwipe
app:dragDirection="dragLeft"
app:touchAnchorSide="right"
app:touchAnchorId="#id/news_viewPager"/>
</Transition>
I've set a listener on the Motion Layout motionlayout.addTransitionListener() and I'm debugging in its four methods (such as onTransitionChange()) to see if the animation is set off, but it doesn't even starts.
I've tried adding touchRegionId, disableScroll & disablePostScroll but I'm out of ideas.
Could someone please explain to me why it is not working, and a solution to it (or at least an alternative)? Thank you.
Just in case, here's my full scene xml:
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ConstraintSet android:id="#+id/start">
<Constraint android:id="#id/new_videos_title">
<CustomAttribute
app:attributeName="textColor"
app:customColorValue="#color/navBarOn" />
</Constraint>
<Constraint android:id="#id/news_viewPager" />
<Constraint android:id="#id/new_articles_title">
<CustomAttribute
app:attributeName="textColor"
app:customColorValue="#color/navBarOff" />
</Constraint>
</ConstraintSet>
<ConstraintSet android:id="#+id/end">
<Constraint android:id="#id/news_viewPager" />
<Constraint android:id="#id/new_videos_title">
<CustomAttribute
app:attributeName="textColor"
app:customColorValue="#color/navBarOff" />
</Constraint>
<Constraint android:id="#id/new_articles_title">
<CustomAttribute
app:attributeName="textColor"
app:customColorValue="#color/navBarOn" />
</Constraint>
</ConstraintSet>
<Transition
app:constraintSetEnd="#id/end"
app:constraintSetStart="#id/start">
<OnSwipe
app:dragDirection="dragLeft"
app:touchAnchorSide="right"
app:touchAnchorId="#id/news_viewPager"/>
</Transition>

No stock_available section for newly created product via Prestashop webservices

as the title says, I can successfully create a new Product via Prestashop 1.6.1 webservice. The problem is that the new product XML has an empty stock_available section:
<stock_availables nodeType="stock_available" api="stock_availables" />
so I have no idea how to set the initial quantity for that product. If I set it manually from the back office, the stock_available section is filled.
Maybe there is something I'm missing in the XML request? Here it is:
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<product>
<id/>
<id_manufacturer/>
<id_supplier/>
<id_category_default>52</id_category_default>
<new/>
<cache_default_attribute/>
<id_default_image/>
<id_default_combination/>
<id_tax_rules_group/>
<position_in_category/>
<type/>
<id_shop_default/>
<reference>A130</reference>
<supplier_reference/>
<location/>
<width/>
<height/>
<depth/>
<weight/>
<quantity_discount/>
<ean13/>
<upc/>
<cache_is_pack/>
<cache_has_attachments/>
<is_virtual/>
<on_sale/>
<online_only/>
<ecotax/>
<minimal_quantity/>
<price>1.30</price>
<wholesale_price/>
<unity/>
<unit_price_ratio/>
<additional_shipping_cost/>
<customizable/>
<text_fields/>
<uploadable_files/>
<active>1</active>
<redirect_type/>
<id_product_redirected/>
<available_for_order>1</available_for_order>
<available_date/>
<condition/>
<show_price>1</show_price>
<indexed>1</indexed>
<visibility/>
<advanced_stock_management/>
<date_add/>
<date_upd/>
<pack_stock_type/>
<meta_description>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[product name]]></language>
</meta_description>
<meta_keywords>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[product name]]></language>
</meta_keywords>
<meta_title>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[product name]]></language>
</meta_title>
<link_rewrite>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[product name]]></language>
</link_rewrite>
<name>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[product name]]></language>
</name>
<description>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[product name]]></language>
</description>
<description_short>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[product name]]></language>
</description_short>
<available_now>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[product name]]></language>
</available_now>
<available_later>
<language id="1" xlink:href="http://www.mysite.it/prestashop/api/languages/1"><![CDATA[available later]]></language>
</available_later>
<associations>
<categories>
<category>
<id/>
</category>
<category>
<id>52</id>
</category>
</categories>
<images>
<image>
<id/>
</image>
</images>
<combinations>
<combination>
<id/>
</combination>
</combinations>
<product_option_values>
<product_option_value>
<id/>
</product_option_value>
</product_option_values>
<product_features>
<product_feature>
<id/>
<id_feature_value/>
</product_feature>
</product_features>
<tags>
<tag>
<id/>
</tag>
</tags>
<stock_availables>
<stock_available>
<id/>
<id_product_attribute/>
</stock_available>
</stock_availables>
<accessories>
<product>
<id/>
</product>
</accessories>
<product_bundle>
<product>
<id/>
<quantity/>
</product>
</product_bundle>
</associations>
</product>
</prestashop>
Thank you for any help!
Iuri
The problem was probably a bug with that version of Prestashop. With the latest version (1.6.1.17) it works correctly.

Azure video streaming: Custom encode format using REST API?

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.

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.

XmlDocuments Element ignored in Content Type?

I have a content type defined in Elements.xml and I want to add an Event Receiver. My Elements.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Parent ContentType: Announcement (0x0104) -->
<ContentType ID="0x0104008a424de98660457481eb7d8ddb5161ee"
Name="News Posting"
Group="News"
Description="$Resources:NewsCTypeDescription"
Inherits="TRUE"
Version="1"
Sealed="TRUE"
>
<FieldRefs>
<FieldRef ID="{7EBC5918-CB79-440A-8DF3-480C6951C4EB}" Name="NewsExcerpt"/>
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
<spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events">
<Receiver>
<Name>ItemAdded</Name>
<Type>ItemAdded</Type>
<Class>MyAssembly.NewsItemEventReceiver</Class>
<Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
<SequenceNumber>10000</SequenceNumber>
<Synchronization>Synchronous</Synchronization>
<Data />
<Filter />
</Receiver>
</spe:Receivers>
</XmlDocument>
</XmlDocuments>
</ContentType>
</Elements>
The weird thing is that the Event Receiver never executes. I've checked the Schema with SharePoint Manager 2010, and it seems that the XmlDocuments element is ignored completely?
Here's the content type SchemaXml according to SharePoint Manager:
<?xml version="1.0" encoding="utf-16"?>
<ContentType ID="0x0104008A424DE98660457481EB7D8DDB5161EE" Name="News Posting" Group="News" Description="A News Posting" Sealed="TRUE" Version="1">
<Folder TargetName="_cts/News Posting" />
<Fields>
<Field ID="{c042a256-787d-4a6f-8a8a-cf6ab767f12d}" Name="ContentType" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="ContentType" Group="_Hidden" Type="Computed" DisplayName="Content Type" Sealed="TRUE" Sortable="FALSE" RenderXMLUsingPattern="TRUE" PITarget="MicrosoftWindowsSharePointServices" PIAttribute="ContentTypeID" Customization="">
<FieldRefs>
<FieldRef ID="{03e45e84-1992-4d42-9116-26f756012634}" Name="ContentTypeId" />
</FieldRefs>
<DisplayPattern>
<MapToContentType>
<Column Name="ContentTypeId" />
</MapToContentType>
</DisplayPattern>
</Field>
<Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title" Group="_Hidden" Type="Text" DisplayName="Title" Required="TRUE" FromBaseType="TRUE" Customization="" ShowInNewForm="TRUE" ShowInEditForm="TRUE" />
<Field ID="{7662cd2c-f069-4dba-9e35-082cf976e170}" Name="Body" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Body" Group="_Hidden" Type="Note" RichText="TRUE" RichTextMode="FullHtml" IsolateStyles="TRUE" DisplayName="Body" Sortable="FALSE" NumLines="15" Customization="" />
<Field ID="{6a09e75b-8d17-4698-94a8-371eda1af1ac}" Name="Expires" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Expires" Group="_Hidden" Type="DateTime" DisplayName="Expires" Format="DateOnly" Customization="" />
<Field ID="{7EBC5918-CB79-440A-8DF3-480C6951C4EB}" Group="News" Name="NewsExcerpt" DisplayName="Excerpt of the Article" Description="165 Characters maximum" MaxLength="165" Type="Text" Customization="" />
</Field>
</Fields>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<Display>ListForm</Display>
<Edit>ListForm</Edit>
<New>ListForm</New>
</FormTemplates>
</XmlDocument>
</XmlDocuments>
</ContentType>
I have tried adding a FormTemplates XmlDocument as well, just to see if that works, but even this is ignored (I've changed the ListForm to ListForm2, but the SchemaXml is unchanged.
I've deleted the entire Web Application and Content Database to make sure there was nothing stale/stuck, but the result is still the same.
Is XmlDocuments depreciated in SharePoint 2010? What are the alternatives?
You should add your event receiver as a feature, maybe even as a part of the same feature that installs the content type. We always do it this way and it works perfectly

Resources