added title/action safe areas
This commit is contained in:
+16
-1
@@ -18,7 +18,10 @@ Config::Config()
|
||||
paste_seeks(true),
|
||||
rectified_waveforms(false),
|
||||
default_transition_length(30),
|
||||
timecode_view(TIMECODE_DROP)
|
||||
timecode_view(TIMECODE_DROP),
|
||||
show_title_safe_area(false),
|
||||
use_custom_title_safe_ratio(false),
|
||||
custom_title_safe_ratio(1)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -64,6 +67,15 @@ void Config::load(QString path) {
|
||||
} else if (stream.name() == "TimecodeView") {
|
||||
stream.readNext();
|
||||
timecode_view = stream.text().toInt();
|
||||
}else if (stream.name() == "ShowTitleSafeArea") {
|
||||
stream.readNext();
|
||||
show_title_safe_area = (stream.text() == "1");
|
||||
} else if (stream.name() == "UseCustomTitleSafeRatio") {
|
||||
stream.readNext();
|
||||
use_custom_title_safe_ratio = (stream.text() == "1");
|
||||
} else if (stream.name() == "CustomTitleSafeRatio") {
|
||||
stream.readNext();
|
||||
custom_title_safe_ratio = stream.text().toDouble();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,6 +133,9 @@ void Config::save(QString path) {
|
||||
stream.writeTextElement("RectifiedWaveforms", QString::number(rectified_waveforms));
|
||||
stream.writeTextElement("DefaultTransitionLength", QString::number(default_transition_length));
|
||||
stream.writeTextElement("TimecodeView", QString::number(timecode_view));
|
||||
stream.writeTextElement("ShowTitleSafeArea", QString::number(show_title_safe_area));
|
||||
stream.writeTextElement("UseCustomTitleSafeRatio", QString::number(use_custom_title_safe_ratio));
|
||||
stream.writeTextElement("CustomTitleSafeRatio", QString::number(custom_title_safe_ratio));
|
||||
|
||||
stream.writeEndElement();
|
||||
stream.writeEndDocument(); // doc
|
||||
|
||||
@@ -22,6 +22,9 @@ struct Config {
|
||||
bool rectified_waveforms;
|
||||
int default_transition_length;
|
||||
int timecode_view;
|
||||
bool show_title_safe_area;
|
||||
bool use_custom_title_safe_ratio;
|
||||
double custom_title_safe_ratio;
|
||||
|
||||
void load(QString path);
|
||||
void save(QString path);
|
||||
|
||||
+10
-3
@@ -12,7 +12,8 @@
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavutil/opt.h>
|
||||
#include <libswresample/swresample.h>
|
||||
#include <libswscale/swscale.h>
|
||||
}
|
||||
@@ -108,15 +109,21 @@ bool ExportThread::setupVideo() {
|
||||
vcodec_ctx->sample_aspect_ratio = av_d2q(video_width/video_height, INT_MAX);
|
||||
vcodec_ctx->pix_fmt = vcodec->pix_fmts[0]; // maybe be breakable code
|
||||
vcodec_ctx->framerate = av_d2q(video_frame_rate, INT_MAX);
|
||||
vcodec_ctx->bit_rate = video_bitrate * 1000000;
|
||||
vcodec_ctx->bit_rate = video_bitrate * 1000000;
|
||||
vcodec_ctx->time_base = av_inv_q(vcodec_ctx->framerate);
|
||||
|
||||
if (fmt_ctx->oformat->flags & AVFMT_GLOBALHEADER) {
|
||||
vcodec_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
||||
}
|
||||
|
||||
if (vcodec_ctx->codec_id == AV_CODEC_ID_H264) {
|
||||
// av_opt_set(vcodec_ctx->priv_data, "preset", "veryslow", AV_OPT_SEARCH_CHILDREN);
|
||||
// av_opt_set(vcodec_ctx->priv_data, "crf", "0", AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set(vcodec_ctx->priv_data, "x264-params", "nal-hrd=cbr", AV_OPT_SEARCH_CHILDREN);
|
||||
}
|
||||
|
||||
// open encoder
|
||||
vcodec_ctx->gop_size = 12; // ? does this help?
|
||||
vcodec_ctx->gop_size = 40; // ? does this help?
|
||||
ret = avcodec_open2(vcodec_ctx, vcodec, NULL);
|
||||
if (ret < 0) {
|
||||
qDebug() << "[ERROR] Could not open output video encoder." << ret;
|
||||
|
||||
Reference in New Issue
Block a user