- Posts: 18
- Joined: Sun Jun 07, 2015 4:07 am
I'm having some trouble with programmatically setting up my encoding profile for my ATEM Television Studio and I was hoping someone might have some advice.
I am working with the ATEM Switcher 6.6.1 SDK (which appears to include the Desktop Video 10.5.0 SDK). The application is written in C# using .NET, WPF, and Windows Media Foundation.
Some Background:
For no particular reason other than it seemed like a reasonable starting point, I have been using the "AppleTV" profile as my IBMDStreamingVideoEncodingMode and then calling CreateMutableVideoEncodingMode() to create a IBMDStreamingMutableVideoEncodingMode. Once I have a mutable encoding mode, I am setting the destination size using SetDestSize() to 1280x720 and begin receiving packets. As packets arrive I feed them into the media foundation H264 decoder. After the H264 decoder has enough information to make sense out of the packets it is decoding, it will trigger a MF_E_TRANSFORM_STREAM_CHANGE to alert me that my output stream needs to be updated to match the incoming data. At this point, my code can enumerate the available output types on the decoder using GetOutputAvailableType() and select the 'best' output type. The interesting thing here is that if I query the available output types, they all report a size of 1280x720, which matches what I expected.
The Problem:
In an effort to improve the quality of my encoded video, I decided to try upping my settings to capture in 1920x1080. To do this, I changed my starting profile to "Native", created a mutable encoding mode, and set the destination size using SetDestSize() to 1920x1080. Oddly however, when I receive the MF_E_TRANSFORM_STREAM_CHANGE notification, all of the available output types still report a size of 1280x720.
I could not find any way to effect this until a lucky accident.
I tried performing an encode using the ATEM Switcher software and the "Native" profile; which worked fine. When I returned to my code, I noticed the available output types all now report 1920x1088. (Not, it's not a typo, they really report 1920x1088). On a lark, I tried using the ATEM software to encode using the "AppleTV" profile and then exercising my code reports 1280x720.
My conclusion:
The best guess I have right now is the SetDestSize() method of the mutable profile doesn't do exactly what I think is does. And changing the profile does not seem to impact the dimensions of the stream I receive. There must be some other way to affect the dimensions of the stream I am receiving because clearly changing the profile in the ATEM software *will* impact the values I receive in Media Foundation during the MF_E_TRANSFORM_STREAM_CHANGE notification (which are derived from the packets I have been feeding into the decoder). But so far, I can't seem to find any method of affecting the stream dimensions programmatically.
On a related note; why would a 1920x1080 profile report 1920x1088? But the 1280x720 profiles report 1280x720 as expected?
Can anyone shed any light on this for me? It makes sense that I should be able to know what dimensions to expect from the ATEM, and that I should be able to set this programmatically.
I am working with the ATEM Switcher 6.6.1 SDK (which appears to include the Desktop Video 10.5.0 SDK). The application is written in C# using .NET, WPF, and Windows Media Foundation.
Some Background:
For no particular reason other than it seemed like a reasonable starting point, I have been using the "AppleTV" profile as my IBMDStreamingVideoEncodingMode and then calling CreateMutableVideoEncodingMode() to create a IBMDStreamingMutableVideoEncodingMode. Once I have a mutable encoding mode, I am setting the destination size using SetDestSize() to 1280x720 and begin receiving packets. As packets arrive I feed them into the media foundation H264 decoder. After the H264 decoder has enough information to make sense out of the packets it is decoding, it will trigger a MF_E_TRANSFORM_STREAM_CHANGE to alert me that my output stream needs to be updated to match the incoming data. At this point, my code can enumerate the available output types on the decoder using GetOutputAvailableType() and select the 'best' output type. The interesting thing here is that if I query the available output types, they all report a size of 1280x720, which matches what I expected.
The Problem:
In an effort to improve the quality of my encoded video, I decided to try upping my settings to capture in 1920x1080. To do this, I changed my starting profile to "Native", created a mutable encoding mode, and set the destination size using SetDestSize() to 1920x1080. Oddly however, when I receive the MF_E_TRANSFORM_STREAM_CHANGE notification, all of the available output types still report a size of 1280x720.
I could not find any way to effect this until a lucky accident.
I tried performing an encode using the ATEM Switcher software and the "Native" profile; which worked fine. When I returned to my code, I noticed the available output types all now report 1920x1088. (Not, it's not a typo, they really report 1920x1088). On a lark, I tried using the ATEM software to encode using the "AppleTV" profile and then exercising my code reports 1280x720.
My conclusion:
The best guess I have right now is the SetDestSize() method of the mutable profile doesn't do exactly what I think is does. And changing the profile does not seem to impact the dimensions of the stream I receive. There must be some other way to affect the dimensions of the stream I am receiving because clearly changing the profile in the ATEM software *will* impact the values I receive in Media Foundation during the MF_E_TRANSFORM_STREAM_CHANGE notification (which are derived from the packets I have been feeding into the decoder). But so far, I can't seem to find any method of affecting the stream dimensions programmatically.
On a related note; why would a 1920x1080 profile report 1920x1088? But the 1280x720 profiles report 1280x720 as expected?
Can anyone shed any light on this for me? It makes sense that I should be able to know what dimensions to expect from the ATEM, and that I should be able to set this programmatically.