Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. piping netcat to mplayer
Qt 6.11 is out! See what's new in the release blog

piping netcat to mplayer

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Omri
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • O Offline
        O Offline
        Omri
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved