将MediaTranscoder.PrepareStreamTranscodeAsync()与内存流一起使用?

问题描述 投票:0回答:1

在apirefference中,它表示源不能是InMemoryRandomAccessStream或任何其他可写流。但我需要转码InMemoryRandomAccessStream。我尝试转换流但它没有工作:

InMemoryRandomAccessStream untranscodedVideo = GetStream();
Stream source = untranscodedVideo.AsStreamForRead();
await transcoder.PrepareStreamTranscodeAsync(source.AsRandomAccessStream(),destinatiom,profile);


InMemoryRandomAccessStream untranscodedVideo = GetStream();
IOutputStream source = untranscodedVideo.GetOutputStreamAt(0);
await transcoder.PrepareStreamTranscodeAsync(source,destinatin,profile);
c# uwp stream transcoding
1个回答
0
投票

但我需要转码InMemoryRandomAccessStream。我尝试转换流但它没有工作。

PrepareStreamTranscodeAsync的源参数是IRandomAccessStream。对于此请求,您可以使用CloneStream方法将InMemoryRandomAccessStream转换为IRandomAccessStream

IRandomAccessStream irSteam = stream.CloneStream();
© www.soinside.com 2019 - 2024. All rights reserved.