Better default there, some fixes in the encoder
This commit is contained in:
parent
b623c689d9
commit
7c9266085b
@ -49,16 +49,18 @@ Encoder::Encoder(QString &targetFile, QSize res, CodecSettings *settings) {
|
|||||||
|
|
||||||
out->enc->gop_size = OR_DEF(settings, gopSize, 12);
|
out->enc->gop_size = OR_DEF(settings, gopSize, 12);
|
||||||
out->enc->pix_fmt = AV_PIX_FMT_YUV420P; // blaze it
|
out->enc->pix_fmt = AV_PIX_FMT_YUV420P; // blaze it
|
||||||
|
AVDictionary *dict = NULL;
|
||||||
if (out->enc->codec_id == AV_CODEC_ID_GIF)
|
if (out->enc->codec_id == AV_CODEC_ID_GIF)
|
||||||
out->enc->pix_fmt = AV_PIX_FMT_RGB8;
|
out->enc->pix_fmt = AV_PIX_FMT_RGB8;
|
||||||
else if (out->enc->codec_id == AV_CODEC_ID_H264 || out->enc->codec_id == AV_CODEC_ID_H265) {
|
else if (out->enc->codec_id == AV_CODEC_ID_H264 || out->enc->codec_id == AV_CODEC_ID_H265) {
|
||||||
av_opt_set(out->enc->priv_data, "preset", settings->h264Profile.toLocal8Bit().constData(), 0);
|
av_dict_set(&dict, "preset", settings->h264Profile.toLocal8Bit().constData(), 0);
|
||||||
av_opt_set(out->enc->priv_data, "crf", std::to_string(settings->h264Crf).c_str(), 0);
|
av_dict_set_int(&dict, "crf", OR_DEF(settings, h264Crf, 12), 0);
|
||||||
} else if (out->enc->codec_id == AV_CODEC_ID_VP8 || out->enc->codec_id == AV_CODEC_ID_VP9)
|
} else if (out->enc->codec_id == AV_CODEC_ID_VP8 || out->enc->codec_id == AV_CODEC_ID_VP9)
|
||||||
av_opt_set(out->enc->priv_data, "lossless", std::to_string(settings->vp9Lossless).c_str(), 0);
|
av_dict_set_int(&dict, "lossless", OR_DEF(settings, vp9Lossless, false), 0);
|
||||||
|
|
||||||
|
|
||||||
ret = avcodec_open2(out->enc, codec, NULL);
|
ret = avcodec_open2(out->enc, codec, &dict);
|
||||||
|
av_dict_free(&dict);
|
||||||
if (ret < 0) throwAVErr(ret, "codec open");
|
if (ret < 0) throwAVErr(ret, "codec open");
|
||||||
if (codec->capabilities & AV_CODEC_CAP_DR1) avcodec_align_dimensions(out->enc, &out->enc->width, &out->enc->height);
|
if (codec->capabilities & AV_CODEC_CAP_DR1) avcodec_align_dimensions(out->enc, &out->enc->width, &out->enc->height);
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
<item row="4" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QTabWidget" name="videoTabs">
|
<widget class="QTabWidget" name="videoTabs">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="hTab">
|
<widget class="QWidget" name="hTab">
|
||||||
<property name="layoutDirection">
|
<property name="layoutDirection">
|
||||||
@ -82,7 +82,7 @@
|
|||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="profileBox">
|
<widget class="QComboBox" name="profileBox">
|
||||||
<property name="currentText">
|
<property name="currentText">
|
||||||
<string>ultrafast</string>
|
<string notr="true">medium</string>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user