我正在尝试使用VideoTransformEffectDefinition。
var clip = await MediaClip.CreateFromFileAsync(pickedFile);//creating clip from storage file
MediaComposition composition = new MediaComposition();
composition.Clips.Add(clip);
VideoTransformEffectDefinition videoEffect1 = new VideoTransformEffectDefinition();
videoEffect1.PaddingColor = Colors.Blue;//this line is not necessary, does not matter how videoEffect is changed
clip.VideoEffectDefinitions.Add(videoEffect1);//adding videoEffect
this.mediaElement.SetMediaStreamSource(composition.GenerateMediaStreamSource());//setting source to MediaElement
这不会抛出异常,但它告诉我
“错误:视频无法解码”
关于媒体元素。
这很奇怪,因为代码与VideoStabilizationEffectDefinition配合得很好:
var clip = await MediaClip.CreateFromFileAsync(pickedFile);//creating clip from storage file
MediaComposition composition = new MediaComposition();
composition.Clips.Add(clip);
VideoStabilizationEffectDefinition videoEffect = new VideoStabilizationEffectDefinition();
clip.VideoEffectDefinitions.Add(videoEffect);//adding videoEffect
this.mediaElement.SetMediaStreamSource(composition.GenerateMediaStreamSource());//setting source to MediaElement
我究竟做错了什么?