MediaTranscoder - Compression is not applied when using MP4 encoding profile?

Jared Goodwin 21 Reputation points
2021-11-21T20:29:30.377+00:00

I'm using MediaTranscoder to encode video from uncompressed ARGB frames. Example:

var sourceVideoProperties = VideoEncodingProperties.CreateUncompressed(
    MediaEncodingSubtypes.Argb32,
    evenWidth,
    evenHeight);

var videoDescriptor = new VideoStreamDescriptor(sourceVideoProperties);

var mediaStreamSource = new MediaStreamSource(videoDescriptor);

When using this as the MediaStreamSource for the transcoder, no compression is applied to the output video when using MP4 MediaEncodingProfile. Even if I diff the frames between each sample request to only write frames that have changed since the last, the resulting file is always the same size. In a 10-second recording, it didn't matter if I wrote 400 frames or 10 frames.

But if I use WMV profile, the file size is greatly reduced and fluctuates as you'd expect. More movement on screen results in larger file size.

Is this normal?

Thanks.

Developer technologies Universal Windows Platform (UWP)
Windows development Windows API - Win32
{count} votes

Accepted answer
  1. Anonymous
    2021-12-03T02:53:11.467+00:00

    Hello,

    Welcome to Microsoft Q&A!

    @Jared Goodwin After talking to other engineers, we've found the reason for this behavior. When you are calling MediaEncodingProfile.CreateMp4 and MediaEncodingProfile.CreateWmv, the default compression format that used in these two methods is different. The default compression format for MP4 is H264 and the default compression format for WMV is WVC1. This is why the sizes are different between the MP4 file and the WMV file. If you set the encodingProfile.Video.Subtype = "H264" before creating a WMV file, you will get a WMV file which size is similar to the MP4 file. So this behavior is normal. You could check all the supported subtypes here: VideoEncodingProperties.Subtype Property

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.