Media transcoding uwp

0

I want to create UWP app that convert video using Windows.Media.Transcoding. Code below. After run the app - it's crashes with (0xc0000005) 'Access violation' code. I've try adding permissions in manifest but doesn't help. What is wrong with this code?

var openPicker = new Windows.Storage.Pickers.FileOpenPicker();

        openPicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.VideosLibrary;
        openPicker.FileTypeFilter.Add(".wmv");

        StorageFile source = await openPicker.PickSingleFileAsync();
        StorageFile destination = await KnownFolders.VideosLibrary.CreateFileAsync("nowy.mp4", CreationCollisionOption.ReplaceExisting);

        if (source != null)
        {
            MediaEncodingProfile profile = MediaEncodingProfile.CreateMp4(VideoEncodingQuality.HD720p);
            MediaTranscoder transcoder = new MediaTranscoder();

            var prepareOp = await transcoder.PrepareFileTranscodeAsync(source, destination, profile);

            if (prepareOp.CanTranscode)
            {
                var transcodeOp = prepareOp.TranscodeAsync();

                transcodeOp.Progress +=
                    new AsyncActionProgressHandler<double>(TranscodeProgress);
                transcodeOp.Completed +=
                    new AsyncActionWithProgressCompletedHandler<double>(TranscodeComplete);
            }
            else
            {
                switch (prepareOp.FailureReason)
                {
                    case TranscodeFailureReason.CodecNotFound:
                        System.Diagnostics.Debug.WriteLine("Codec not found.");
                        break;

                    case TranscodeFailureReason.InvalidProfile:
                        System.Diagnostics.Debug.WriteLine("Invalid profile.");
                        break;

                    default:
                        System.Diagnostics.Debug.WriteLine("Unknown failure.");
                        break;
                }
            }
        }

Edit I've the same problem using Windows Sample from GitHub

video
uwp
transcoding
asked on Stack Overflow Jul 11, 2018 by kdn29 • edited Jul 11, 2018 by kdn29

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0