[FFmpeg-devel] [PATCH] avformat/mxfenc: calculate and store DAR from user SAR
Paul B Mahol
onemda at gmail.com
Fri Dec 7 22:30:56 EET 2018
Fixes #5155
Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
libavformat/mxfenc.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 3549b4137d..8f762c7eaf 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -2726,6 +2726,14 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt)
}
}
+ if (st->codecpar->sample_aspect_ratio.num && st->codecpar->sample_aspect_ratio.den) {
+ av_reduce(&sc->aspect_ratio.num, &sc->aspect_ratio.den,
+ st->codecpar->sample_aspect_ratio.num * st->codecpar->width,
+ st->codecpar->sample_aspect_ratio.den * st->codecpar->height, INT_MAX);
+ } else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
+ av_reduce(&sc->aspect_ratio.num, &sc->aspect_ratio.den, st->codecpar->width, st->codecpar->height, INT_MAX);
+ }
+
if (st->codecpar->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
if (!mxf_parse_mpeg2_frame(s, st, pkt, &ie)) {
av_log(s, AV_LOG_ERROR, "could not get mpeg2 profile and level\n");
--
2.17.1
More information about the ffmpeg-devel
mailing list