小编Rum*_*ble的帖子

FFmpeg - 通过管道馈送原始帧 - FFmpeg 不检测管道闭合

我试图在 Windows 中遵循 C++ 中的这些示例。Phyton 示例 C# 示例

我有一个应用程序可以生成应使用 FFmpeg 编码的原始帧。原始帧通过 IPC 管道传输到 FFmpegs STDIN。这按预期工作,FFmpeg 甚至显示当前可用的帧数。

当我们完成发送帧时会出现问题。当我关闭管道的写端时,我希望 FFmpeg 检测到它,完成并输出视频。但这不会发生。FFmpeg 保持打开状态,似乎在等待更多数据。

我在 VisualStudio 中做了一个小测试项目。

#include "stdafx.h" 
//// stdafx.h 
//#include "targetver.h"
//#include <stdio.h>
//#include <tchar.h>
//#include <iostream>

#include "Windows.h"
#include <cstdlib>

using namespace std;

bool WritePipe(void* WritePipe, const UINT8 *const Buffer, const UINT32 Length)
{
    if (WritePipe == nullptr || Buffer == nullptr || Length == 0)
    {
        cout << __FUNCTION__ << ": Some input is useless";
        return false;
    }

    // …
Run Code Online (Sandbox Code Playgroud)

c++ video cmd ffmpeg pipe

3
推荐指数
1
解决办法
2369
查看次数

标签 统计

c++ ×1

cmd ×1

ffmpeg ×1

pipe ×1

video ×1