Using sox as an alternative to mp3wrap to losslessly concat a dir full of mp3s?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Using sox as an alternative to mp3wrap to losslessly concat a dir full of mp3s?

digitaltoast
I wanted to combine all mp3 files into one in each directory using
Ubuntu command line.

I started using a thing called MP3Wrap
(https://sourceforge.net/projects/mp3wrap/)

It was as simple as

mp3wrap -v "wrapped.mp3" ./*.mp3

except it turns out to horribly break id3 tags, doesn't recognise vbr
properly etc.

Is there are way of losslessly concatenating mp3 files with sox, or is
it a job for another tool?

I know about "--combine concatenate", but that seems to re-compress the files.

(The ability to unwrap the combined mp3 into individual files isn't a
requirement, but it would be a nice thing if possible!)

Thanks

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Using sox as an alternative to mp3wrap to losslessly concat a dir full of mp3s?

Jeremy Nicoll - ml sox users
On 2017-07-18 21:52, Jonathan H wrote:

> I wanted to combine all mp3 files into one in each directory using
> Ubuntu command line.
>
> I started using a thing called MP3Wrap
> (https://sourceforge.net/projects/mp3wrap/)
>
> It was as simple as
>
> mp3wrap -v "wrapped.mp3" ./*.mp3
>
> except it turns out to horribly break id3 tags, doesn't recognise vbr
> properly etc.
>
> Is there are way of losslessly concatenating mp3 files with sox, or is
> it a job for another tool?
>
> I know about "--combine concatenate", but that seems to re-compress the
> files.
>
> (The ability to unwrap the combined mp3 into individual files isn't a
> requirement, but it would be a nice thing if possible!)

This last bit worries me.  I don't see how that would be possible unless
some sort
of marker was placed between the n'th and (n+1)'th file.  But then, it'd
cause some
sort of horrible sound when you played the file... if indeed you ever
intend to play
such a file...

Why would you do this?

If you just want the binary content merged into one long file, surely a
normal file
copy/append would do?  Or you could zip the set of files into one file.

--
Jeremy Nicoll - my opinions are my own

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Using sox as an alternative to mp3wrap to losslessly concat a dir full of mp3s?

Måns Rullgård
Jeremy Nicoll - ml sox users <[hidden email]> writes:

> On 2017-07-18 21:52, Jonathan H wrote:
>> I wanted to combine all mp3 files into one in each directory using
>> Ubuntu command line.
>>
>> I started using a thing called MP3Wrap
>> (https://sourceforge.net/projects/mp3wrap/)
>>
>> It was as simple as
>>
>> mp3wrap -v "wrapped.mp3" ./*.mp3
>>
>> except it turns out to horribly break id3 tags, doesn't recognise vbr
>> properly etc.
>>
>> Is there are way of losslessly concatenating mp3 files with sox, or is
>> it a job for another tool?
>>
>> I know about "--combine concatenate", but that seems to re-compress
>> the files.
>>
>> (The ability to unwrap the combined mp3 into individual files isn't a
>> requirement, but it would be a nice thing if possible!)
>
> This last bit worries me.  I don't see how that would be possible
> unless some sort of marker was placed between the n'th and (n+1)'th
> file.  But then, it'd cause some sort of horrible sound when you
> played the file... if indeed you ever intend to play such a file...

It could be done by wrapping all the files in an MP4 container with a
suitable edit list.

> If you just want the binary content merged into one long file, surely
> a normal file copy/append would do?  Or you could zip the set of files
> into one file.

MP3 streams can be simply concatenated, but first you must remove any
ID3 tags and VBR indexes (Xing header).  I suppose that's what mp3wrap
does.

--
Måns Rullgård

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: Using sox as an alternative to mp3wrap to losslessly concat a dir full of mp3s?

Fmiser
In reply to this post by digitaltoast
> Jonathan wrote:

> I wanted to combine all mp3 files into one in each directory
> using Ubuntu command line.
>
> I started using a thing called MP3Wrap
> (https://sourceforge.net/projects/mp3wrap/)

> except it turns out to horribly break id3 tags, doesn't
> recognise vbr properly etc.
>
> Is there are way of losslessly concatenating mp3 files with sox,
> or is it a job for another tool?

SoX decodes as the first step - so it will not losslessly
concatenate MP3 files.

ffmeg can do it, though.  Something like:
ffmpeg -i "concat:file1.mp3|file2.mp3" -c copy output.mp3

or create a text file with one source file per line like this:
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'

 and this command:
ffmpeg -i list-of-files.text -c copy output.mp3

> (The ability to unwrap the combined mp3 into individual files
> isn't a requirement, but it would be a nice thing if possible!)

If you document the timing (length) of the source files, mp3split
should be able to be used to separate them again.  But it is not a
built-in feature like it is with mp3wrap.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users