summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/encode_lavc.c5
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);