gpt4 book ai didi

Azure视频流: Custom encode format using REST API?

转载 作者:行者123 更新时间:2023-12-03 05:08:23 24 4
gpt4 key购买 nike

我正在使用下面的 REST 调用对上传的视频进行编码,

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>"
}
]
}

但是 H264 自适应码率内置的编码格式是 - H264 自适应码率 MP4 Set 720p、H264 自适应码率 MP4 Set 1080p、H264 自适应码率 MP4 SD 16*9、H264 自适应码率 MP4 Set SD 4*3 ,这 4 个格式将上传的视频编码为各种输出格式,这会导致编码数据较大,并且需要更多时间才能完成单个编码任务。因此,我尝试将上传的视频文件编码为较低分辨率的格式,以减少成本和时间。有办法实现吗?

最佳答案

好吧,这有点老套,但希望它能让您了解需要为您的工作提供哪种配置。

我兴奋起来Azure Media Services Explorer并在运行 fiddler 并使用提供的编码预设 xml 文件之一时创建了一个编码作业。这是帖子的正文:

<?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>
&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;!--Created for Azure Media Encoder, July 30 2014 --&gt;&#xD;
&lt;Presets&gt;&#xD;
&lt;Preset Version="5.0"&gt;&#xD;
&lt;Job /&gt;&#xD;
&lt;MediaFile DeinterlaceMode="AutoPixelAdaptive" ResizeQuality="Super" AudioGainLevel="1" VideoResizeMode="Stretch"&gt;&#xD;
&lt;Metadata MergeCollection="True"&gt;&#xD;
&lt;Item Name="WM/EncodedBy" Value="Azure Media Encoder 4 - H264 Adaptive Bitrate MP4 Set 720p, 07/30/2014 " /&gt;&#xD;
&lt;/Metadata&gt;&#xD;
&lt;OutputFormat&gt;&#xD;
&lt;MP4OutputFormat StreamCompatibility="Standard"&gt;&#xD;
&lt;VideoProfile&gt;&#xD;
&lt;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"&gt;&#xD;
&lt;Streams AutoSize="False" FreezeSort="False"&gt;&#xD;
&lt;StreamInfo Size="1280, 720"&gt;&#xD;
&lt;Bitrate&gt;&#xD;
&lt;ConstantBitrate Bitrate="3400" IsTwoPass="False" BufferWindow="00:00:05" /&gt;&#xD;
&lt;/Bitrate&gt;&#xD;
&lt;/StreamInfo&gt;&#xD;
&lt;StreamInfo Size="960, 540"&gt;&#xD;
&lt;Bitrate&gt;&#xD;
&lt;ConstantBitrate Bitrate="2250" IsTwoPass="False" BufferWindow="00:00:05" /&gt;&#xD;
&lt;/Bitrate&gt;&#xD;
&lt;/StreamInfo&gt;&#xD;
&lt;StreamInfo Size="960, 540"&gt;&#xD;
&lt;Bitrate&gt;&#xD;
&lt;ConstantBitrate Bitrate="1500" IsTwoPass="False" BufferWindow="00:00:05" /&gt;&#xD;
&lt;/Bitrate&gt;&#xD;
&lt;/StreamInfo&gt;&#xD;
&lt;StreamInfo Size="640, 360"&gt;&#xD;
&lt;Bitrate&gt;&#xD;
&lt;ConstantBitrate Bitrate="1000" IsTwoPass="False" BufferWindow="00:00:05" /&gt;&#xD;
&lt;/Bitrate&gt;&#xD;
&lt;/StreamInfo&gt;&#xD;
&lt;StreamInfo Size="640, 360"&gt;&#xD;
&lt;Bitrate&gt;&#xD;
&lt;ConstantBitrate Bitrate="650" IsTwoPass="False" BufferWindow="00:00:05" /&gt;&#xD;
&lt;/Bitrate&gt;&#xD;
&lt;/StreamInfo&gt;&#xD;
&lt;StreamInfo Size="320, 180"&gt;&#xD;
&lt;Bitrate&gt;&#xD;
&lt;ConstantBitrate Bitrate="400" IsTwoPass="False" BufferWindow="00:00:05" /&gt;&#xD;
&lt;/Bitrate&gt;&#xD;
&lt;/StreamInfo&gt;&#xD;
&lt;/Streams&gt;&#xD;
&lt;/MainH264VideoProfile&gt;&#xD;
&lt;/VideoProfile&gt;&#xD;
&lt;AudioProfile&gt;&#xD;
&lt;AacAudioProfile Codec="AAC" Channels="2" BitsPerSample="16" SamplesPerSecond="44100"&gt;&#xD;
&lt;Bitrate&gt;&#xD;
&lt;ConstantBitrate Bitrate="96" IsTwoPass="False" BufferWindow="00:00:00" /&gt;&#xD;
&lt;/Bitrate&gt;&#xD;
&lt;/AacAudioProfile&gt;&#xD;
&lt;/AudioProfile&gt;&#xD;
&lt;/MP4OutputFormat&gt;&#xD;
&lt;/OutputFormat&gt;&#xD;
&lt;/MediaFile&gt;&#xD;
&lt;/Preset&gt;&#xD;
&lt;Preset Version="5.0"&gt;&#xD;
&lt;Job /&gt;&#xD;
&lt;MediaFile AudioGainLevel="1"&gt;&#xD;
&lt;Metadata MergeCollection="True"&gt;&#xD;
&lt;Item Name="WM/EncodedBy" Value="Azure Media Encoder 3 - H264 Adaptive Bitrate MP4 Set 720p, 07/30/2014 " /&gt;&#xD;
&lt;/Metadata&gt;&#xD;
&lt;OutputFormat&gt;&#xD;
&lt;MP4OutputFormat StreamCompatibility="Standard"&gt;&#xD;
&lt;AudioProfile&gt;&#xD;
&lt;AacAudioProfile Codec="AAC" Channels="2" BitsPerSample="16" SamplesPerSecond="44100"&gt;&#xD;
&lt;Bitrate&gt;&#xD;
&lt;ConstantBitrate Bitrate="96" IsTwoPass="False" BufferWindow="00:00:00" /&gt;&#xD;
&lt;/Bitrate&gt;&#xD;
&lt;/AacAudioProfile&gt;&#xD;
&lt;/AudioProfile&gt;&#xD;
&lt;/MP4OutputFormat&gt;&#xD;
&lt;/OutputFormat&gt;&#xD;
&lt;/MediaFile&gt;&#xD;
&lt;/Preset&gt;&#xD;
&lt;Preset Version="5.0"&gt;&#xD;
&lt;Job /&gt;&#xD;
&lt;MediaFile AudioGainLevel="1"&gt;&#xD;
&lt;Metadata MergeCollection="True"&gt;&#xD;
&lt;Item Name="WM/EncodedBy" Value="Azure Media Encoder 3 - H264 Adaptive Bitrate MP4 Set 720p, 07/30/2014 " /&gt;&#xD;
&lt;/Metadata&gt;&#xD;
&lt;OutputFormat&gt;&#xD;
&lt;MP4OutputFormat StreamCompatibility="Standard"&gt;&#xD;
&lt;AudioProfile&gt;&#xD;
&lt;AacAudioProfile Codec="AAC" Channels="2" BitsPerSample="16" SamplesPerSecond="44100"&gt;&#xD;
&lt;Bitrate&gt;&#xD;
&lt;ConstantBitrate Bitrate="56" IsTwoPass="False" BufferWindow="00:00:00" /&gt;&#xD;
&lt;/Bitrate&gt;&#xD;
&lt;/AacAudioProfile&gt;&#xD;
&lt;/AudioProfile&gt;&#xD;
&lt;/MP4OutputFormat&gt;&#xD;
&lt;/OutputFormat&gt;&#xD;
&lt;/MediaFile&gt;&#xD;
&lt;/Preset&gt;&#xD;
&lt;/Presets&gt;
</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>&lt;?xml version="1.0" encoding="utf-16"?&gt;&#xD;
&lt;taskBody&gt;&#xD;
&lt;inputAsset&gt;JobInputAsset(0)&lt;/inputAsset&gt;&#xD;
&lt;outputAsset assetCreationOptions="0" assetName="Jenkins_Under_Two_Min.mp4-AME (adv) encoded" storageAccountName="ianphil"&gt;JobOutputAsset(0)&lt;/outputAsset&gt;&#xD;
&lt;/taskBody&gt;</d:TaskBody>
</m:properties>
</content>
</entry>

“配置”部分包含来自预设的 XML,您可以找到 here on GitHub 。希望这将引导您找到创建作业所需在 POST 中提供的确切配置。

关于Azure视频流: Custom encode format using REST API?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31962048/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com