Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Romain Beauxis <romain.beauxis@gmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: Marvin Scholz <epirat07@gmail.com>, Lynne <dev@lynne.ee>,
	Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: Re: [FFmpeg-devel] [PATCH v2] ogg/vorbis: implement header packet skip in chained ogg bitstreams.
Date: Mon, 11 Aug 2025 19:21:51 -0500
Message-ID: <CABWZ6OR2gDoSAAOrrcvgvV0OX7b1xwzR=RtrkTj8gMGWwiV_Sg@mail.gmail.com> (raw)
In-Reply-To: <CAAhd_PV7R1v5DVXb9fh97vsDd0rO7671Ku-nOjPVy=MdMworMg@mail.gmail.com>

Le lun. 11 août 2025 à 17:31, Yalda <marth64@proxyid.net> a écrit :
>
> Hi Romain,

Hi!

> I can try to help out here.
> I am not familiar with the OGG spec but I can at least help with
> reviews/facilitate to a degree, and it's free so I can read if needed.
>
> It seems you are trying to fix issues in and improve OGG support.
> Can you give me a brief summary of your goals?
> (i.e. what should I look at first to assist?)

Great, thank you so much for taking the time.

Got the current work, I would like to improve ffmpeg support for ogg
stream chaining.

# Ogg chaining

The documentation for this feature is here:
https://xiph.org/ogg/doc/oggstream.html

Ogg stream chaining is used in particular to send a sequence of
tracks. Each time a track ends, the current bitstream is terminated
and a new one created. This is also required to pass in-band metadata.

In practice, ogg chaining works pretty much like concatenating ogg files.

Historically, this spec has proven to be a pretty bad design. There
are very few tools handling this properly. Most of them treat the end
of the first logical bitstream as an end of file.

However, and furthermore unfortunately, ogg is still pretty popular
for audio streaming, especially using icecast. In particular it is the
only container that currently supports lossless codec (flac) with
in-band metadata.

# In ffmpeg

In ffmpeg, support for chained streams is essentially missing. In the
following, I'm talking about the state of the code before I started
working on it.

1- Most decoders are able to keep decoding after the first logical
bitstreams. However, in most cases, secondary and later metadata are
lost.

2- The demuxer outputs ogg header packets as ffmpeg packets from
secondary and further streams. These packets should be suppressed by
the demuxer and instead passed as extradata.

3- PTS and later DTS of secondary and further streams are
discontinuous: they restart from their initial value.

4- It is currently not possible to do a ffmpeg -c copy copy of
sequentialize ogg streams.

I'm trying to fix those 4 points.

The work that I have been doing has been focused on the most popular
codecs, namely opus, flac and vorbis. I'm happy to extend to more but,
at this point, I'd consider all the other one as deprecated
personally.

Issue #1 is partially addressed with some patches current in the code
base and some patches pending.

But, first, I'd like to focus on issue #2 because it is almost complete.

Currently, issue #2 has been addressed by a series of patches reviewed
and merged by Michael and Lynne.

2431fd0b275: introduce a dump utility to track and check changes to
the bitstreams on each patch
6d54af6599 and a9d39d6eb9: change the meaning of ogg_codec->packet
return value of 1 to make it possible to direct the demuxer to skip
some decoded packets

At this point, the stage is ready to start skipping ogg header packets:
2fb6416dd0: skip ogg header packets in ogg/flac streams
9c5ed57f94: skip ogg header packets in ogg/opus streams
574f634e49: skip ogg header packets in ogg/vorbis streams

The last one was clearly erroneous and reverted by Andreas Rheinhardt

The PR here: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20026 is the
fixed version, following Andreas Rheinhardt feedback.

The fixed patch packs all 3 vorbis header into a bytestream structure,
passes it as extra data and uses it on the decoder side.

Following Michael's review, support for demuxed ogg headers is kept as
legacy in case libavcodec is linked with an older version of
libavformat.

A new decoding routine is added to handle the new extradata-based
header packets.

Let me know if that is enough information for you to help and thanks again!
-- Romain
_______________________________________________
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".

  reply	other threads:[~2025-08-12  0:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-04 16:58 Romain Beauxis
2025-06-10 18:04 ` Romain Beauxis
2025-06-12 11:35   ` Michael Niedermayer
2025-06-14 10:39     ` Romain Beauxis
2025-06-14 22:57 ` Michael Niedermayer
2025-06-21  8:45   ` Romain Beauxis
2025-06-21 21:59     ` Michael Niedermayer
2025-07-23 19:06       ` Romain Beauxis
2025-07-28  0:22         ` Michael Niedermayer
2025-07-28 21:12           ` Romain Beauxis
2025-08-03 21:36             ` Michael Niedermayer
2025-08-03 22:50               ` Romain Beauxis
2025-08-04  0:11                 ` Michael Niedermayer
2025-08-04  0:19                   ` Kieran Kunhya via ffmpeg-devel
2025-08-04 10:53                     ` Nicolas George
2025-08-04  8:21                   ` Michael Niedermayer
2025-08-04 15:59                     ` Romain Beauxis
2025-08-11 22:31                       ` Yalda
2025-08-12  0:21                         ` Romain Beauxis [this message]
2025-08-12  0:23                           ` Romain Beauxis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABWZ6OR2gDoSAAOrrcvgvV0OX7b1xwzR=RtrkTj8gMGWwiV_Sg@mail.gmail.com' \
    --to=romain.beauxis@gmail.com \
    --cc=andreas.rheinhardt@outlook.com \
    --cc=dev@lynne.ee \
    --cc=epirat07@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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