Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Extracting WMA channels (Read 6017 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Extracting WMA channels

Hello!

I have an iRiver E100 that is capable of recording audio from its built-in microphone, external microphone and line-in. Most of the time I make recordings with its built-in one which is mono, though the format it's recording is a Stereo WMA, 192kbps and it's a waste of disk capacity, since both audio tracks contain the same material. There is no option adjusting the channels for recording.

I'm looking for a (command line if there's one) tool that can extract one channel from a WMA file and save to another. For instance my 192kbps WMAs consist two 96kbps WMA audio streams, one for each channel (2). I'd like to extract one of these channels to a new file, that'd be Mono and 96 kbps.

I'm pretty sure that audio channels are stored somehow separately. For example, I have a recording, speech-of-my-friend-in-the-school.wma that is 11 682 672 in bytes and 8:04 long (484 seconds). At 192kbps a 484 seconds long audio clip would be (192000*484)/8 = 11 616 000 bytes which is almost the same as the real size (maybe there are more frames than exactly 484 seconds and the real bitrate doesn't end with 000, there's a header, that's why the real size is bigger), so I don't think it spares disk space by summing/differencing audio tracks, because in this case the size should be around half as big as a conventional 192kbps clip.

I have WinAmp and audio editing softwares, but I would not like to convert my clips. I could downmix them and convert them using ffmpeg/lame/etc. but this will result in the loss of quality. The only option for me is copying one channel and saving it as a mono-channel WMA.

Tried using AsfBin, but couldn't figure out how to separate a stereo audio tracks into two mono channels without re-encoding. Tried: asfbin -i <inputfile> -o <outputfile> -nostream 2 , but it handles the audio part as one stream.

Also tried with ffmpeg -i <inputfile> -ab 96k -ac 1 -acodec copy <outputfile>, no success, it generates an output file arund the same size and bitrate as the input.

Because it's a waste of CPU and loss of quality, I don't want to re-encode. There is nothing that needs to be recoded, my WMA files are in excellent condition and sound great. The only problem with them is they store twice as much data as they should. There should be some solution for this without recoding.

Thanks in advance
Zooya

Extracting WMA channels

Reply #1
I'm pretty sure that audio channels are stored somehow separately.


Unless the decoder is brain dead, they are not.

For example, I have a recording, speech-of-my-friend-in-the-school.wma that is 11 682 672 in bytes and 8:04 long (484 seconds). At 192kbps a 484 seconds long audio clip would be (192000*484)/8 = 11 616 000 bytes which is almost the same as the real size (maybe there are more frames than exactly 484 seconds and the real bitrate doesn't end with 000, there's a header, that's why the real size is bigger), so I don't think it spares disk space by summing/differencing audio tracks, because in this case the size should be around half as big as a conventional 192kbps clip.


This isn't what bitrate means.  Its literally filesize divided by file length.  All 192kbps files have the same bitrate (192kbps), stereo or mono. 

If you want to halve the file size, try encoding them at 96kbps.


Extracting WMA channels

Reply #3
Quote
This isn't what bitrate means. Its literally filesize divided by file length. All 192kbps files have the same bitrate (192kbps), stereo or mono.
If you want to halve the file size, try encoding them at 96kbps.


I don't think this is a concern of being brain-dead or not. Simple logic and mathematics and a little common sense can prove that the channels are stored twice. The file has Constant Bit Rate and is as big as (I've already written) a stereo-recording would be, so the only cause of this can be: it stores twice the same audio material. I know there are several methods to store audio, especially at compressed formats, but for instance let's see MP3. There are different modes: Stereo, Joint-Stereo, Mono etc... Joint-Stereo means that it merges the two channel track and stores the difference between them. This is more efficient than storing them separately. My WMAs are not Joint-Stereo and still looking for a solution.

Extracting WMA channels

Reply #4
Mike was right.  If you set the encoder to 192kbps, it is going to use 192kbps no matter what.  192kbps does NOT mean 96kilobits per second per channel.  It means 192kilobits PER SECOND.  A stereo file of the same length would be approx. the same size as a mono file and a surround-sound file recorded at the same bitrate. 

You can not separate it into two 96kbps streams because it was not encoded that way.  It was encoded as 192kbps and is likely using Joint Stereo (even if the UI doesn't explicitly mention Joint Stereo, the internals of the encoder are using it).  Separately encoded channels is usually called "dual channel" and I'm not aware that the WMA encoder offers this feature.

Extracting WMA channels

Reply #5
Okay, let's say it works that way. There must be a solution to mathematically downmix joint-stereo to mono by filtering out one channel's difference or something.

Extracting WMA channels

Reply #6
Okay, let's say it works that way. There must be a solution to mathematically downmix joint-stereo to mono by filtering out one channel's difference or something.

Suppose it were possible to extract the side data and keep just the mid data (and I don't know that it is). If the source was mono then the side information probably occupies only a small fraction of the space, so the mono file will be only slightly smaller.

 

Extracting WMA channels

Reply #7
Simple logic and mathematics and a little common sense can prove that the channels are stored twice.


I'd love to see this logic, since they are not.

Okay, let's say it works that way.


It does work that way.

There must be a solution to mathematically downmix joint-stereo to mono by filtering out one channel's difference or something.


Sure, decode it to wave, and then encode the wav file as mono.