Qt World Summit: Submit your Presentation

No video window when started from another process

  • Hello all,

    I'm not sure if the problem is in my code or in VLC mediaplayer.

    I have been strugling for a few days with the following problem.
    I'm using windows 7 pro 64-bit and VLC mediaplayer 3.02.

    I open a command prompt and enter the following commands:

    "C:\Program Files\VideoLAN\VLC\vlc.exe" -I rc --rc-host localhost:3000 --rc-quiet --video-on-top --width 150 --height 150

    telnet localhost 3000


    add C:\Users<username>\Documents\testfiles\test_video.mp4

    The video will start in a new window without any buttons, exactly as I want.

    I stop the video by entering "quit" in the telnet session window.

    So fa so good.

    The problem is the following. I want to do this from within another program I wrote using the Qt framework.

    Here's a part of the code (some pieces are omitted for clarity):

    video_process = new QProcess(0);
    arguments << "--video-on-top" << "-I" << "rc" << "--rc-host" << "localhost:3000" << "--rc-quiet" << "--width" << "150" << "--height" << "150";
    video_process->start("C:\\Program Files\\VideoLAN\\VLC\\vlc.exe", arguments);
    if(video_process->waitForStarted(5000) == false)
    msgbox.setText(" \n Cannot start VLC mediaplayer. \n"
    " \n Check if VLC is installed in C:\\Program Files\\VideoLAN\\VLC\\ \n" );
    wait here for a couple of seconds to give it time to startup
    vlc_sock = new QTcpSocket;
    vlc_sock->connectToHost(QHostAddress(""), port);
    if(vlc_sock->waitForConnected(5000) == false)
    err = vlc_sock->error();
    do some cleanup here
    wait 100 milliSecs here
    vlc_sock->write("add C:\\Users\\<username>\\Documents\\testfiles\\test_video.mp4\n");

    When I run the program, VLC starts and it connects via the socket to VLC.
    Also, VLC responds to every command, but.... there's no video window!
    Also, when sending the command get_time after loading the video, get_time returns always 0.
    But the command "add C:\Users<username>\Documents\testfiles\test_video.mp4" returns "vlc: add: returned 0 (no error)"

    So, why it doesn't show a video when VLC is started from another process?

    Any ideas?

  • Solved. The problem was, I used slashes instead of backslashes in the path to the video file...
    Sorry for bothering.

  • Lifetime Qt Champion

    @Trino thanks for reporting back.

    so please mark this topic as SOLVED.

  • Lifetime Qt Champion


    To avoid having to switch between forward and backward slashes, you can use QDir::toNativeSeparators when having to pass path to native APIs.

Log in to reply