Initial support for hwaccel in proxy creation (through the h264-vaapi/nvenc settings)

parent c04ac897
......@@ -4,9 +4,11 @@ DNxHD=vcodec=dnxhd vb=145000k acodec=pcm_s16le threads=%threads;mov
MPEG=qscale=4 ab=192k vcodec=mpeg2video acodec=mp2 threads=%threads;mpg
[proxy]
x264=-vf scale=960:-2 -g 1 -bf 0 -vb 0 -crf 20 -vcodec libx264 -ab 128k -acodec aac -preset veryfast;mov
MPEG2=-vf scale=960:-2 -g 1 -bf 0 -vb 0 -qscale 6 -ab 128k -vcodec mpeg2video -acodec ac3;mpg
MJPEG=-vf yadif,scale=960:-2 -qscale 3 -vcodec mjpeg -acodec pcm_s16le;mkv
x264=-vf scale=720:-2 -vcodec libx264 -g 1 -bf 0 -vb 0 -crf 20 -preset veryfast -acodec aac -ab 128k;mov
x264-VAAPI=-hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i -vf format=nv12,hwupload,scale_vaapi=720:-2 -vcodec h264_vaapi -g 1 -bf 0 -vb 0 -crf 20 -acodec aac -ab 128k;mov
x264-NVENC=-hwaccel cuvid -c:v %nvcodec -i -filter:v scale_cuda=720:-2 -vcodec h264_nvenc -g 1 -bf 0 -vb 0 -acodec aac -ab 128k;mov
MPEG2=-vf scale=720:-2 -g 1 -bf 0 -vb 0 -qscale 6 -ab 128k -vcodec mpeg2video -acodec ac3;mpg
MJPEG=-vf yadif,scale=720:-2 -qscale 3 -vcodec mjpeg -acodec pcm_s16le;mkv
[screengrab]
X264 mute=-crf 25 -vcodec libx264 -preset veryfast -threads 0;mov
......
......@@ -207,7 +207,28 @@ bool ProxyJob::startJob()
m_done = true;
return false;
}
const QString proxyParams = pCore->currentDoc()->getDocumentProperty(QStringLiteral("proxyparams")).simplified();
m_jobDuration = (int) binClip->duration().seconds();
parameters << QStringLiteral("-y") << QStringLiteral("-v")<< QStringLiteral("quiet")<<QStringLiteral("-stats");
QString proxyParams = pCore->currentDoc()->getDocumentProperty(QStringLiteral("proxyparams")).simplified();
bool nvenc = proxyParams.contains(QStringLiteral("%nvcodec"));
if (nvenc) {
QString pix_fmt = binClip->videoCodecProperty(QStringLiteral("pix_fmt"));
QString codec = binClip->videoCodecProperty(QStringLiteral("name"));
QStringList supportedCodecs {QStringLiteral("hevc"),QStringLiteral("h264"),QStringLiteral("mjpeg"),QStringLiteral("mpeg1"),QStringLiteral("mpeg2"),QStringLiteral("mpeg4"),QStringLiteral("vc1"),QStringLiteral("vp8"),QStringLiteral("vp9")};
QStringList supportedPixFmts {QStringLiteral("yuv420p"),QStringLiteral("yuyv422"),QStringLiteral("rgb24"),QStringLiteral("bgr24"),QStringLiteral("yuv422p"),QStringLiteral("yuv444p"),QStringLiteral("rgb32"),QStringLiteral("yuv410p"),QStringLiteral("yuv411p")};
bool supported = supportedCodecs.contains(codec) && supportedPixFmts.contains(pix_fmt);
if (supported) {
// Full hardware decoding supported
codec.append(QStringLiteral("_cuvid"));
proxyParams.replace(QStringLiteral("%nvcodec"), codec);
} else {
proxyParams = proxyParams.section(QStringLiteral("-i"), 1);
proxyParams.replace(QStringLiteral("scale_cuda"), QStringLiteral("scale"));
if (!supportedPixFmts.contains(pix_fmt)) {
proxyParams.prepend(QStringLiteral("-pix_fmt yuv420p"));
}
}
}
bool disableAutorotate = binClip->getProducerProperty(QStringLiteral("autorotate")) == QLatin1String("0");
if (disableAutorotate || proxyParams.contains(QStringLiteral("-noautorotate"))) {
// The noautorotate flag must be passed before input source
......@@ -230,8 +251,8 @@ bool ProxyJob::startJob()
}
// Make sure we don't block when proxy file already exists
parameters << QStringLiteral("-y");
parameters << dest;
qDebug()<<"/// FULL PROXY PARAMS:\n"<<parameters<<"\n------";
m_jobProcess = new QProcess;
m_jobProcess->setProcessChannelMode(QProcess::MergedChannels);
connect(m_jobProcess, &QProcess::readyReadStandardOutput, this, &ProxyJob::processLogInfo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment