Skip to content
Snippets Groups Projects
Commit c2dac814 authored by Julian Rother's avatar Julian Rother
Browse files

remux: Fixed opening output file to support faststart option

parent c264c64b
Branches
No related tags found
No related merge requests found
...@@ -31,7 +31,10 @@ int main(int argc, char *argv[]) ...@@ -31,7 +31,10 @@ int main(int argc, char *argv[])
if (err = avformat_open_input(&demux, path, 0, 0)) if (err = avformat_open_input(&demux, path, 0, 0))
job_failed("Opening input file failed: %s", av_err2str(err)); job_failed("Opening input file failed: %s", av_err2str(err));
avformat_find_stream_info(demux, 0); 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); av_dict_copy(&mux->metadata, demux->metadata, 0);
parse_dict(&mux->metadata, jlookup(argv[4], "metadata")); parse_dict(&mux->metadata, jlookup(argv[4], "metadata"));
parse_chapters(mux, jlookup(argv[4], "chapters"), demux->duration); parse_chapters(mux, jlookup(argv[4], "chapters"), demux->duration);
...@@ -74,6 +77,7 @@ int main(int argc, char *argv[]) ...@@ -74,6 +77,7 @@ int main(int argc, char *argv[])
if (err = av_interleaved_write_frame(mux, &pkt)) if (err = av_interleaved_write_frame(mux, &pkt))
job_failed("Could not write frame: %s", av_err2str(err)); job_failed("Could not write frame: %s", av_err2str(err));
} }
avformat_close_input(&demux);
av_interleaved_write_frame(mux, 0); av_interleaved_write_frame(mux, 0);
if (err = av_write_trailer(mux)) if (err = av_write_trailer(mux))
job_failed("Error writing trailer to temporary file", av_err2str(err)); job_failed("Error writing trailer to temporary file", av_err2str(err));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment