OT: Command line mp3 and wma cutting?

16 views
Skip to first unread message

Fernando Cassia

unread,
Dec 17, 2009, 10:31:14 AM12/17/09
to neu...@googlegroups.com
Is anyone aware of any command line tool for cutting mp3 and/or WMA
files from the command line?
It should operate at the disk (file) level, without loading the whole
file into memory.

I have a 450MB+ wma file that, when loaded into Goldwave, is
apparently extracted to uncompressev wav taking several gigabytes of
hard disk space, and leaving me without disk space on this space
constrained laptop.

I need to cut just the last quarter of the file.

I tried using a file splitter (HJSplit for Java) but then Goldwave
doesn't know what file type the last fourth segment is.

I thought " hey, it should be a matter of reading the first few bytes
of the file header, then paste that into the segment cut" but then I
looked on Google and found that WMA is actually an ASF file containing
the sound data IN THE HEADER.

What a bloody mess...

So before I give up. Any ideas?

FC

Anthony DeRobertis

unread,
Dec 17, 2009, 10:42:25 AM12/17/09
to neu...@googlegroups.com
On Thu, Dec 17, 2009 at 12:31:14PM -0300, Fernando Cassia wrote:
> Is anyone aware of any command line tool for cutting mp3 and/or WMA
> files from the command line?

cutmp3, quelcom

I think there is a third, but "apt-cache search mp3 cut" didn't find it.

--

Vladimir Pantelic

unread,
Dec 17, 2009, 11:27:59 AM12/17/09
to neu...@googlegroups.com
Fernando Cassia wrote:

> I thought " hey, it should be a matter of reading the first few bytes
> of the file header, then paste that into the segment cut" but then I
> looked on Google and found that WMA is actually an ASF file containing
> the sound data IN THE HEADER.

no, WMA is an ASF file containing the sound data in the ASF data, not the header.
so, its a regular ASF file with audio only.

> What a bloody mess...

no.

> So before I give up. Any ideas?

to edit WMA/ASF files you need a sw that can read and write ASF format, e.g. ffmpeg

Stelios Valavanis

unread,
Dec 17, 2009, 11:28:22 AM12/17/09
to neu...@googlegroups.com
check out sox.

--
_____________________________________________
stel valavanis http://www.onshore.com/

Anthony DeRobertis

unread,
Dec 17, 2009, 12:09:10 PM12/17/09
to neu...@googlegroups.com
On Thu, Dec 17, 2009 at 10:28:22AM -0600, Stelios Valavanis wrote:
> check out sox.

I'm pretty sure sox will do a decode/encode cycle, reducing quality...

However, to add two more to my list ffmpeg (as someone else said) and
probably mencoder as well.
--

Fernando Cassia

unread,
Dec 17, 2009, 1:17:01 PM12/17/09
to neu...@googlegroups.com
On Thu, Dec 17, 2009 at 1:27 PM, Vladimir Pantelic
<p...@nt.tu-darmstadt.de> wrote:
> Fernando Cassia wrote:
>
>> I thought " hey, it should be a matter of reading the first few bytes
>> of the file header, then paste that into the segment cut" but then I
>> looked on Google and found that WMA is actually an ASF file containing
>> the sound data IN THE HEADER.
>
> no, WMA is an ASF file containing the sound data in the ASF data, not the header.
> so, its a regular ASF file with audio only.
>
>> What a bloody mess...
>
> no.
>
>> So before I give up. Any ideas?


Sorry, apparently I misread from here:

-------------------------------------------------------------------------------------------------------
* From: "Alessandro Angeli" <nobody@xxxxxxxxxxxxxxxxxx>
* Date: Mon, 25 Aug 2008 11:38:23 -0400
From: "lokeswara"

what is the header size of WMA file. Is it varies from
file to file or fixed? If varies, then what is range of


The WMA header size varies and can range from a few dozen
bytes to several megabytes, depeding on the content (e.g.
the metadata is stored in the header).
(...)
A WMA file is an ASF file that contains WMA audio. You can
read everything about the ASF file header in the public ASF
specification:

www.microsoft.com/asf

--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
-------------------------------------------------------------------------------------------------------

So I misread the statement that the header "can be a few bytes to a
few megabytes" due to the inclusion of metadata... I somehow thought
it meant the sound data was embedded into the header.

http://www.tech-archive.net/Archive/Media/microsoft.public.windowsmedia.sdk/2008-08/msg00080.html

Thanks everyone for their suggestions.
Right now, I think getting oggtools, to convert wma to ogg, (and
compiling it into a win32 version with cygwin) is going to be my best
bet... once the audio file is in ogg, I can use oggcut from oggtools
...

Thanks,
FC

Fernando Cassia

unread,
Mar 5, 2010, 9:42:37 AM3/5/10
to neu...@googlegroups.com
Well, three months later I found a command-line wma file cutter that is able to extract fragments of a file without re-encoding into another format....

It´s a command-line tool dubbed "ASFbin" and despite its name can work on WMA as well as .asf files.

It´s available for Windows and Linux. It´s freeware.

http://www.radioactivepages.com/index.php?docid=asfbin&section=software

Win32
http://www.radioactivepages.com/download/asfbin/asfbin1.7.14.756.zip

Linux x86
http://www.radioactivepages.com/download/asfbin/asfbinlinux1.7.1.756.zip

Sadly, I´d love for it to be GPL, but it´s not. So no chance of getting it to run on the OSD or ARM devices. Yet, it´s much better for me to cut large wma files than using any of the available GUI tools...

I´m just replying in case someone stumbles upon this mailing list thread after a Google search...


FC
--
Dream of the Daily Mail
It is the Holy Grail
And then the BBC
Your life would be complete

-Manic Street Preachers, "Royal Correspondent"
Reply all
Reply to author
Forward
0 new messages