[英]How to change Media Foundation Transform output frame(video) size?
I am writing a transform and want to change the output size of the frame and video. 我正在编写一个变换,并且想要更改帧和视频的输出大小。 I inspected the sample and found out the order of function calling:
我检查了样本并找出了函数调用的顺序:
SetInputType
SetOutputType
GetInputCurrentType
SetInputType
UpdateFormatInfo
GetOutputCurrentType
SetOutputType
GetOutputStreamInfo
SetProperties
ProcessOutput (THROW NEED INPUT)
ProcessInput
ProcessOutput
ProcessOutput (THROW
....
.... repeat until done
In which step do I need to modify the output size and how? 我需要在哪一步中修改输出大小以及如何修改?
Example: Input a 640x480 video, output 480x480 video, without stretching. 示例:输入640x480视频,输出480x480视频,不进行拉伸。
There are 2 steps to "changing the output size" in your MFT. 在MFT中,有2个步骤可以“更改输出大小”。
1) You need to modify the SetOutputType and GetOutputAvailableType routines: 1)您需要修改SetOutputType和GetOutputAvailableType例程:
2) You need to modify the processing of the samples in ProcessInput/ProcessOutput to actually DO the resizing. 2)您需要修改ProcessInput / ProcessOutput样品的处理,以实际做调整大小。 Just changing the media types doesn't perform any kind of automatic resizing.
仅更改媒体类型不会执行任何自动调整大小的操作。 How you change dimensions depends on the actual format of the video data (which you did not provide), and the details of how you want to do the resizing.
更改尺寸的方式取决于视频数据的实际格式(您未提供),以及如何调整大小的详细信息。 Did you just want to chop off the extra lines?
您是否只想剪掉多余的线? From the top or the bottom?
从顶部还是底部? Do you need to support chopping width too?
您还需要支持裁切宽度吗?
I have a c++ class that handles all the overhead of creating MFTs, along with a number of sample MFTs that show how to use that class available at http://www.LimeGreenSocks.com/MFT . 我有一个c ++类,该类处理创建MFT的所有开销,以及许多示例MFT,这些示例MFT显示了如何使用该类, 网址为http://www.LimeGreenSocks.com/MFT 。 It's still in beta as of this writing, but it should give you some ideas.
在撰写本文时,它仍处于测试阶段,但应该可以给您一些想法。
Probably the closest sample for what you are trying to do is the Rotate. 您尝试做的最接近的样本可能是“旋转”。 When rotating, an 800x600 video can become a 600x800 video.
旋转时,800x600视频可以变成600x800视频。 The Rotate even allows the rotation to be changed while streaming (see Format Changes under Asynchronous MFTs).
旋转甚至允许在流传输时更改旋转(请参见异步MFT下的格式更改 )。 The c++ rotate mft is a well-commented ~350 lines long.
c ++旋转mft的注释很长,大约为350行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.