프로세스에서 ffmpeg 파이프를 자식 프로세스 stdin으로 리디렉션하려면 어떻게해야합니까?ffmpeg 파이프를 자식 프로세스로 리디렉션
ffmpeg -i test.mov pipe:1 | vlc -
내가 시도 :
avio_open("pipe:1"); // ffmpeg open pipe to STD_OUTPUT_HANDLE.
// lots of code
STARTUPINFO si;
PROCESS_INFORMATION pi;
SECURITY_ATTRIBUTES saAttr = {0};
saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
saAttr.bInheritHandle = TRUE;
saAttr.lpSecurityDescriptor = NULL;
CreatePipe(&hReadPipe, &hWritePipe, &saAttr, 0);
SetStdHandle(STD_OUTPUT_HANDLE, hWritePipe);
ZeroMemory(&si, sizeof(si));
ZeroMemory(&pi, sizeof(pi));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESTDHANDLES;
si.hStdInput = hReadPipe;
CreateProcess(NULL, // No module name (use command line)
L"C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc -vv --demux ffmpeg -", // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
TRUE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi) // Pointer to PROCESS_INFORMATION structure
// start ffmpeg write to file.
을하지만 솔직히 내가 뭘하는지 모르는
나는 cmd를 배관과 같은 일을 달성하고 싶다.
일반적으로 콘솔에 인쇄하지 않는 GetStdHandle
이 있습니까?
GetStdHandle을 사용하여 부모의 출력 핸들을 캡쳐 한 후 자식을 분기하는 경우, 거기에있는 것이 작동 할 수 있습니다. 하지만 코드의 입술은 어떻게 작동합니까? –
John Zwinck : 더 많은 코드가 추가되었으므로 알아 두어야 할 사항이 있습니까? – ronag
이제 'si'변수의 유형을 숨 겼습니다 (편집 전에 표시됨). 나는 당신의 문제를 본질적으로 해결할 수 있을지 모르지만, 당신이 당신의 질문을 더 잘 할 수 있고, 다른 사람들이 당신을 도울 수 있다고 생각합니다. –