Skip to content

Commit ee63fc6

Browse files
committed
obs-ffmpeg: Use muxer settings with AVIOContext
In the FFmpeg output, it was not passing the muxer settings to the AVIOContext, so some settings would not be properly passed to protocols.
1 parent f0a2ef4 commit ee63fc6

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

plugins/obs-ffmpeg/obs-ffmpeg-output.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -373,20 +373,6 @@ static inline bool open_output_file(struct ffmpeg_data *data)
373373
AVOutputFormat *format = data->output->oformat;
374374
int ret;
375375

376-
if ((format->flags & AVFMT_NOFILE) == 0) {
377-
ret = avio_open(&data->output->pb, data->config.url,
378-
AVIO_FLAG_WRITE);
379-
if (ret < 0) {
380-
blog(LOG_WARNING, "Couldn't open '%s', %s",
381-
data->config.url, av_err2str(ret));
382-
return false;
383-
}
384-
}
385-
386-
strncpy(data->output->filename, data->config.url,
387-
sizeof(data->output->filename));
388-
data->output->filename[sizeof(data->output->filename) - 1] = 0;
389-
390376
AVDictionary *dict = NULL;
391377
if ((ret = av_dict_parse_string(&dict, data->config.muxer_settings,
392378
"=", " ", 0))) {
@@ -405,10 +391,25 @@ static inline bool open_output_file(struct ffmpeg_data *data)
405391
AV_DICT_IGNORE_SUFFIX)))
406392
dstr_catf(&str, "\n\t%s=%s", entry->key, entry->value);
407393

408-
blog(LOG_INFO, "Using muxer settings:%s", str.array);
394+
blog(LOG_INFO, "Using muxer settings: %s", str.array);
409395
dstr_free(&str);
410396
}
411397

398+
if ((format->flags & AVFMT_NOFILE) == 0) {
399+
ret = avio_open2(&data->output->pb, data->config.url,
400+
AVIO_FLAG_WRITE, NULL, &dict);
401+
if (ret < 0) {
402+
blog(LOG_WARNING, "Couldn't open '%s', %s",
403+
data->config.url, av_err2str(ret));
404+
av_dict_free(&dict);
405+
return false;
406+
}
407+
}
408+
409+
strncpy(data->output->filename, data->config.url,
410+
sizeof(data->output->filename));
411+
data->output->filename[sizeof(data->output->filename) - 1] = 0;
412+
412413
ret = avformat_write_header(data->output, &dict);
413414
if (ret < 0) {
414415
blog(LOG_WARNING, "Error opening '%s': %s",

0 commit comments

Comments
 (0)