Reputation: 802
I am creating a Windows Phone app (XAML/C#) that uploads audio and video to a server. Using VideoCaptureDevice on Windows Phone 8.0 works fine, but it only allows resolutions supported by the device (on a Nokia 625 the smallest is 640 x 480). To get the size down I have upgraded the app to Windows Phone 8.1 Silverlight (Developer Preview) to use the Windows.Media.Capture.MediaCapture libraries. This works and the generic Qvga format:
MediaEncodingProfile profile = MediaEncodingProfile.CreateMp4(Windows.Media.MediaProperties.VideoEncodingQuality.Qvga);
Works on both the Nokia 625 and 520 and gets the resolution down to 320 x 240, but the file size is still ~24MB for 4 minutes of video. If I set a custom resolution like this:
MediaEncodingProfile profile = MediaEncodingProfile.CreateMp4(Windows.Media.MediaProperties.VideoEncodingQuality.Auto);
profile.Video.Width = 480;
profile.Video.Height = 320;
I get a much smaller file size (4 min == ~6MB, which is odd) but it is corrupted on the 625.
I would like to try it out with other file types, eg .wmv, but:
MediaEncodingProfile profile = MediaEncodingProfile.CreateWmv(Windows.Media.MediaProperties.VideoEncodingQuality.Auto);
Gives a System.Exception "No suitable transform was found to encode or decode the content."
I'm also going to need to do this for audio, ie:
MediaEncodingProfile profile = MediaEncodingProfile.CreateMp3(Windows.Media.MediaProperties.AudioEncodingQuality.Auto);
But I get the same error.
I suppose I'm asking lots of questions here, but I'm really asking:
I have also tried setting the audio properties manually to see if that will get the size down:
MediaEncodingProfile profile = MediaEncodingProfile.CreateMp4(Windows.Media.MediaProperties.VideoEncodingQuality.Qvga);
profile.Audio.Subtype = "PCM";
profile.Audio.ChannelCount = 2;
profile.Audio.BitsPerSample = 8;
profile.Audio.SampleRate = 22050;
But this also leads to a corrupted file.
Any help greatly appreciated - have hunted around but found very little on the subject...
Upvotes: 3
Views: 1597
Reputation: 18567
Maybe it is related to this IoT: https://ms-iot.github.io/content/en-US/win10/ReleaseNotesRTM.htm
Release Notes for Windows 10 IoT Core Build Number 10586. December 2015
Known Issues
A MediaEncodingProfile.CreateWma( Windows.Media.MediaProperties. AudioEncodingQuality.Auto) method call may fail on the Raspberry Pi 2 with the error message No suitable transform was found to encode or decode the content. (Exception from HRESULT: 0xC00D5212). (4510128) WORKAROUND: None.
Upvotes: 2