【问题标题】:ffmpeg throwing System.AccessViolationExceptionffmpeg 抛出 System.AccessViolationException
【发布时间】:2020-12-02 19:13:35
【问题描述】:

我正在使用 ffmpeg 提取帧并对其进行迭代。代码在几帧上正确迭代,然后随机抛出错误

"System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'

关于如何解决它的任何建议?系统详情及截图如下:

系统详情: 操作系统:Windows 目标框架:.netCore3.1 Nugets:FFMediaToolkit v3.0.0 和 SixLabors.ImageSharp v1.0.0 共享 dll 复制自:https://ffmpeg.zeranoe.com/builds/ 4.2.2 版

【问题讨论】:

  • 你的代码在哪里?
  • 它在一个 c# 控制台应用程序中。
  • 我们需要查看您的代码。目前,您实际上是在说“ffmpeg 存在错误,我该如何解决?”。可能有,但更有可能的是, 使用 ffmpeg 的方式存在错误。因此,我们需要看一个展示该错误的小演示。

标签: c# .net-core ffmpeg


【解决方案1】:

我不熟悉这个库,但从堆栈跟踪看来,您关闭了一个可能已经关闭或尚未初始化的 AVFormatContext。检查您的代码并确保您不这样做。在最坏的情况下,您还可以尝试在函数上方添加以下内容并丢弃异常:-

[HandleProcessCorruptedStateExceptions]
[SecurityCritical]
void avcloseinputFunction() {
try { avformat_close_input ... } catch (Exception e) {}
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多