views:

152

answers:

1

I'm using a simple QProcess-Project on a WindowsXP-Machine:

QString program = "U:\\ffmpeg.exe";
QStringList arguments;
arguments << "-i" << "U:\\clock.avi" << "U:\\tmp_jpeg\\foo-%03d.jpeg";

process.setStandardOutputFile("U:\\log.txt", QIODevice::Append);
process.start(program, arguments);

The Process works just fine, ffmpeg creates all the files i want to. But the log-File keeps completely empty. The same happens when I want to write the standard-output at qDebug()... Why does this happen and how can I fix it?

+4  A: 

This happens because usually processes print into two files: "standard output" file and "standard error" file. Programmer can manually decide which file to output to (they're accessed via std::cout and std::cerr). The rule of thumb is to print to stdout the actual result of the program, and to stderr - errors, diagnostics etc.

I run ffmpeg and it so happens, that it prints nothing to stdout (probably, reserving it for special mode, where encoded file is printed there), and all text messages are printed to stderr. So you should use setStandardErrorFile() function to capture the output.

Pavel Shved