From c2dac814431b72627484b5f2c3dba4bdd7f33d23 Mon Sep 17 00:00:00 2001 From: Julian Rother <julianr@fsmpi.rwth-aachen.de> Date: Wed, 13 Dec 2017 03:40:06 +0100 Subject: [PATCH] remux: Fixed opening output file to support faststart option --- remux.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/remux.c b/remux.c index 3572a80..d7d4e5f 100644 --- a/remux.c +++ b/remux.c @@ -31,7 +31,10 @@ int main(int argc, char *argv[]) if (err = avformat_open_input(&demux, path, 0, 0)) job_failed("Opening input file failed: %s", av_err2str(err)); avformat_find_stream_info(demux, 0); - avformat_alloc_output_context2(&mux, 0, jstr(jlookup(argv[4], "format"), 0), path); + err = avformat_alloc_output_context2(&mux, + av_guess_format(jstr(jlookup(argv[4], "format"), 0), path, 0), 0, tmp); + if (err < 0) + job_failed("Error allocating muxer context: %s", av_err2str(err)); av_dict_copy(&mux->metadata, demux->metadata, 0); parse_dict(&mux->metadata, jlookup(argv[4], "metadata")); parse_chapters(mux, jlookup(argv[4], "chapters"), demux->duration); @@ -74,6 +77,7 @@ int main(int argc, char *argv[]) if (err = av_interleaved_write_frame(mux, &pkt)) job_failed("Could not write frame: %s", av_err2str(err)); } + avformat_close_input(&demux); av_interleaved_write_frame(mux, 0); if (err = av_write_trailer(mux)) job_failed("Error writing trailer to temporary file", av_err2str(err)); -- GitLab