diff --git a/README.md b/README.md index 9664137..e81f27f 100644 --- a/README.md +++ b/README.md @@ -71,11 +71,12 @@ impl GraphicsCaptureApiHandler for Capture { println!("Got The Flag: {message}"); let encoder = VideoEncoder::new( - VideoEncoderType::Mp4, + VideoEncoderType::Hevc, VideoEncoderQuality::HD1080p, 1920, 1080, "video.mp4", + Some(30), )?; Ok(Self { diff --git a/examples/basic.rs b/examples/basic.rs index b7764fe..9c06a37 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -32,11 +32,12 @@ impl GraphicsCaptureApiHandler for Capture { println!("Got The Flag: {message}"); let encoder = VideoEncoder::new( - VideoEncoderType::Mp4, + VideoEncoderType::Hevc, VideoEncoderQuality::HD1080p, 1920, 1080, "video.mp4", + Some(30), )?; Ok(Self { diff --git a/src/encoder.rs b/src/encoder.rs index aa968ee..172d352 100644 --- a/src/encoder.rs +++ b/src/encoder.rs @@ -159,6 +159,8 @@ pub enum VideoEncoderType { Hevc, Mp4, Wmv, + Av1, + Vp9, } #[derive(Eq, PartialEq, Clone, Copy, Debug)] @@ -214,6 +216,7 @@ impl VideoEncoder { width: u32, height: u32, path: P, + fps: Option, ) -> Result { let path = path.as_ref(); @@ -230,6 +233,12 @@ impl VideoEncoder { VideoEncoderType::Wmv => { MediaEncodingProfile::CreateWmv(VideoEncodingQuality(encoder_quality as i32))? } + VideoEncoderType::Av1 => { + MediaEncodingProfile::CreateAv1(VideoEncodingQuality(encoder_quality as i32))? + } + VideoEncoderType::Vp9 => { + MediaEncodingProfile::CreateVp9(VideoEncodingQuality(encoder_quality as i32))? + } }; media_encoding_profile .Video()? @@ -237,7 +246,17 @@ impl VideoEncoder { media_encoding_profile .Video()? .SetHeight(height)?; - + if fps.is_some() { + media_encoding_profile + .Video()? + .FrameRate()? + .SetNumerator(fps.unwrap())?; + media_encoding_profile + .Video()? + .FrameRate()? + .SetDenominator(1)?; + } + let video_encoding_properties = VideoEncodingProperties::CreateUncompressed( &MediaEncodingSubtypes::Bgra8()?, width, @@ -403,6 +422,12 @@ impl VideoEncoder { VideoEncoderType::Wmv => { MediaEncodingProfile::CreateWmv(VideoEncodingQuality(encoder_quality as i32))? } + VideoEncoderType::Av1 => { + MediaEncodingProfile::CreateAv1(VideoEncodingQuality(encoder_quality as i32))? + } + VideoEncoderType::Vp9 => { + MediaEncodingProfile::CreateVp9(VideoEncodingQuality(encoder_quality as i32))? + } }; let video_encoding_properties = VideoEncodingProperties::CreateUncompressed( diff --git a/src/lib.rs b/src/lib.rs index 4a76d74..3a904df 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -67,11 +67,12 @@ //! println!("Got The Flag: {message}"); //! //! let encoder = VideoEncoder::new( -//! VideoEncoderType::Mp4, +//! VideoEncoderType::Hevc, //! VideoEncoderQuality::HD1080p, //! 1920, //! 1080, //! "video.mp4", +//! Some(30), //! )?; //! //! Ok(Self {