From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS6130 216.105.38.0/24 X-Spam-Status: No, score=-3.6 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 4A9791F47D for ; Sun, 26 Feb 2023 00:38:05 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sourceforge.net header.i=@sourceforge.net header.a=rsa-sha256 header.s=x header.b=K9WUAH5k; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sf.net header.i=@sf.net header.a=rsa-sha256 header.s=x header.b=Yl1fQ0rL; dkim-atps=neutral Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1pW52v-0003QI-Uc; Sun, 26 Feb 2023 00:37:45 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pW52s-0003QC-3t for sox-users@lists.sourceforge.net; Sun, 26 Feb 2023 00:37:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Cdpz7Jr6O47CW1XCy43Hb9/DKr0SKQx9KvgoThajHPw=; b=K9WUAH5km7bA1KAzUcVFXGpJ97 IOkr+bAAf8gWsqG+zQtjIqFaF0gt6mS6SLrSEQ6lzdFfEVhF/l8eITGsVlAbX91nKF96tOO2to2Bb rF0kXHMeJKA11VGy8hImUZSD6ibho0zqh4bUL+hoskyIqI9IawKRZyMXd83G3Fgj03Qs=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=Cdpz7Jr6O47CW1XCy43Hb9/DKr0SKQx9KvgoThajHPw=; b=Y l1fQ0rLWIyiW7LxdJIpDPSMVMiBOFIZbO8X1Sne2j7/NtZ7D+/oI7ot5M4v8PvgJD6g3INztM4T/O IH6ruWXP3LD7CJPnH/xg5rfNKdIJcnl4e6SN2AX5ywOYOtTzWNBJiGzHJVC71mv2vxBGTA1xO4rHH WFfvxFwnymSgt204=; Received: from uvt.stare.cz ([185.63.96.79] helo=mx.stare.cz) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1pW52p-0007cx-5l for sox-users@lists.sourceforge.net; Sun, 26 Feb 2023 00:37:41 +0000 Received: from localhost (stare.cz [local]) by stare.cz (OpenSMTPD) with ESMTPA id 0675fccc; Sun, 26 Feb 2023 01:37:29 +0100 (CET) Date: Sun, 26 Feb 2023 01:37:29 +0100 From: Jan Stary To: sox-users@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <6s29gK5drQTAbb6c6x9z9zT5z6IVBkqGdU3mDr_rzk2-Lwth__JIis-Fj4tVTdINxTtCZou4ZPluTUmIc-s3q0c8VjGAAvy_VEBNnqqA-zY=@protonmail.com> X-Headers-End: 1pW52p-0007cx-5l Subject: Re: discrepancy between sox and ffmpeg when extracting parts of flac file X-BeenThere: sox-users@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sox-users@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: sox-users-bounces@lists.sourceforge.net Please try to trim the lines of your emails (including the Subject) so that they fit to 80 chars for those reading this in a terminal. On Feb 25 13:32:37, sox-users@lists.sourceforge.net wrote: > I have a large flac file (24bits 96kHz) A.flac containing several songs. > I can extract those bei using either sox (B.flac) or ffmpeg (C.flac) > with the same splitting points: > > sox T04.flac B.flac trim 22:26.342 =34:41.708 > ffmpeg -i T04.flac -ss 22:26.342 -to 34:41.708 -compression_level 12 -c copy C.flac You are not just _extracting_ a portion of A.flac, you are also _encoding_ the extracted portion into flac, with two different encoders. What happens if you extract into wav files? > Unfortunately, the results seem to differ in important aspects: That shouldn't be a surprise. > - C.flac that is larger (despite using "-compression_level 12") > - soxi C.flac as well as ffprobe C.flac shows the wrong lengh, > namely the length of A.flac You mean T04.flac; so you are not showing us the actual commands, or their actual output. Use script(1) to show what actually happened. The -ss and -to should probably come before -i to specify the portion of the _input_ you want: -ss position (input/output) When used as an input option (before "-i"), seeks in this input file to position. -to position (input/output) Stop writing the output or reading the input at position. Perhaps you re-encoded the whole A.flac into C.flac, that's why they have the same length. > - soxi B.flac and ffprobe B.flac show the correct length The sox line above is correct, extracting what you wanted. On Feb 25 22:33:04, sox-users@lists.sourceforge.net wrote: > ffmpeg: 4.4.3 > sox: 14.4.2_p20210509-r2 It's not a matter of versions; they are two different encoders, and different encoders encode differently, and your ffmpeg line is wrong. Fix the extraction command first, and extract into wav with both. Those outputs should be (almost) identical. > T04.flac and A.flac are indeed the same file, I forgot to adjust > the name in my original post. Right. > B.flac has size 147,664,506, C.flac has been deleted but was in the > region of 160,000,000. I don't believe that: you say C.flac has the same length as A.flac, which is a collection of songs, and B.flac is just the one song. Yet these sizes differ by about 13M out of 160M, less than 10%. > Re-encoding C.flac (sox C.flac CC.flac) This has nothing to do with your problem. > A.flac had been extracted from A.mkv by means of ffmpeg; Doesn't matter: A.flac is the starting point for both the sox extraction and the ffmpeg extraction. How you got A.flac has nothing to do with it. > I don't think sox can do that. SoX is an audio tool, it doesn't know anything about mkv files. > I needed A.flac to determine the splitting points (using audacity). You needed A.flac so that you have a file which both ffmpeg and sox can read n the first place. > Now that I know the splitting points, I'll try to extract C.flac > directly from A.mkv using ffmpeg. No. Only ffmpeg can extract form a mkv file, SoX cannot. If the source isn't the same, what are you even comparing? > As far as I know, I cannot do that with sox, though. Exactly. > However, I need to re-create A.mkv first No you don't: you already have A.flac which you can feed to both sox and ffmpeg. I suspoect the whole problem is that your ffmpeg line is wrong. Jan _______________________________________________ Sox-users mailing list Sox-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sox-users