使用DirectShow和使用VP8编码过滤器录制屏幕时不平滑



在GraphEdit中,我构建了一个这样的Graph:

screen capture recorder --> avi decompressor --> color space converter -->
MainConcept Color Space Converter --> WebM VP8 Encoder Filter -->
WebM Muxer Filter --> file writer

文件大小是mp4的一半,但视频不够平滑,例如,当移动鼠标时,鼠标光标会跳跃,当播放视频时,视频帧会非常明显地跳跃。我想是因为压缩率太高了,不是吗?如何修复?我找不到关于如何使用过滤器的文档,是吗?

谢谢。

拓扑结构看起来并不健康:一行中有三个颜色空间转换器意味着滤波器图很难将屏幕捕捉媒体类型(像素格式)与VP8编码器所接受的内容相匹配。

问题是,当质量严重下降时,编码器被设置为低比特率模式,或者编码会耗尽CPU并跳过帧,或者两者兼而有之。显然,您对平衡这一点感兴趣,以便设置合理并提供合理的输出。

VPB编码器过滤器是使用IVP8Encoder接口设置的,您可以在源代码包文件IDLvp8encoder.idl:中找到该接口的定义(和内联注释)

[
   object,
   uuid(ED311151-5211-11DF-94AF-0026B977EEAA),
   helpstring("VP8 Encoder Filter Interface")
]
interface IVP8Encoder : IUnknown
{
    //ApplySettings
    //
    //The filter maintains a set of encoder configuration values, held
    //in cache.  Any parameters set (using the methods below) are always
    //applied to the cached value, irrespective of the state of the graph.
    //
    //When the graph is started, the filter initializes the VP8 encoder
    //using the cached configuration values.  This is done automatically,
    //as part of the activities associated with transitioning the filter
    //from the stopped state.
    //
    //If the graph has been started, then any parameters set by the user
    //are still applied to the cache (as before).  However, to apply the
    //configuration values in cache to the VP8 encoder, the user must also
    //call ApplySettings.
    //
    //It is harmless to call ApplySettings while the graph is stopped.
    HRESULT ApplySettings();
    //ResetSettings
    //
    //Sets the configuration values in cache to their defaults, the same
    //as they had when the filter instance was originally created.
    HRESULT ResetSettings();
    //Deadline
    //
    //Time to spend encoding, in microseconds. (0=infinite)
    HRESULT SetDeadline([in] int Deadline);
    HRESULT GetDeadline([out] int* pDeadline);
    //ThreadCount
    //
    //For multi-threaded implementations, use no more than this number of
    //threads. The codec may use fewer threads than allowed. The value
    //0 is equivalent to the value 1.
    HRESULT SetThreadCount([in] int Threads);
    HRESULT GetThreadCount([out] int* pThreads);
    ...

另请参阅:

  • 如何在DirectShow应用程序中设置IVP8Encoder过滤器的比特率

相关内容

  • 没有找到相关文章

最新更新