Does the avconv output give you textual progress? If so, you would need to be reading from the subprocess or QProcess as it runs, parsing the progress value and setting that value on your progress meter.
QProcess will emit signals as new output is ready from the command, whereas a subprocess would require that you keep checking it, either with a qtimer until its done, or a for loop where you make sure to be periodically calling QApplication.processEvents() to keep the event loop flowing.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To post to this group, send email to python_inside_maya@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Does the avconv output give you textual progress? If so, you would need to be reading from the subprocess or QProcess as it runs, parsing the progress value and setting that value on your progress meter.
QProcess will emit signals as new output is ready from the command, whereas a subprocess would require that you keep checking it, either with a qtimer until its done, or a for loop where you make sure to be periodically calling QApplication.processEvents() to keep the event loop flowing.
On Mar 7, 2013 5:22 AM, "Ricardo Viana" <cgolh...@gmail.com> wrote:
Hi Fellas!
i'm trying to build my own video converter gui on a Linux. Using Pyqt4.
I'm using avconv command line converter.
I have setup all parameters and it is working fine.
The thing is i would like to have some kind of progress feedback.
Does anyone know how to retrieve the command line feedback so
i can hook it to some kind of expression to drive the QProgressBar?
thank you very much
--
////////////////////////////////////
Ricardo Viana
VFX Generalist
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To post to this group, send email to python_in...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To post to this group, send email to python_in...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
I put together an example of each of those for you here:
https://gist.github.com/justinfx/5174795
The first example shows how to monitor the QProcess for new output
The second shows how to use subprocess in a way that you can loop over the output, but still pump the event loop. If your lines are being emitted quickly you probably don't need to make the call for every loop, but rather you could call on on every 10 lines...or 100 lines.. or whatever is appropriate to give your main gui thread a chance to process the pending events:
i.e.
i = 0
while True:
line = process.stdout.readline()
if not line:
break
# process line
# process event loop every 10 lines
if i % 10 == 0:
QtGui.qApp.processEvents()
i +=1
-- justin
Can you post a full example on pastsbin or gist? It sounds like something is happening before the event loop.
Also for subprocess, you should pass the command as a list so you don't need shell=True
command=["avconv", "-i", self.inputFile, "-b", self.bitRatesList[self.bitRate.currentIndex()], "-s", self.sizeList[self.sizeSel.cur rentIndex()], self.outputFile]
Generally though, I think the QProcess approach is more robust as it plays nicely with the event loop.
With the qtimer then reason I was using it plus a 100 ms timeout was to have the callback placed into the event loop and run after the app had fully started and signals would work. In a real case, the process would probably get started by some action in your running app. Like a button press or a response to some signal.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To post to this group, send email to python_inside_maya@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To post to this group, send email to python_in...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To post to this group, send email to python_in...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Oh cool. Good find.
For the progress bar, you would need to be getting lines from the output that actually indicate a level of progress. You would then parse that value and set the step value on the progress bar.
Progress values don't have to be 0-100. If you were running a process on 1000 frames and you get output for each frame, you can set the progress max to 1000 and just increment the steps.
Just for the record:
Phonon on linux was solved by going into synaptic
and installing:
python-qt4-phonon
Python bindings for Phonon
python-qt4-phonon-dbg
Python bindings for Phonon (debug extensions)
the later probably not necessary but just in case...
cheers all
and a big thank you for the help.
latest version:
https://gist.github.com/RicardoViana/5190548
any suggestions are welcome.