transcodingthread.cpp
上传用户:dsfsafq
上传日期:2022-06-05
资源大小:47k
文件大小:1k
- #include "transcodingthread.h"
- #include <QStringList>
- TranscodingThread::TranscodingThread(const QString& inputfile, const QString& outputfile, const QString& fps)
- {
- input = inputfile;
- output = outputfile;
- framerate = fps;
- }
- void TranscodingThread::run()
- {
- connect(&proc, SIGNAL(readyRead()), this, SLOT(readOutput()));
- proc.start("mencoder "" + input + "" -oac mp3lame -lameopts preset=128 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1200 -ofps " + framerate + " -of avi -o "" + output + """);
- }
- void TranscodingThread::readOutput()
- {
- c_proc_out = proc.readAll();
- c_proc_out = c_proc_out.simplified();
- qDebug() << c_proc_out;
- if (c_proc_out.left(8) == "Flushing")
- {
- emit updateProgress("finished");
- return;
- }
- if (c_proc_out.left(3) == "Pos")
- {
- c_proc_out.replace("( ", "(");
- QStringList line = c_proc_out.split(' ');
- emit updateProgress(line.at(3));
- }
- }