find starting number for image sequences automatically

This commit is contained in:
itsmattkc
2019-02-26 10:58:55 -08:00
parent 8ba58acbc3
commit 1ae3b877a1
7 changed files with 54 additions and 13 deletions
+2
View File
@@ -290,6 +290,8 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
f->proxy = (attr.value() == "1");
} else if (attr.name() == "proxypath") {
f->proxy_path = attr.value().toString();
} else if (attr.name() == "startnumber") {
f->start_number = attr.value().toInt();
}
}
+9 -1
View File
@@ -524,7 +524,15 @@ void PreviewGenerator::run() {
QString errorStr;
bool error = false;
int errCode = avformat_open_input(&fmt_ctx_, filename, nullptr, nullptr);
AVDictionary* format_opts = nullptr;
// for image sequences that don't start at 0, set the index where it does start
if (footage_->start_number > 0) {
av_dict_set(&format_opts, "start_number", QString::number(footage_->start_number).toUtf8(), 0);
}
int errCode = avformat_open_input(&fmt_ctx_, filename, nullptr, &format_opts);
if(errCode != 0) {
char err[1024];
av_strerror(errCode, err, 1024);
+7 -1
View File
@@ -47,9 +47,15 @@ void ProxyGenerator::transcode(const ProxyInfo& info) {
// set progress to 0
current_progress = 0.0;
// for image sequences that don't start at 0, set the index where it does start
AVDictionary* format_opts = nullptr;
if (footage->start_number > 0) {
av_dict_set(&format_opts, "start_number", QString::number(footage->start_number).toUtf8(), 0);
}
// open input file
AVFormatContext* input_fmt_ctx = nullptr;
avformat_open_input(&input_fmt_ctx, footage->url.toUtf8(), nullptr, nullptr);
avformat_open_input(&input_fmt_ctx, footage->url.toUtf8(), nullptr, &format_opts);
// open output file
AVFormatContext* output_fmt_ctx = nullptr;