From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id B9BEF4C12E for ; Mon, 10 Feb 2025 19:26:29 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A91EA68B3AF; Mon, 10 Feb 2025 21:26:25 +0200 (EET) Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CA5D668B3AF for ; Mon, 10 Feb 2025 21:26:18 +0200 (EET) Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-6f666c94285so42060807b3.3 for ; Mon, 10 Feb 2025 11:26:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739215577; x=1739820377; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=wiQQRP4y/ntDaCE+6AJy27BtQPyZOJRM/4ttQgG8KtM=; b=IzbBGeTlOVN0ssAFCrIaHnuAJtNR45eIznVKsYXTaoyT2RqpnBxRANoeqEGdOO/hKc VWQISXUXziXjECyyQ5UcE8MP8uI/pdJsrYMVBYfoiJ8eOyCr0UBDva38LzUzh5A4po6A 3CU67sFE0AWaH37iNubp6EWIU9EA46+8rdQJi4NwIAQUzwWwJRz+DsHyin5Ta4oGQ2Di G+K8ts1nSIFBUqZQ4jp9rvWg6KiYFePnf9s2vXBVzObIAcTNqmX6+Sk5viEz2p13GMj9 VnpB9OaZNArheghok0hnZp9JSlk0hzPpyG2gxiWg0ibkg5453/xyYGSzviyjZWIsntnZ h6jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739215577; x=1739820377; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wiQQRP4y/ntDaCE+6AJy27BtQPyZOJRM/4ttQgG8KtM=; b=u+z7eSq+fU0sdhzXPi1NHVsB9ar+cgMo873Ca8PMOuG+OEnKN5PcV4mloebbUQV/Ig Uy0fG+c9olHVtIrJmSPh96dBQwMswvjCQyiqxyECPf6Rznk5jnFlQj+Fy85DORO2R4/K n8A0AtXbCSVnGKssaKeQJh4vj707dgw3gnFqXttgMaPxY6TMA9Mchx/7pnUFohMdzjWY DegSrS/f9mJujyDCspkyahfS6Dze1kMhpvEdn1phD4aQJZlJwHep8SPop6w/ErnIZaJO DZlmKON/Zbx10O9ORdSWIebiUXgRgOQ+pLSBBSktIBGIL/0J4pcvvCHhuisiWQ0Mk/k2 mnNw== X-Gm-Message-State: AOJu0YzUHXu/3vQxkA7GpNSvGw9XGJrSzg3T7YxVVHTNqBfsLT3OG7Aq 7mVGZrj1cwecpZ4qrYZMjEIBSY1vgnViv4hhoNDH+Owy7GXoXPcNMpYCtg== X-Gm-Gg: ASbGnctidB84tt+J5l8c5DvEtjTDHrepYq+PUsDVPQDmTGGeeP5EHnawl+GSxFaHRsy t4dEOIovVzO44m6TIxGVQQQ9rkH7wJq1v4vAnsUNTrx5y/6I1cXyHHXpe/JYetDDt8IbUoX9Bz3 izu0vwYZGCaDYvS39uaU9QFg07OXTDqJgRninoLXbjFxg8IPxcfNgcw/9Z3MKMLTcZ48FuSIf1k 0TqZQWYqZCIey+bECEMbNj7zQbh+Dq2PQP1hQoj9xoiVsOIwu+5qz/IZZGNz+tC5/jWyqXecvyH 32GLXcLjAi6kVyYfaRaknrYT0zQXu5LG5rUinwJCixBhR1wdaGnv16E= X-Google-Smtp-Source: AGHT+IG6/45r7s9hsvAm/k9sfGFh/iGa4Cvbuc9SxZf65vXoBXevqrmCnl9yB9FD9wrfCQrjeyK90A== X-Received: by 2002:a05:690c:620d:b0:6f9:8605:ecb5 with SMTP id 00721157ae682-6f9b297ad4dmr141054927b3.28.1739215576545; Mon, 10 Feb 2025 11:26:16 -0800 (PST) Received: from localhost.localdomain ([2607:fb91:fe6:4ec3:28a5:3f0e:2e51:b5ed]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6fafee87110sm4985567b3.15.2025.02.10.11.26.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 10 Feb 2025 11:26:15 -0800 (PST) From: Romain Beauxis To: ffmpeg-devel@ffmpeg.org Date: Mon, 10 Feb 2025 13:25:54 -0600 Message-Id: <20250210192600.42502-1-romain.beauxis@gmail.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 0/5] Properly decode ogg metadata in ogg/flac and ogg/opus chained bitstreams X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Romain Beauxis Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: This is a series of patches to allow proper decoding of ogg metadata in chained ogg/flac and ogg/opus streams. Changes since v3: * Added opus implementation * Cleaned up, separated patches in a more logical way. Summary of code changes: The changes in this patch series allow proper decoding of metadata associated with subsequent streams in chained ogg/flac and ogg/opus bitstream. This is done by intercepting ogg packets with comments in the ogg 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 corresponding decoder and properly added to the first decoded audio frame after the comment packet. 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. Along with the changes are new FATE tests validating the implementation. Discussion and context: ogg/opus is a pretty popular combination of codec and encapsulation. In particular, it is widely used in Icecast streams, where chained streams are the norm because of the ogg specs requirement for inserting in-band metadata. 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 each new metadata, the specs require the logical bitstream to come to a full EOF and then start with a full new logical stream. These specs have often been confused with a gobal EOF by most implementations. Furtunately, FFmpeg is a little better at that in that it is able to parse chained logical ogg bitstreams and properly output either encoded ogg packets or decoded audio. Current limitations with chained ogg streams in FFmpeg include: 1. Metadata from secondary chained ogg/flac and ogg/opus bitstreams are ignored by the demuxer/decoder. 2. Secondary chained streams packet headers are silently removed by the demuxer when decoding ogg/opus streams. 3. No adjustment underlying PTS or DTS: PTS and DTS of secondary chained streams reset from their own logical stream initial value causing timestamp discontinuity. 4. 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 changes in this patch series address issues #1 and #2. Future work could address the remaining issues. Thanks, -- Romain [1]: https://xiph.org/ogg/doc/framing.html Romain Beauxis (6): libavformat/oggparseopus.c: Parse extradata from secondary chained streams header packet. tests: Add stream dump test API util. libavformat/oggparseopus.c: Parse comments from secondary chained ogg/opus streams and pass them as ogg stream new_metadata. tests: Add chained ogg/opus stream dump test. libavformat/oggparseflac.c: Parse ogg/flac comments in new ogg packets, add them to ogg stream new_metadata. tests: Add chained ogg/flac stream dump test. libavcodec/flacdec.c | 20 ++- libavcodec/opus/dec.c | 24 ++++ libavformat/oggdec.c | 4 - libavformat/oggparseflac.c | 28 +++++ libavformat/oggparseopus.c | 25 ++++ tests/Makefile | 3 + tests/api/Makefile | 2 +- tests/api/api-dump-stream-meta-test.c | 169 ++++++++++++++++++++++++++ tests/fate/ogg-flac.mak | 11 ++ tests/fate/ogg-opus.mak | 11 ++ 10 files changed, 291 insertions(+), 6 deletions(-) create mode 100644 tests/api/api-dump-stream-meta-test.c create mode 100644 tests/fate/ogg-flac.mak create mode 100644 tests/fate/ogg-opus.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".