This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit b326b3a08d5c263847e13798a85c96ef957abe8d Author: Jun Zhao <[email protected]> AuthorDate: Fri Jan 2 10:35:22 2026 +0800 Commit: James Almer <[email protected]> CommitDate: Wed Jan 14 23:56:39 2026 +0000 lavc/av1_parser: Extract SAR from render_size Extract the Sample Aspect Ratio (SAR) from render_width_minus_1 and render_height_minus_1 in the sequence header. The AV1 specification defines the render dimensions, which can be used in conjunction with the coded dimensions to determine the pixel aspect ratio. This ensures consistent aspect ratio handling for AV1 streams encapsulated in containers like MP4 or MKV, as observed in the updated FATE tests where SAR changes from 0/1 to 1/1. Signed-off-by: Jun Zhao <[email protected]> --- libavcodec/av1_parser.c | 7 +++++++ tests/ref/fate/av1-annexb-demux | 2 +- tests/ref/fate/enhanced-flv-av1 | 2 +- tests/ref/fate/enhanced-flv-multitrack | 2 +- tests/ref/lavf-fate/av1.mkv | 4 ++-- tests/ref/lavf-fate/av1.mp4 | 4 ++-- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c index 32135a23cb..f221fee79f 100644 --- a/libavcodec/av1_parser.c +++ b/libavcodec/av1_parser.c @@ -134,6 +134,13 @@ static int av1_parser_parse(AVCodecParserContext *ctx, break; } ctx->picture_structure = AV_PICTURE_STRUCTURE_FRAME; + + /* Extract SAR from render_height_minus_1 & render_width_minus_1 */ + av_reduce(&avctx->sample_aspect_ratio.num, + &avctx->sample_aspect_ratio.den, + (int64_t)ctx->height * (frame->render_width_minus_1 + 1), + (int64_t)ctx->width * (frame->render_height_minus_1 + 1), + INT_MAX); } switch (av1->bit_depth) { diff --git a/tests/ref/fate/av1-annexb-demux b/tests/ref/fate/av1-annexb-demux index 139a893ec1..77e0e378ab 100644 --- a/tests/ref/fate/av1-annexb-demux +++ b/tests/ref/fate/av1-annexb-demux @@ -3,7 +3,7 @@ #media_type 0: video #codec_id 0: av1 #dimensions 0: 300x300 -#sar 0: 0/1 +#sar 0: 1/1 0, 0, 0, 48000, 12691, 0xf0adcc79 0, 48000, 48000, 48000, 4975, 0x1742a45f, F=0x0 0, 96000, 96000, 48000, 928, 0x7408be1a, F=0x0 diff --git a/tests/ref/fate/enhanced-flv-av1 b/tests/ref/fate/enhanced-flv-av1 index c50da5d430..b2a624e41e 100644 --- a/tests/ref/fate/enhanced-flv-av1 +++ b/tests/ref/fate/enhanced-flv-av1 @@ -3,7 +3,7 @@ #media_type 0: video #codec_id 0: av1 #dimensions 0: 320x176 -#sar 0: 0/1 +#sar 0: 1/1 0, 0, 0, 41, 4718, 0xc4d912ec 0, 42, 42, 41, 5109, 0xc065dd7d, F=0x0 0, 83, 83, 41, 192, 0x160c5335, F=0x0 diff --git a/tests/ref/fate/enhanced-flv-multitrack b/tests/ref/fate/enhanced-flv-multitrack index e3c5836bfa..f017e445ea 100644 --- a/tests/ref/fate/enhanced-flv-multitrack +++ b/tests/ref/fate/enhanced-flv-multitrack @@ -31,7 +31,7 @@ #media_type 4: video #codec_id 4: av1 #dimensions 4: 1920x1080 -#sar 4: 0/1 +#sar 4: 1/1 #tb 5: 1/1000 #media_type 5: audio #codec_id 5: flac diff --git a/tests/ref/lavf-fate/av1.mkv b/tests/ref/lavf-fate/av1.mkv index e6db3a814a..84924fe05c 100644 --- a/tests/ref/lavf-fate/av1.mkv +++ b/tests/ref/lavf-fate/av1.mkv @@ -1,3 +1,3 @@ -d875b42964dd55c8cea2e2752379d327 *tests/data/lavf-fate/lavf.av1.mkv -55660 tests/data/lavf-fate/lavf.av1.mkv +ba198efa114b4db3c9f772728f84978b *tests/data/lavf-fate/lavf.av1.mkv +55656 tests/data/lavf-fate/lavf.av1.mkv tests/data/lavf-fate/lavf.av1.mkv CRC=0x7c27cc15 diff --git a/tests/ref/lavf-fate/av1.mp4 b/tests/ref/lavf-fate/av1.mp4 index 53b0cbe637..ef174589ba 100644 --- a/tests/ref/lavf-fate/av1.mp4 +++ b/tests/ref/lavf-fate/av1.mp4 @@ -1,3 +1,3 @@ -194cd796f3d28a890b516b2507f57180 *tests/data/lavf-fate/lavf.av1.mp4 -55960 tests/data/lavf-fate/lavf.av1.mp4 +d6afef355cf1bcf1a71b9cfb98c32fba *tests/data/lavf-fate/lavf.av1.mp4 +55976 tests/data/lavf-fate/lavf.av1.mp4 tests/data/lavf-fate/lavf.av1.mp4 CRC=0x7c27cc15 _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
