Skip to content

Commit

Permalink
fix(ffmpeg_producer): disable HTTP seeking for ts & mxf
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Sep 21, 2020
1 parent de0f85d commit 8ec45a4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/modules/ffmpeg/producer/av_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include <common/param.h>
#include <common/scope_exit.h>

#include <boost/filesystem.hpp>
#include <boost/algorithm/string/case_conv.hpp>

#include <set>

#ifdef _MSC_VER
Expand Down Expand Up @@ -122,6 +125,14 @@ void Input::internal_reset()
FF(av_dict_set(&options, "multiple_requests", "1", 0)); // NOTE https://trac.ffmpeg.org/ticket/7034#comment:3
FF(av_dict_set(&options, "reconnect", "1", 0)); // HTTP reconnect
FF(av_dict_set(&options, "referer", filename_.c_str(), 0)); // HTTP referer header

// TODO (fix): Find a better solution? Make it an option?
const auto ext = boost::to_lower_copy(boost::filesystem::path(filename_).extension().wstring());
if (ext == L".mxf" || ext == L".ts") {
CASPAR_LOG(warning) << "av_input[" + filename_ + "] Disabled HTTP seeking for mxf and ts files";
// Seeking does not work well over HTTP.
FF(av_dict_set(&options, "seekable", "0", 0));
}
} else if (url_parts.first == L"rtmp" || url_parts.first == L"rtmps") {
FF(av_dict_set(&options, "rtmp_live", "live", 0));
} else if (PROTOCOLS_TREATED_AS_FORMATS.find(url_parts.first) != PROTOCOLS_TREATED_AS_FORMATS.end()) {
Expand Down

0 comments on commit 8ec45a4

Please sign in to comment.