Skip to content

Commit 2b0c540

Browse files
committed
fix(ffmpeg_producer): disable HTTP seeking for ts & mxf
1 parent de0f85d commit 2b0c540

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/modules/ffmpeg/producer/av_input.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
#include <common/param.h>
99
#include <common/scope_exit.h>
1010

11+
#include <boost/filesystem.hpp
12+
#include <boost/algorithm/string/case_conv.hpp>
13+
1114
#include <set>
1215

1316
#ifdef _MSC_VER
@@ -122,6 +125,14 @@ void Input::internal_reset()
122125
FF(av_dict_set(&options, "multiple_requests", "1", 0)); // NOTE https://trac.ffmpeg.org/ticket/7034#comment:3
123126
FF(av_dict_set(&options, "reconnect", "1", 0)); // HTTP reconnect
124127
FF(av_dict_set(&options, "referer", filename_.c_str(), 0)); // HTTP referer header
128+
129+
// TODO (fix): Find a better solution? Make it an option?
130+
const auto ext = boost::to_lower_copy(boost::filesystem::path(filename_).extension().wstring());
131+
if (ext == L".mxf" || ext == L".ts") {
132+
CASPAR_LOG(warning) << "av_input[" + filename_ + "] Disabled HTTP seeking for mxf and ts files";
133+
// Seeking does not work well over HTTP.
134+
FF(av_dict_set(&options, "seekable", "0", 0));
135+
}
125136
} else if (url_parts.first == L"rtmp" || url_parts.first == L"rtmps") {
126137
FF(av_dict_set(&options, "rtmp_live", "live", 0));
127138
} else if (PROTOCOLS_TREATED_AS_FORMATS.find(url_parts.first) != PROTOCOLS_TREATED_AS_FORMATS.end()) {

0 commit comments

Comments
 (0)