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 ESMTP id 83810449F7 for ; Mon, 31 Oct 2022 18:34:07 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9DCDB68BE20; Mon, 31 Oct 2022 20:34:04 +0200 (EET) Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9CA9E68BD55 for ; Mon, 31 Oct 2022 20:33:57 +0200 (EET) Received: by mail-lj1-f175.google.com with SMTP id s24so17747055ljs.11 for ; Mon, 31 Oct 2022 11:33:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=/vNJBoSe93uua46en6PEADHamNRNvt17x66QMZNFYsg=; b=P402jsWQAR7aiJSS1w9EGM+iakw2dpxq/ztWtmd2IesObSAbP+2m8aqmrD2GsOZ7Z/ o18ZvJ13vZlbrMZSriQcPIA83BiDRSbZqH6GchOX7XKeMHOjmXjlKkvvPMatw5ZzvWxx e0cMTVe4LbgxLaKeaAJE0jAQ+zEMlEcHk+/uw7zkDAXbwlWfM6RKa6MgkYhIUR/Iy+Rl 6i0YU+u9b38zy9YgeEIra2w4P1fH5QtpRSaVeI5QHWSJelkFHGOlNt4knxXLFnEOuke1 F8iROi1HhVAKYhXk6MQPpe4/U4gVH3NNN3Q0s89HPqORfmujgvqPjqa6xj2yJsv4P2mt 1SdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/vNJBoSe93uua46en6PEADHamNRNvt17x66QMZNFYsg=; b=8Lim6J0kD5+QjubFl4PMzuyi0/p9cNm45PH3FygoJVjUd9ztUluI8vwUL4Quimq7xV Jesip0h+TO7dbIGxtcy1mIIQlqwBVPgTFADWcDbxXQB3OX6UA97qQmY3yxqT14n0e4ko gY8bEO6Zh5QF6eXI+AncH3yKaBvpMDWjfAfan04pUGnHA/DU3dBmVKPINFsdFAlkV8Vk T1G7d2pzdUUAxz+V/D0MeS6mUqsVndznJE7xMwiq9QqJ2DHWNVAgrdmpTPRH73/gSJtr HLm2MWtYz5aAdzDaJcXLMvA+/kGda/R1UfevDvrgR5/aC0wmTPOpbvrx1WqDhTASrUDT 4hHQ== X-Gm-Message-State: ACrzQf18rCGzbgZ9997kpTjSJ6c0xC9hhEt7c1cA1jQT4v4veryx/zP2 fEDwmptS2gYDxuB21rm0azCI627p1bxnAQp8Kt9afrHwGTw= X-Google-Smtp-Source: AMsMyM6M/7Vks0JLKe+4XbXTBC2KWQVdQyQkxvV6JYM5/lIiMF2SHiiGVZUMlIH/OBM6SPoB+ntdXAD62Lh4xeCifoI= X-Received: by 2002:a05:651c:11c5:b0:277:2ff5:ee1 with SMTP id z5-20020a05651c11c500b002772ff50ee1mr6348905ljo.515.1667241236363; Mon, 31 Oct 2022 11:33:56 -0700 (PDT) MIME-Version: 1.0 References: <20221031160915.673782-1-mvanb1@gmail.com> In-Reply-To: From: Martijn van Beurden Date: Mon, 31 Oct 2022 19:33:41 +0100 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH] libavcodec/flacenc: Enable sample rates > 655350 Hz 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 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: Op ma 31 okt. 2022 om 17:58 schreef Derek Buitenhuis : > > It is interesting that the IETF RFC and the Xiph spec disagree on whether this is allowed. > The Xiph spec also says the IETF spec is better, and it remains as historical reference and overview :) > The Xiph spec says: > > Sample rate in Hz. Though 20 bits are available, the maximum sample rate is limited by the > structure of frame headers to 655350Hz. Also, a value of 0 is invalid. > > The RFC just says: > > Sample rate in Hz. > The spec as it is on the FLAC website (which is being "preserved") is wrong. I don't know how this came to be, I think it was at first poorly worded and later incorrectly fixed. See this commit: https://github.com/xiph/flac/commit/96534bb5f35eb9c2f6f393dc470625e9c74df1a5 The text as it was before that commit doesn't make any sense, the text as it is after the commit is not correct either. The issue here is that FLAC has a sample rate in the streaminfo metadata block, at the very start of the file. That one can accommodate sample rates up to 2^20-1. The frame headers repeat the sample rate every frame and can only accommodate up to 655350Hz, but they can also reference the streaminfo metadata block. Because of the possibility to reference that 20 bit number, it is possible to store sample rates up to 1048575Hz. You can see this patch only touches the encoder: the FFmpeg decoder has already been equipped to deal with this since its inception in 2004. There is some kind of limitation to sample rates above 655350Hz, or samplerates between 65535Hz and 655350Hz that are not a multiple of 10 though: a FLAC file with such a sample rate cannot be multicast, because a decoder receiving a multicast stream does not receive the streaminfo metadata block, and thus cannot use it to figure out the correct sample rate. Please let me know when this explanation falls short. Kind regards, Martijn van Beurden _______________________________________________ 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".