diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2009-09-26 05:17:37 -0400 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2009-09-26 05:17:37 -0400 |
commit | 2bb77bf0c2b479475e559dd27d8eddcef9fd5ca0 (patch) | |
tree | 869a4279ef5e1f729b9db96bc3ea69c89542c5a7 /encodemp4job.cpp | |
parent | Add handbrake snapshot build. (diff) | |
download | AnyRip-2bb77bf0c2b479475e559dd27d8eddcef9fd5ca0.tar.xz AnyRip-2bb77bf0c2b479475e559dd27d8eddcef9fd5ca0.zip |
Encoding skeleton and cleanups.
Diffstat (limited to 'encodemp4job.cpp')
-rw-r--r-- | encodemp4job.cpp | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/encodemp4job.cpp b/encodemp4job.cpp index 34b82f9..d056002 100644 --- a/encodemp4job.cpp +++ b/encodemp4job.cpp @@ -1,6 +1,10 @@ #include "encodemp4job.h" #include <QWidget> #include <QLabel> +#include <QProcess> +#include <QStringList> +#include <QTextStream> +#include <QRegExp> EncodeMP4Job::EncodeMP4Job(Video *video, QString encodePath, QString imagePath) : Job(video), @@ -14,9 +18,32 @@ Video::Jobs EncodeMP4Job::jobType() const } bool EncodeMP4Job::executeJob() { - //TODO: encode the actual mp4! - sleep(5); - return true; + QProcess process; + QStringList arguments; + arguments << "-i" << m_imagePath; + arguments << "-o" << m_encodePath; + arguments << "-e" << "x264"; + arguments << "-b" << "500"; + arguments << "-E" << "faac"; + arguments << "-B" << "96"; + arguments << "-R" << "auto"; + arguments << "-6" << "stereo"; + arguments << "-N" << "eng" << "--native-dub"; + arguments << "-f" << "mp4"; + arguments << "-P" << "-2" << "-T"; + arguments << "--optimize" << "--decomb" << "--deblock" << "--denoise=\"weak\""; + arguments << "-x" << "ref=3:mixed-refs:bframes=6:weightb:direct=auto:b-pyramid:me=umh:subme=9:analyse=all:8x8dct:trellis=1:no-fast-pskip:psy-rd=1,1"; + process.start(QLatin1String("HandBrakeCLI"), arguments, QIODevice::ReadOnly); + if (!process.waitForStarted()) + return false; + QTextStream reader(&process); + QRegExp percentLinePattern(QLatin1String("^Encoding: task ([0-9]*) of ([0-9]*), ([0-9]*\\.[0-9]*) %( \\(([0-9]*\\.[0-9]*) fps, avg ([0-9]*\\.[0-9]*) fps, ETA ([0-9]{2})h([0-9]{2})m([0-9]{2})s\\))?")); + while (process.waitForReadyRead(-1)) { + if (percentLinePattern.exactMatch(reader.readLine())) { + qDebug() << percentLinePattern.capturedTexts(); //cap(n) + } + } + return process.waitForFinished(-1); } QWidget* EncodeMP4Job::gui() { |