PDA

View Full Version : Avi File Class



ascii
9th November 2008, 15:53
Hi..
i want to do an easy screen recorder. But i can't create avi file. i think if i create an avi file i can add an pixmap or png file to avi file. i am trying windows avi file but it works for mfc but dont work with Qt. is there any solution for this problem. Or sample code. i couldnt find.

is there any alternative solution for screen record api, i can try.

please help me.. this problem make me crazy.

thanks...

caduel
9th November 2008, 18:50
reading the docs does help sometimes: desktop-screenshot

SunnySan
10th November 2008, 11:58
an idea:

use screenshot to take a number of pictures every 0.5sec or less

then use
Qprocess with mencoder to transform the images into an .avi file




QProcess *mencodeProcess = new QProcess(this);
mencodeProcess->setWorkingDirectory("C:/JPG");
QStringList arg;
QString program = "C:/JPG/mencoder";

arg << "mf://*.jpg" << "-mf" << "w=800:h=600:fps=25:type=jpg" << "-ovc"
<< "lavc" << "-lavcopts" << "vcodec=mpeg4" << "-oac" << "copy"
<< "-o" << "a.avi";//tested worked fine


mencodeProcess->start(program, arg);
QString msg;
if (!mencodeProcess->waitForFinished(1000))
msg = "Mencoder failed:" + mencodeProcess->errorString();
else
msg = "Mencoder output:" + mencodeProcess->readAll();
qDebug() << msg;



I use this little code before to transform a sequence of jpg to an video .avi

ascii
10th November 2008, 22:30
so thank you...
mencoder works... :)

its work but i have another problem now.:confused:

i couldn't capture screen with mouse, is there any way?:rolleyes:

Or can i draw a mouse arrow at event.x() and event.y() position on captured QPixmap?:rolleyes:

ascii
12th November 2008, 11:34
can i record screen realtime?

for example i grab screen as a Pixmap or image and add to created avi file it.

create avi file "x"?

while()
{
grabWindow
add avi file
}

like this