如何将ffplay作为无窗口进程运行?

S B*_*S B 5 sdl ffmpeg

我正在将ffplay作为后台进程运行,该进程将图像数据提供给主UI进程。我设置了“ SDL_VIDEODRIVER = dummy”,以禁止在SDL窗口中显示ffplay视频。

问题是,即使未显示视频输出窗口,ffplay进程仍会显示为应用程序窗口(坞站,CMD + TAB条目等)。我该如何避免呢?

Enr*_*age 16

该选项-nodisp对我来说效果很好(连同-autoexit)。

在 Ubuntu 18.04、ffmpeg 3.4.6 中测试:

ffplay -f lavfi -i "sine=frequency=1000:duration=5" -autoexit -nodisp
Run Code Online (Sandbox Code Playgroud)

来源:[FFmpeg-user] ffplay 仅用于音频


S B*_*S B 0

Dock 条目是由 SDLMain.m 添加的,需要对其进行编译才能ffplay在 Mac 上运行。在 SDLMain.m 中注释以下行后,ffplay 将作为无窗口进程运行。

//#ifdef SDL_USE_CPS
//    {
//        CPSProcessSerNum PSN;
//        /* Tell the dock about us */
//        if (!CPSGetCurrentProcess(&PSN))
//            if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
//                if (!CPSSetFrontProcess(&PSN))
//                    [NSApplication sharedApplication];
//    }
//#endif /* SDL_USE_CPS */

/* Set up the menubar */
//[NSApp setMainMenu:[[NSMenu alloc] init]];
//setApplicationMenu();
//setupWindowMenu();
Run Code Online (Sandbox Code Playgroud)

编辑这只影响Mac,因为我们不需要其他平台上的SDLMain.m包装器int main()