Bug#550814: mp3splt: Is not lossless

2009-10-14 Thread Alexandru Munteanu
Hello,

I am the current maintainer of the mp3splt-project.
Thank you for reporting the issue.

It all depends of what 'lossless' means in this process.

If 'lossless' means a reversible operation, then mp3splt is lossless.
The reversible action of splitting is 'joining' (where concatenation is a
special join). In this case, we only need to compare the concatenation of
the split files with the original file:

  1) ID3 removal
  
  $ sha1sum ~/Desktop/Intro.mp3
  d22b3453b853419d3421e9993af8529388e03321  /home/ion/Desktop/Intro.mp3
  
  $ cp ~/Desktop/Intro.mp3 .
  
  $ id3v2 --delete-all Intro.mp3
  Stripping id3 tag in Intro.mp3...id3v1 and v2 stripped.
  
  $ eyeD3 Intro.mp3
  
  Intro.mp3   [ 3.58 MB ]
  
---
  Time: 03:55 MPEG1, Layer III[ 128 kb/s @ 44100 Hz - Stereo ]
  
---
  No ID3 v1.x/v2.x tag found!
  
  2) Mp3splt split process
  
  $ ./old_mp3splt -o intro-pa...@n -f -n Intro.mp3 0.00.00 1.00.00 EOF
  Mp3Splt 2.1c (2005/Apr/03) by Matteo Trotta matteo.tro...@lib.unimib.it
  THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!
  MPEG 1 Layer 3 - 44100 Hz - Stereo - FRAME MODE
50 % - Splitting Intro-part_1.mp3... OK
   100 % - Splitting Intro-part_2.mp3... OK (EOF)
  Processed 8982 frames - Sync errors: 0

  3) Reverse operation (concatenation)
 
  $ cat Intro-part_1.mp3 Intro-part_2.mp3  concatenated_Intro.mp3

  4) Compare original with the reversed operation result

  $ diff Intro.mp3 concatenated_Intro.mp3

 Files are binary equal. 
 
In your example, you are playing the first split file, then the second one.
This process is not the same as playing the concatenation of the two files,
due to the 'bit reservoir' issue:
  http://wiki.hydrogenaudio.org/index.php?title=Bit_reservoir
  
http://sourceforge.net/tracker/?func=detailaid=1004605group_id=55130atid=476061

-- 
Alexandru Munteanu




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#550814: mp3splt: Is not lossless

2009-10-13 Thread J.P. Larocque
Package: mp3splt
Version: 2.1c-4
Severity: normal

mp3splt is apparently not lossless.  The concatenation of the decoding
(with madplay) of a sequence of split MP3 files varies from the
decoding of the original MP3.

The manual page describes the operations that mp3splt does as without
decoding.  To me, that implies a lossless (reversible) operation.  If
mp3splt is not designed to be lossless, and the author has no interest
in implementing lossless splitting, please be clear about the lossy
nature of mp3splt in the manual and package description.

If mp3splt is intended to be lossless, please read on to my
description of how to reproduce the problem.


Step 1: I found a random free MP3 file that matches my original
problem file in terms of technical characteristics.  It is 3.58MB and
can be downloaded from:

  http://www.archive.org/download/Body/Intro.mp3

For reference, this is the SHA-1 I have of the file:
d22b3453b853419d3421e9993af8529388e03321

This file is a CBR 128kb/s MPEG 1 Layer III audio file, according to
mp3val and mpg321.

Step 2: To avoid complications with ID3 tags, I removed them (using
id3v2 version 0.1.11-3).

$ id3v2 --delete-all Intro.mp3

Step 3: I split the MP3 into two pieces: from the beginning to the
1-minute point, then from the 1-minute point to the end.  (I used
mp3splt version 2.1c-4.)

