diff options
author | TheAMM <the.actual.amm@gmail.com> | 2021-05-25 00:48:40 +0300 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-05-26 17:36:22 +0200 |
commit | 643c699f2684987db6073ebe8a6ea76e56c87055 (patch) | |
tree | 8ba38ea2e8cbf0a50e3520a88c4a5ffd55514af9 /common | |
parent | ec0006bfa1aaf608a7141929f2871c89ac7a15d6 (diff) | |
download | mpv-643c699f2684987db6073ebe8a6ea76e56c87055.tar.bz2 mpv-643c699f2684987db6073ebe8a6ea76e56c87055.tar.xz |
recorder: clear codec_tag if no target format support
Avoiding blindly copying the codec_tag between different formats allows
us to mux packets from, say, mpegts streams to matroska, making the
recorder (dump-cache) much more usable as unsupported codec_tags can
make the muxer reject the streams.
Diffstat (limited to 'common')
-rw-r--r-- | common/recorder.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/common/recorder.c b/common/recorder.c index 58bf257883..63e4163303 100644 --- a/common/recorder.c +++ b/common/recorder.c @@ -91,6 +91,12 @@ static int add_stream(struct mp_recorder *priv, struct sh_stream *sh) if (!avp) return -1; + // Check if we get the same codec_tag for the output format; + // otherwise clear it to have a chance at muxing + if (av_codec_get_id(priv->mux->oformat->codec_tag, + avp->codec_tag) != avp->codec_tag) + avp->codec_tag = 0; + // We don't know the delay, so make something up. If the format requires // DTS, the result will probably be broken. FFmpeg provides nothing better // yet (unless you demux with libavformat, which contains tons of hacks |