[FFmpeg-devel] [PATCH 1/1] [RFC] ffprobe: report DAR even if SAR is undefined

Michael Niedermayer michael at niedermayer.cc
Mon Apr 16 20:40:51 EEST 2018


On Mon, Apr 16, 2018 at 09:06:55AM +0300, Timo Teras wrote:
> On Sun, 15 Apr 2018 16:42:01 +0200 (CEST)
> Marton Balint <cus at passwd.hu> wrote:
> 
> > 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.
> > 
> > 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.
> 
> Looking at code, av_guess_sample_aspect_ratio() is used only in ffplay
> and ffprobe.
> 
> ffplay implicitly assumes undefined SAR is 1:1 to create the playback
> window properly; this happens in calculate_display_rect() when
> "bad" aspect_ratio is reset to 1.0.
> 
> I would expect same logic would have been useful in ffprobe. This would
> help to report back to user what ffplay is going to do with the video.
> Or at least give a hint on how to categorize the clip. SAR 1:1 is
> pretty good guess for most formats.
> 
> For this reason, my preferred solution was to patch ffprobe so we can
> give a guess for all files. If the above patch is not a good idea, how
> about adding new "effective_{sample,display}_aspect_ratio" fields? Or
> just a flag "aspect_ratio_guessed" to tell if it's not defined in the
> file?
> 
> I would prefer not to do any file type specific special handling if
> possible. However, if that's the only acceptable solution, I'm happy to
> implement that too. But then I'd prefer to have a 'no default SAR of
> 1:1' flags so file formats can inhibit the assumption instead of
> explicitly needing to enable it. Is there any formats where this would
> be useful? Or how about just making av_guess_sample_aspect_ratio()
> return 1:1 in case nothing better exists? It's called "guess" after all
> and is used in ffplay/ffprobe only...

unknown is not the same as 1:1
the user (of av_guess_sample_aspect_ratio) may want to know if theres
a 1:1 actually stored in some place or just nothing.

applications like ffplay cannot use "unknown" so they have to pick 1:1
but why is "unknown" a problem for ffprobe if thats how it is ?


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180416/eef79d0e/attachment.sig>


More information about the ffmpeg-devel mailing list