$ mp3splt -o intro-pa...@n -f -n Intro.mp3 0.00.00 1.00.00 EOF
Mp3Splt 2.1 (2004/Sep/28) by Matteo Trotta matteo.tro...@lib.unimib.it
THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!
MPEG 1 Layer 3 - 44100 Hz - Stereo - FRAME MODE
  50 % - Splitting Intro-part_1.mp3... OK
 100 % - Splitting Intro-part_2.mp3... OK (EOF)
Processed 8982 frames - Sync errors: 0

Step 4: I took the SHA-1 digest of the raw-format decoding of the
original MP3 file.  (I used madplay version 0.15.2b-5 and libmad0
version 0.15.1b-4.)

$ madplay -o raw:- Intro.mp3 | sha1sum
MPEG Audio Decoder 0.15.2 (beta) - Copyright (C) 2000-2004 Robert Leslie et al.
8981 frames decoded (0:03:54.6), -0.1 dB peak amplitude, 0 clipped samples
591d33ff3b03a3e6ac2b446c77692814dcde54c1  -
[SHA-1 digest shown will be different on big-endian machines.]

Step 5: I decoded the two split MP3 files in sequence, concatenating
the raw-formatted results, and took the SHA-1 digest of that:

$ madplay -o raw:- Intro-part_*.mp3 | sha1sum
MPEG Audio Decoder 0.15.2 (beta) - Copyright (C) 2000-2004 Robert Leslie et al.
 Intro-part_1.mp3
2296 frames decoded (0:00:59.9), -0.9 dB peak amplitude, 0 clipped samples
 Intro-part_2.mp3
6683 frames decoded (0:02:54.5), -0.1 dB peak amplitude, 0 clipped samples
ed2c7674577bbfc9b3fe01f8782c0c39111e08dd  -
[SHA-1 digest shown will be different on big-endian machines.]

The digest from step 4 should match the digest from step 5.  It does
not.  This indicates to me that, unless there is an error in
madplay or libmad0, mp3splt is not losslessly splitting the MP3 file.

Note that the sum of the number of frames decoded in step 5 is 8979,
which is two less than the number of frames decoded in step 4.  I
don't know enough about the MP3 format and the implementation of
mp3splt to know whether this itself indicates a problem, but it's
worth pointing out.


I've also reproduced the same result (a mismatch of digests) with
another decoder (mpg123 version 1.4.3-4 and libmpg123-0 version
version 1.4.3-4):

$ mpg123 --stdout Intro.mp3 |sha1sum
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
version 1.4.3; written and copyright by Michael Hipp and others
free software (LGPL/GPL) without any warranty but with best wishes

Playing MPEG stream 1 of 1: Intro.mp3 ...
MPEG 1.0 layer III, 128 kbit/s, 44100 Hz stereo

[3:54] Decoding of Intro.mp3 finished.
7a0135949b5f3340ccb1a0894fde174297a404fd  -
$ mpg123 --stdout Intro-part_*.mp3 |sha1sum
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
version 1.4.3; written and copyright by Michael Hipp and others
free software (LGPL/GPL) without any warranty but with best wishes

Playing MPEG stream 1 of 2: Intro-part_1.mp3 ...
MPEG 1.0 layer III, 128 kbit/s, 44100 Hz stereo

[0:59] Decoding of Intro-part_1.mp3 finished.

Playing MPEG stream 2 of 2: Intro-part_2.mp3 ...
MPEG 1.0 layer III, 128 kbit/s, 44100 Hz stereo

[2:54] Decoding of Intro-part_2.mp3 finished.
4a2c0e1800ba1a436e98b7a3b482fbb5a6182e02  -
[SHA-1 digests shown will be different on big-endian machines.]


That about wraps it up.  If you have questions, please get in touch.
Thanks for looking at this,

-- System Information:
Debian Release: 5.0.3
  APT prefers stable
  APT policy: (700, 'stable'), (650, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages mp3splt depends on:
ii  libc6 2.9-25 GNU C Library: Shared libraries
ii  libmad0   0.15.1b-4  MPEG