diff options
author | ekisu <dts.ramon@gmail.com> | 2019-08-06 22:02:10 -0300 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2019-08-14 21:54:44 +0200 |
commit | cd7bcb9d0c12ee4e252024235cc8bbb395960118 (patch) | |
tree | 48c1e93417b051c757be1b60974cb753bc4eec07 | |
parent | ae8cb39ab2b1632f46ecd2a6cd4541aaedcda766 (diff) | |
download | mpv-cd7bcb9d0c12ee4e252024235cc8bbb395960118.tar.bz2 mpv-cd7bcb9d0c12ee4e252024235cc8bbb395960118.tar.xz |
encode: set sample_aspect_ratio on AVStream struct
Some libavformat muxers (e.g. matroskaenc.c) expect this field to be set
on the AVStream struct, and not only in the AVCodecParameters.
-rw-r--r-- | common/encode_lavc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/encode_lavc.c b/common/encode_lavc.c index 213e2ba5a1..968ced280c 100644 --- a/common/encode_lavc.c +++ b/common/encode_lavc.c @@ -422,6 +422,11 @@ static struct mux_stream *encode_lavc_add_stream(struct encode_lavc_context *ctx dst->encoder_timebase = info->timebase; dst->st->time_base = info->timebase; // lavf will change this on muxer init + // Some muxers (e.g. Matroska one) expect the sample_aspect_ratio to be + // set on the AVStream. + if (info->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) + dst->st->sample_aspect_ratio = info->codecpar->sample_aspect_ratio; + if (avcodec_parameters_copy(dst->st->codecpar, info->codecpar) < 0) MP_HANDLE_OOM(0); |