Skip to content

Commit

Permalink
obs-ffmpeg: Use muxer settings with AVIOContext
Browse files Browse the repository at this point in the history
In the FFmpeg output, it was not passing the muxer settings to the
AVIOContext, so some settings would not be properly passed to protocols.
  • Loading branch information
jp9000 committed Nov 25, 2017
1 parent f0a2ef4 commit ee63fc6
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions plugins/obs-ffmpeg/obs-ffmpeg-output.c
Expand Up @@ -373,20 +373,6 @@ static inline bool open_output_file(struct ffmpeg_data *data)
AVOutputFormat *format = data->output->oformat;
int ret;

if ((format->flags & AVFMT_NOFILE) == 0) {
ret = avio_open(&data->output->pb, data->config.url,
AVIO_FLAG_WRITE);
if (ret < 0) {
blog(LOG_WARNING, "Couldn't open '%s', %s",
data->config.url, av_err2str(ret));
return false;
}
}

strncpy(data->output->filename, data->config.url,
sizeof(data->output->filename));
data->output->filename[sizeof(data->output->filename) - 1] = 0;

AVDictionary *dict = NULL;
if ((ret = av_dict_parse_string(&dict, data->config.muxer_settings,
"=", " ", 0))) {
Expand All @@ -405,10 +391,25 @@ static inline bool open_output_file(struct ffmpeg_data *data)
AV_DICT_IGNORE_SUFFIX)))
dstr_catf(&str, "\n\t%s=%s", entry->key, entry->value);

blog(LOG_INFO, "Using muxer settings:%s", str.array);
blog(LOG_INFO, "Using muxer settings: %s", str.array);
dstr_free(&str);
}

if ((format->flags & AVFMT_NOFILE) == 0) {
ret = avio_open2(&data->output->pb, data->config.url,
AVIO_FLAG_WRITE, NULL, &dict);
if (ret < 0) {
blog(LOG_WARNING, "Couldn't open '%s', %s",
data->config.url, av_err2str(ret));
av_dict_free(&dict);
return false;
}
}

strncpy(data->output->filename, data->config.url,
sizeof(data->output->filename));
data->output->filename[sizeof(data->output->filename) - 1] = 0;

ret = avformat_write_header(data->output, &dict);
if (ret < 0) {
blog(LOG_WARNING, "Error opening '%s': %s",
Expand Down

0 comments on commit ee63fc6

Please sign in to comment.