问题
OK, this is what I got, I'm using native messaging to fire a c++ program from a chrome extension in Windows.
This c++ program (ehost.exe) creates a ffmpeg process for recording the input audio and saving it to mp3.
I do this with the CreateProcess() function
This works perfect when I open ehost.exe myself (double clicking it)
but when I open it from my chrome extension (chrome.runtime.connectNative()
), the ffmpeg process opens but ffmpeg writes no output file, as if it didn't have permissions...
Anybody knows why?
This is the ehost.exe code for starting ffmpeg.exe
static HANDLE startFFmpeg()
{
char cmd[] = "C:\Users\moizilla\Desktop\native\ffmpeg\bin\ffmpeg.exe -y -f dshow -i audio=\"Microphone (High Definition Aud\" -acodec libmp3lame C:\Users\moizilla\Desktop\native\kasdkddfodkadd.mp3";
PROCESS_INFORMATION pi = {0};
STARTUPINFO si={0};
si.cb = sizeof(STARTUPINFO);
if(CreateProcess(NULL, cmd, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)){
CloseHandle(pi.hThread);
return pi.hProcess;
}
return NULL;
}
来源:https://stackoverflow.com/questions/24108308/ffmpeg-from-chrome-native-messaging-host-app-not-working