piping netcat to mplayer



  • hello!
    When I write this line of code in the cmd:
    nc ip 5000 | mplayer -fps 60 -cache 1024 -
    I get a stream video running in mplayer from my raspberry pi server.
    I want to do the same from a Qt app.
    this is what i wrote but doesn't work:

    QProcess *process1;
    QProcess *process2;
    
    process1 = new QProcess(0);
    process2 = new QProcess(0);
    
    process1->setStandardOutputProcess(process2);
    
    QStringList args1;
    QStringList args2;
    
    args1 += "89.139.168.89 5001";
    args2 += "-fps 60 -cache 1024 -";
    
    process1->start("C:\\Program Files (x86)\\MPlayer for Windows\\nc.exe",args1);
    process2->start("C:\\Program Files (x86)\\MPlayer for Windows\\mplayer.exe",args2);
    

    what is wrong here?
    thanks.


  • Lifetime Qt Champion

    Hi,

    Do you mean you have nc ip 5000 | mplayer -fps 60 -cache 1024 - running in a cmd.exe console ?



  • hello,
    yes in the cmd.exe console.
    actually now it works but with a strange bug. when starting the processes nothing happens, and after I close the Qt app(The UI window) the Mplayer jumps to the screen and the stream is visible. How can I make it jump during the time the app is running?
    Another thing is I want it to appear in the app itself(Qwidget or Qmedia player). I did this to run a video from a file in the disk:
    args2 += "-slave";
    args2 += "-wid";
    args2 += QString::number((int)ui->Mwidget->winId());
    args2 += "C:\Program Files (x86)\MPlayer for Windows\MVI_1343.avi";

    process2->start("C:\Program Files (x86)\MPlayer for Windows\mplayer.exe",args2);

    and it ran inside the Qwidget in my app, though combining all arguments together doesn't work(I can't see the video stream in the Qwidget window).
    thanks.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.