Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding vp9 to MediaTranscoding sample #1416

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Samples/MediaTranscoding/cpp/MediaTranscoding.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.22621.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.18362.0</WindowsTargetPlatformMinVersion>
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
</PropertyGroup>
Expand Down
18 changes: 18 additions & 0 deletions Samples/MediaTranscoding/cpp/Scenario1_Default.xaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ void Scenario1_Default::GetPresetProfile(ComboBox^ comboBox)
{
_Profile = MediaEncodingProfile::CreateWmv(videoEncodingProfile);
}
else if (_OutputType == "VP9")
{
_Profile = MediaEncodingProfile::CreateVp9(videoEncodingProfile);
}
else if (_OutputType == "AV1")
{
_Profile = MediaEncodingProfile::CreateAv1(videoEncodingProfile);
}
else
{
_Profile = MediaEncodingProfile::CreateMp4(videoEncodingProfile);
Expand Down Expand Up @@ -433,6 +441,16 @@ void Scenario1_Default::OnTargetFormatChanged(Object^ sender, SelectionChangedEv
// Disable NTSC and PAL profiles as non-square pixel aspect ratios are not supported by AVI
DisableNonSquarePARProfiles();
break;
case 3:
_OutputFileExtension = ".mp4";
_OutputType = "VP9";
EnableNonSquarePARProfiles();
break;
case 4:
_OutputFileExtension = ".mp4";
_OutputType = "AV1";
EnableNonSquarePARProfiles();
break;
default:
_OutputFileExtension = ".mp4";
_OutputType = "MP4";
Expand Down
2 changes: 1 addition & 1 deletion Samples/MediaTranscoding/cs/MediaTranscoding.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<AssemblyName>MediaTranscodingSample</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformVersion>10.0.22621.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.18362.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
Expand Down
24 changes: 24 additions & 0 deletions Samples/MediaTranscoding/cs/Scenario1_Default.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,16 @@ async void TranscodePreset(Object sender, RoutedEventArgs e)
{
if ((_InputFile != null) && (_OutputFile != null))
{

// TBD - Test with hardware acceleration disabled
_Transcoder.HardwareAccelerationEnabled = false;

var preparedTranscodeResult = await _Transcoder.PrepareFileTranscodeAsync(_InputFile, _OutputFile, _Profile);

// TBD - Test with hardware acceleration disabled
_Transcoder.HardwareAccelerationEnabled = false;


if (EnableMrfCrf444.IsChecked.HasValue && (bool)EnableMrfCrf444.IsChecked)
{
_Transcoder.VideoProcessingAlgorithm = MediaVideoProcessingAlgorithm.MrfCrf444;
Expand Down Expand Up @@ -165,6 +173,12 @@ void GetPresetProfile(ComboBox combobox)
case "WMV":
_Profile = MediaEncodingProfile.CreateWmv(videoEncodingProfile);
break;
case "VP9":
_Profile = MediaEncodingProfile.CreateVp9(videoEncodingProfile);
break;
case "AV1":
_Profile = MediaEncodingProfile.CreateAv1(videoEncodingProfile);
break;
default:
_Profile = MediaEncodingProfile.CreateMp4(videoEncodingProfile);
break;
Expand Down Expand Up @@ -302,6 +316,16 @@ void OnTargetFormatChanged(object sender, SelectionChangedEventArgs e)
// Disable NTSC and PAL profiles as non-square pixel aspect ratios are not supported by AVI
DisableNonSquarePARProfiles();
break;
case 3:
_OutputType = "VP9";
_OutputFileExtension = ".mp4";
EnableNonSquarePARProfiles();
break;
case 4:
_OutputType = "AV1";
_OutputFileExtension = ".mp4";
EnableNonSquarePARProfiles();
break;
default:
_OutputType = "MP4";
_OutputFileExtension = ".mp4";
Expand Down
2 changes: 2 additions & 0 deletions Samples/MediaTranscoding/shared/Scenario1_Default.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
<ComboBoxItem Content="H.264/MP4"/>
<ComboBoxItem Content="VC-1/WMV"/>
<ComboBoxItem Content="Uncompressed/AVI"/>
<ComboBoxItem Content="VP9/MP4"/>
<ComboBoxItem Content="AV1/MP4"/>
</ComboBox>
<TextBlock Grid.Row="5" Grid.Column="0" Text="Transcode Profile: "></TextBlock>
<ComboBox Grid.Row="5" Grid.Column="1" Margin="4,2" x:Name="ProfileSelect" HorizontalAlignment="Left" Width="180" Height="Auto" SelectedIndex="2" >
Expand Down