Commit c2dac814 authored by Julian Rother's avatar Julian Rother

remux: Fixed opening output file to support faststart option

parent c264c64b
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment