Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 0/2] Interpret a degenerate SAR as 1/1.
@ 2024-07-30 13:11 Giovanni Mascellani
  2024-07-30 13:11 ` [FFmpeg-devel] [PATCH 1/2] avcodec/h2645_vui: " Giovanni Mascellani
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Giovanni Mascellani @ 2024-07-30 13:11 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Giovanni Mascellani

I came across some H.264 files in the wild whose SAR is set to
20480/0. The files are provided by the Ubisoft game OddBallers, and
are seemingly accepted and played properly when the game is played on
Windows (thus using the Microsoft Media Foundations
implementation).

When running the game with Wine the files are ultimately decoded by
libavcodec (via GStreamer), and playback is broken. It seems that only
a frame each second or so (maybe the key frames? I didn't check) is
decoded and presented, the others are discarded. After dumping the
video, I ran it with ffplay and it has the same problem, and the
following message is emitted many times:

  [h264 @ 0x7fd7301ef440] ignoring invalid SAR: 20480/1

Interestingly the invalid SAR is dumped as 20480/1 (which would be
strange, but in princple legal), while the file has 20480/0 (which
doesn't make sense at all). Equally interestingly, the frames that are
presented are indeed presented with SAR 1/1, like they are on Windows.

The H.264 standard says that "When aspect_ratio_idc is equal to 0 or
sar_width is equal to 0 or sar_height is equal to 0, the sample aspect
ratio shall be considered unspecified by this Recommendation |
International Standard". Given the behavior on Windows it seems that
the de facto standard way to solve the missing specification is to
assume that SAR is 1/1, which is what my patches seek to do.

With these patches both Wine and ffplay replay the broken file
correctly.

Since this is my first contributing to ffmpeg and I am not very
experienced in the project architecture, I'm not sure this is the
right abstraction level at which this problem should be handled. If
it's not, I'd be grateful if you could direct me to the appropriate
place.

Giovanni Mascellani (2):
  avcodec/h2645_vui: Interpret a degenerate SAR as 1/1.
  avcodec/evc_ps: Interpret a degenerate SAR as 1/1.

 libavcodec/evc_ps.c    | 4 ++++
 libavcodec/h2645_vui.c | 4 ++++
 2 files changed, 8 insertions(+)

-- 
2.45.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-07-31  9:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-30 13:11 [FFmpeg-devel] [PATCH 0/2] Interpret a degenerate SAR as 1/1 Giovanni Mascellani
2024-07-30 13:11 ` [FFmpeg-devel] [PATCH 1/2] avcodec/h2645_vui: " Giovanni Mascellani
2024-07-30 13:11 ` [FFmpeg-devel] [PATCH 2/2] avcodec/evc_ps: " Giovanni Mascellani
2024-07-30 20:54 ` [FFmpeg-devel] [PATCH 0/2] " Michael Niedermayer
2024-07-30 21:15   ` James Almer
2024-07-30 21:32     ` Michael Niedermayer
2024-07-31  9:43   ` Giovanni Mascellani

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git