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] Parse ogg/flac header again after processing a new chained ogg bitstream.
@ 2025-01-18 17:53 Romain Beauxis
  2025-01-25  1:40 ` Romain Beauxis
  0 siblings, 1 reply; 4+ messages in thread
From: Romain Beauxis @ 2025-01-18 17:53 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Romain Beauxis

This patch makes sure that ogg/flac headers are parsed again when
encountering a new logic stream inside a chained ogg bistream[1].

This patches makes it possible to retrieve metadata in chained ogg/flac
bitstreams. It is particularly important because ogg/flac is one of the
only (if not the only one) lossless container supported over HTTP/icecast.

The patch has been tested with various ogg/flac encoders and appears to
work fine with ffmpeg.

1: https://xiph.org/ogg/doc/oggstream.html

---
 libavformat/oggdec.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 5339fdd32c..d986e19817 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -239,8 +239,11 @@ static int ogg_replace_stream(AVFormatContext *s, uint32_t serial, char *magic,
     os->start_trimming = 0;
     os->end_trimming = 0;
 
-    /* Chained files have extradata as a new packet */
-    if (codec == &ff_opus_codec)
+    /* Parse opus and flac header on new chained bitstreams.
+     * For opus, header contains required extradata as new packet.
+     * For both formats, this makes it possible to read chained metadata. */
+    if (codec == &ff_opus_codec ||
+        codec == &ff_flac_codec)
         os->header = -1;
 
     return i;
-- 
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] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH] Parse ogg/flac header again after processing a new chained ogg bitstream.
  2025-01-18 17:53 [FFmpeg-devel] [PATCH] Parse ogg/flac header again after processing a new chained ogg bitstream Romain Beauxis
@ 2025-01-25  1:40 ` Romain Beauxis
  2025-01-27 23:25   ` Michael Niedermayer
  0 siblings, 1 reply; 4+ messages in thread
From: Romain Beauxis @ 2025-01-25  1:40 UTC (permalink / raw)
  To: ffmpeg-devel

Hi all!

Le sam. 18 janv. 2025 à 11:54, Romain Beauxis
<romain.beauxis@gmail.com> a écrit :
>
> This patch makes sure that ogg/flac headers are parsed again when
> encountering a new logic stream inside a chained ogg bistream[1].
>
> This patches makes it possible to retrieve metadata in chained ogg/flac
> bitstreams. It is particularly important because ogg/flac is one of the
> only (if not the only one) lossless container supported over HTTP/icecast.
>
> The patch has been tested with various ogg/flac encoders and appears to
> work fine with ffmpeg.

Anybody interested in reviewing/testing the patch? Happy to provide
some streams or you can literally concatenate two ogg/flac files
together.

I know for a fact that it would be very useful to people using ffmpeg
either directly or through its libraries.

Thanks,
-- Romain

> 1: https://xiph.org/ogg/doc/oggstream.html
>
> ---
>  libavformat/oggdec.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
> index 5339fdd32c..d986e19817 100644
> --- a/libavformat/oggdec.c
> +++ b/libavformat/oggdec.c
> @@ -239,8 +239,11 @@ static int ogg_replace_stream(AVFormatContext *s, uint32_t serial, char *magic,
>      os->start_trimming = 0;
>      os->end_trimming = 0;
>
> -    /* Chained files have extradata as a new packet */
> -    if (codec == &ff_opus_codec)
> +    /* Parse opus and flac header on new chained bitstreams.
> +     * For opus, header contains required extradata as new packet.
> +     * For both formats, this makes it possible to read chained metadata. */
> +    if (codec == &ff_opus_codec ||
> +        codec == &ff_flac_codec)
>          os->header = -1;
>
>      return i;
> --
> 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] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH] Parse ogg/flac header again after processing a new chained ogg bitstream.
  2025-01-25  1:40 ` Romain Beauxis
@ 2025-01-27 23:25   ` Michael Niedermayer
  2025-01-29 14:38     ` Romain Beauxis
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Niedermayer @ 2025-01-27 23:25 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 1325 bytes --]

On Fri, Jan 24, 2025 at 07:40:40PM -0600, Romain Beauxis wrote:
> Hi all!
> 
> Le sam. 18 janv. 2025 à 11:54, Romain Beauxis
> <romain.beauxis@gmail.com> a écrit :
> >
> > This patch makes sure that ogg/flac headers are parsed again when
> > encountering a new logic stream inside a chained ogg bistream[1].
> >
> > This patches makes it possible to retrieve metadata in chained ogg/flac
> > bitstreams. It is particularly important because ogg/flac is one of the
> > only (if not the only one) lossless container supported over HTTP/icecast.
> >
> > The patch has been tested with various ogg/flac encoders and appears to
> > work fine with ffmpeg.
> 
> Anybody interested in reviewing/testing the patch? Happy to provide
> some streams or you can literally concatenate two ogg/flac files
> together.
> 
> I know for a fact that it would be very useful to people using ffmpeg
> either directly or through its libraries.

maybe you can add a fate test with a small or generated sample

thx

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

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

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

* Re: [FFmpeg-devel] [PATCH] Parse ogg/flac header again after processing a new chained ogg bitstream.
  2025-01-27 23:25   ` Michael Niedermayer
@ 2025-01-29 14:38     ` Romain Beauxis
  0 siblings, 0 replies; 4+ messages in thread
From: Romain Beauxis @ 2025-01-29 14:38 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Le mar. 28 janv. 2025 à 00:25, Michael Niedermayer
<michael@niedermayer.cc> a écrit :
>
> On Fri, Jan 24, 2025 at 07:40:40PM -0600, Romain Beauxis wrote:
> > Hi all!
> >
> > Le sam. 18 janv. 2025 à 11:54, Romain Beauxis
> > <romain.beauxis@gmail.com> a écrit :
> > >
> > > This patch makes sure that ogg/flac headers are parsed again when
> > > encountering a new logic stream inside a chained ogg bistream[1].
> > >
> > > This patches makes it possible to retrieve metadata in chained ogg/flac
> > > bitstreams. It is particularly important because ogg/flac is one of the
> > > only (if not the only one) lossless container supported over HTTP/icecast.
> > >
> > > The patch has been tested with various ogg/flac encoders and appears to
> > > work fine with ffmpeg.
> >
> > Anybody interested in reviewing/testing the patch? Happy to provide
> > some streams or you can literally concatenate two ogg/flac files
> > together.
> >
> > I know for a fact that it would be very useful to people using ffmpeg
> > either directly or through its libraries.
>
> maybe you can add a fate test with a small or generated sample

Yes!

Took a little more work because you need to dump it from the AVStream
but I got a test program ready and hooked up for it, will send an
updated patch right now.

-- 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".

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

end of thread, other threads:[~2025-01-29 14:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-18 17:53 [FFmpeg-devel] [PATCH] Parse ogg/flac header again after processing a new chained ogg bitstream Romain Beauxis
2025-01-25  1:40 ` Romain Beauxis
2025-01-27 23:25   ` Michael Niedermayer
2025-01-29 14:38     ` 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