diff --git a/Source/Core/FileInformation.cpp b/Source/Core/FileInformation.cpp index f22eccd34..307ec6673 100644 --- a/Source/Core/FileInformation.cpp +++ b/Source/Core/FileInformation.cpp @@ -817,12 +817,12 @@ FileInformation::FileInformation (SignalServer* signalServer, const QString &Fil m_mediaParser = new QAVPlayer(); + int dpxOffset = -1; if(mediaFileName == "-") mediaFileName = "pipe:0"; else if(isDpx(mediaFileName)) { - int dpxOffset = 0; mediaFileName = adjustDpxFileName(mediaFileName, dpxOffset); - m_mediaParser->setInputOptions({ {"start_number", QString::number(dpxOffset) } }); + m_mediaParser->setInputOptions({ {"start_number", QString::number(dpxOffset) }, {"f", "image2"} }); } m_mediaParser->setSource(mediaFileName); @@ -856,7 +856,13 @@ FileInformation::FileInformation (SignalServer* signalServer, const QString &Fil AVFormatContext* FormatContext = nullptr; auto stdMediaFileName = mediaFileName.toStdString(); - if (avformat_open_input(&FormatContext, stdMediaFileName.c_str(), NULL, NULL)>=0) + AVDictionary* options = nullptr; + if (dpxOffset != -1) { + auto dpxOffsetString = std::to_string(dpxOffset); + av_dict_set(&options, "f", "image2", 0); + av_dict_set(&options, "start_number", dpxOffsetString.c_str(), 0); + } + if (avformat_open_input(&FormatContext, stdMediaFileName.c_str(), nullptr, &options)>=0) { QVector orderedStreams; if (avformat_find_stream_info(FormatContext, NULL)>=0) { @@ -927,6 +933,9 @@ FileInformation::FileInformation (SignalServer* signalServer, const QString &Fil avformat_close_input(&FormatContext); } + if (options) { + av_dict_free(&options); + } } if(attachment.isEmpty()) { diff --git a/Source/GUI/player.h b/Source/GUI/player.h index d94416332..7c9cbd9b4 100644 --- a/Source/GUI/player.h +++ b/Source/GUI/player.h @@ -135,7 +135,7 @@ class MediaPlayer : public QAVPlayer { if (isDpx(sourceFile)) { int dpxOffset = 0; sourceFile = adjustDpxFileName(sourceFile, dpxOffset); - setInputOptions({ {"start_number", QString::number(dpxOffset) } }); + setInputOptions({ {"start_number", QString::number(dpxOffset) }, {"f", "image2"} }); } else { if(!inputOptions().empty()) { setInputOptions({});