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 v3 0/2] Properly decode ogg metadata in ogg/flac chained bitstreams
@ 2025-02-04 12:31 Romain Beauxis
  2025-02-04 12:31 ` [FFmpeg-devel] [PATCH v3 1/2] Parse and process ogg/flac comments in " Romain Beauxis
  2025-02-04 12:31 ` [FFmpeg-devel] [PATCH v3 2/2] Add stream dump test with test for ogg/flac Romain Beauxis
  0 siblings, 2 replies; 5+ messages in thread
From: Romain Beauxis @ 2025-02-04 12:31 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: epirat07, Romain Beauxis

This is a series of 2 patches to allow proper decoding of ogg metadata
in chained ogg/flac streams.

ogg/flac streams are pretty important because there are perhaps the only
combination of lossless audio codec and open-source container that
allows for proper transmittion of lossless audio data accross systems
such as Icecast, browser media tags and more.

In the context of long-running audio streams, the ogg bitstream specs[1]
have historically been very badly implemented. For each new track and/or
each new metadata, the specs require the logical bitstream to come to a
full EOS and then start with a full new logical stream.

These specs have often been confused with a gobal EOS by most
implementations.

Furtunately, FFmpeg is a little better at that in that it is able to
parsed subsequent chained logical ogg bitstreams and properly output either
encoded ogg packets or decoded audio.

Current limitations with chained ogg streams in FFmpeg include:
* No adjustment underlying PTS or DTS
* Chained bitstreams with more than one underlying type of content
  (audio+video, etc) is not yet supported though this is a much less needed
  feature.

The purpose of the changes in this patch series is to also allow proper
decoding of metadata associated with subsequent streams in chained ogg/flac
bitstream.

This is done by intercepting ogg packets with comments in the
ogg flac demuxer, parsing the comment block and attaching it as
packed AV_PKT_DATA_METADATA_UPDATE side-data.

The new metadata can then be unpacked in the flac decoder and properly
added to the first decoded audio frame after the comment packet.

Along with the changes is a new FATE test validating the implementation.

This solution keeps a proper separation of concerns: ogg packets are
sill output by the demuxer (as shown in the test) but consumer of decoded
data see decoded metadata in the decoded frames.

It is worth noting that is using a mechanism specific to ogg stream that
seemed to only have been used for vorbis streams so far.

Follow-up work not addressed in this series of patch:
* Ensure valid PTS in decoded frames of subsequent streams?
* Generalize this approach to other chained ogg codec.

Thanks,
-- Romain

[1]: https://xiph.org/ogg/doc/framing.html

Romain Beauxis (2):
  libavformat/oggparseflac: Parse ogg/flac comments in new ogg packets,
    add them to ogg stream new_metadata.
  Add stream dump test with test for ogg/flac.

 libavcodec/flacdec.c                  |  20 ++-
 libavformat/oggparseflac.c            |  28 +++++
 tests/Makefile                        |   2 +
 tests/api/Makefile                    |   2 +-
 tests/api/api-dump-stream-meta-test.c | 169 ++++++++++++++++++++++++++
 tests/fate/api.mak                    |   5 +
 tests/fate/ogg-flac.mak               |  11 ++
 7 files changed, 235 insertions(+), 2 deletions(-)
 create mode 100644 tests/api/api-dump-stream-meta-test.c
 create mode 100644 tests/fate/ogg-flac.mak

-- 
2.39.5 (Apple Git-154)

_______________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2025-02-06 17:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-04 12:31 [FFmpeg-devel] [PATCH v3 0/2] Properly decode ogg metadata in ogg/flac chained bitstreams Romain Beauxis
2025-02-04 12:31 ` [FFmpeg-devel] [PATCH v3 1/2] Parse and process ogg/flac comments in " Romain Beauxis
2025-02-04 12:31 ` [FFmpeg-devel] [PATCH v3 2/2] Add stream dump test with test for ogg/flac Romain Beauxis
2025-02-06  3:03   ` Michael Niedermayer
2025-02-06 17:11     ` Romain Beauxis

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