Running bash script from Qt using QProcess or system() give difference result from terminal
-
wrote on 7 Nov 2022, 09:36 last edited by
Hi..
I am trying the capture the image from usb camera using QProcess to run bash file. My bash script content is
mplayer -quiet -tv device=/dev/video0 -frames 1 -vf-add screenshot tv://
When I run this bash script from the terminal, it works fine (see picture)
However, when I run this bash script from within qt using
QProcess process ;
process.startDetached("/bin/bash", QStringList() << "-c" << "/path_to_file/capture.bash");there is something mixed up with the camera's buffer. The resulted picture looks like an superimposed version from previous position here (the camera is on a pan-tilt base.
Has anyone ever encountered this problem?
-
Hi..
I am trying the capture the image from usb camera using QProcess to run bash file. My bash script content is
mplayer -quiet -tv device=/dev/video0 -frames 1 -vf-add screenshot tv://
When I run this bash script from the terminal, it works fine (see picture)
However, when I run this bash script from within qt using
QProcess process ;
process.startDetached("/bin/bash", QStringList() << "-c" << "/path_to_file/capture.bash");there is something mixed up with the camera's buffer. The resulted picture looks like an superimposed version from previous position here (the camera is on a pan-tilt base.
Has anyone ever encountered this problem?
wrote on 7 Nov 2022, 09:40 last edited by@Wong
There is no effective difference between running a bash script directly from e.g. a terminal versus runningQProcess::startDetached("/bin/bash", QStringList() << "-c" << "/path_to_file/capture.bash")
. So I don't know why you find it is behaving any differently. -
wrote on 7 Nov 2022, 14:59 last edited by
There would be no effective difference here, this looks more like your camera doing something funky with it's framebuffers, I don't think Qt would be doing something so wrong it's messing up framebuffer data that's captured from inside a script you're running
-
Hi,
Since your bash script is basically a one liner, can you check what happens if you call mplayer directly from it ?
1/4