我试图在 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)