WindowsAppSDK icon indicating copy to clipboard operation
WindowsAppSDK copied to clipboard

`MediaTranscoder` ignores `MediaEncodingProfile.Video.Bitrate`

Open lostmsu opened this issue 1 year ago • 0 comments

Describe the bug

I record the video from screen capture (4928x2160) using the following profile:

var encodingProfile = MediaEncodingProfile.CreateHevc(VideoEncodingQuality.Uhd2160p);
// encodingProfile.Video = VideoEncodingProperties.CreateHevc();
encodingProfile.Video.Bitrate = 10_000_000;
encodingProfile.Video.FrameRate.Numerator = 20;
encodingProfile.Video.FrameRate.Denominator = 1;
encodingProfile.Video.PixelAspectRatio.Numerator = 1;
encodingProfile.Video.PixelAspectRatio.Denominator = 1;
// Describe audio input
encodingProfile.Audio = MediaEncodingProfile.CreateM4a(AudioEncodingQuality.Low).Audio;
encodingProfile.Audio.SampleRate = 48000;

The resulting file has video bitrate of ~30Mbps instead of ~10Mbps.

On a different machine this problem does not reproduce

Steps to reproduce the bug

Prereq: AMD 9950X for CPU+GPU, Win 11 24H2

  1. Create MediaTranscoder with any media source and HardwareAccelerationEnabled = true
  2. Create MediaEncodingProfile as described above
  3. Prepare and start transcoding

Expected behavior

Output has the specified bitrate.

Screenshots

No response

NuGet package version

<TargetFramework>net6.0-windows10.0.26100.0</TargetFramework>

Packaging type

Desktop app

Windows version

24H2 26100.1742

IDE

N/A

Additional context

I have two machines, and one experiences the bug, while the other does not.

  • The one with the bug has Windows 11 24H2 26100.1742 + AMD 9950X CPU (only embedded GPU; supposed to use its hardware encoding block; I can see it used in Task Manager)
  • The one without the bug has Windows 11 23H2 22631.4317 + NVidia 3090 (NVenc seems to be used)

lostmsu avatar Oct 15 '24 05:10 lostmsu