Skip to content

About headless(ssh remote login) run environment #1

Description

@wnpllrzodiac

There is another solution:
1 EXPORT DISPLAY=.0:0
2 init ogl render to off-screen buffer (MAYBE optional)
3 call ffmpeg transcode command as usually.

test passed on ubuntu18.04 x64

int no_window_init()
{
    glXCreateContextAttribsARBProc glXCreateContextAttribs = NULL;
    glXCreateContextAttribs = 
        (glXCreateContextAttribsARBProc)glXGetProcAddressARB(
            (const GLubyte *)"glXCreateContextAttribsARB");

    const char *displayName = NULL;
    Display *display;
    display = XOpenDisplay(displayName);

    static int visualAttribs[] = {
        GLX_SAMPLE_BUFFERS, 1, GLX_SAMPLES, 4
    };
    int numberOfFramebufferConfigurations = 0;
    GLXFBConfig *fbConfigs;
    fbConfigs = glXChooseFBConfig(
        display, DefaultScreen(display), visualAttribs, &numberOfFramebufferConfigurations);

    int context_attribs[] = {
        GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
        GLX_CONTEXT_MINOR_VERSION_ARB, 0,
        GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB,
        GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
        None};
    GLXContext glContext[NUM];
    glContext[0] = glXCreateContextAttribs(display, fbConfigs[0], 0, 1, context_attribs);

    GLXPbuffer pbuffer;
    int pbufferAttribs[] = {
        GLX_PBUFFER_WIDTH, 32,
        GLX_PBUFFER_HEIGHT, 32,
        None
    };
    pbuffer = glXCreatePbuffer(display, fbConfigs[0], pbufferAttribs);
    XFree(fbConfigs);
    XSync(display, False);
    glXMakeContextCurrent(display, pbuffer, pbuffer, glContext[0]);

    return 0;
}

static av_cold int init(AVFilterContext *ctx)
{
    GlMirrorContext *gs = ctx->priv;
    if (gs->no_window) {
        av_log(NULL, AV_LOG_ERROR, "open gl no window init ON\n");
        no_window_init();
    }
    
    return glfwInit() ? 0 : -1;
}


Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions