On Sun, 15 Apr 2018, Timo Teräs wrote:

Calculate DAR with assumed SAR 1:1 when SAR is undefined. Same
assumption is done in ffplay to create the play window. Usually
DAR is more useful metadata than SAR when e.g. choosing which
media of multiple versions to use to fit the display.

Normally undefined SAR means 1:1. E.g. in mov/mp4 files there's
'pasp' atom to explicitly define SAR. If that is not specified,
the video codec's SAR should be used. Should it be also undefined,
the SAR should be assumed to be 1:1. It makes sense to not change
SAR in the demux info, so ffmpeg can make copies with matching
atom structure and codec extra data. So the simplest way to
report DAR is assume SAR 1:1 when undefined.

Signed-off-by: Timo Teräs <timo.te...@iki.fi>
---
This applies on top of the previous DAR/SAR reporting fix:
https://ffmpeg.org/pipermail/ffmpeg-devel/2018-April/228141.html

For more details behind this patch, see:
https://ffmpeg.org/pipermail/ffmpeg-devel/2018-April/228146.html

This seemed to be the most simple and logical fix. Alternatively,
we could add a new 'effective_display_aspect_ratio' or add a flag
to enable this assumption if the existing functionality should be
kept unchanged. I felt this would be the most sensible thing to do.
I am happy this if there's a more desirable approach to the issue.

Hopefully this and the DAR/SAR reporting fix can be applied before
next release tag. Thanks for considering!

I don't think it's good idea to generally assume 1:1 display_aspect_ratio for every undefined sample aspect ratio. It depends heavily on your actual use case. If MOV/MP4 specifies that 1:1 SAR should be used, then maybe you should fix av_guess_sample_aspect_ratio instead, and return 1:1 there if the format context is MOV/MP4. You may add a demuxer (AVFMT) flag to signal that such behaviour should be used, and av_guess_sample_aspect_ratio can check for that demuxer flag.

Regards,
Marton
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to