小编kri*_*pto的帖子

MF SinkWriter 写入示例失败

我正在尝试使用 MediaFoundation 将 ID3D11Texture2D 编码为 mp4。下面是我目前的代码。

初始化接收器写入器

private int InitializeSinkWriter(String outputFile, int videoWidth, int videoHeight)
    {
        IMFMediaType mediaTypeIn = null;
        IMFMediaType mediaTypeOut = null;
        IMFAttributes attributes = null;

        int hr = 0;

        if (Succeeded(hr)) hr = (int)MFExtern.MFCreateAttributes(out attributes, 1);
        if (Succeeded(hr)) hr = (int)attributes.SetUINT32(MFAttributesClsid.MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 1);            
        if (Succeeded(hr)) hr = (int)attributes.SetUINT32(MFAttributesClsid.MF_LOW_LATENCY, 1);

        // Create the sink writer 
        if (Succeeded(hr)) hr = (int)MFExtern.MFCreateSinkWriterFromURL(outputFile, null, attributes, out sinkWriter);

        // Create the output type
        if (Succeeded(hr)) hr = (int)MFExtern.MFCreateMediaType(out mediaTypeOut);
        if (Succeeded(hr)) hr = …
Run Code Online (Sandbox Code Playgroud)

c# directx dxgi sharpdx ms-media-foundation

2
推荐指数
1
解决办法
2161
查看次数

标签 统计

c# ×1

directx ×1

dxgi ×1

ms-media-foundation ×1

sharpdx ×1