How can I convert mp3 to some other audio format?

sox can’t do it:


> cer@Telcontar:~/media/HAL-9000> sox abitsilly.mp3 abitsilly.au
> sox FAIL formats: can't open input file `abitsilly.mp3': WAV file encoding `MP3' is not supported
> cer@Telcontar:~/media/HAL-9000>

I have “sox-14.4.0-38.1.x86_64” from packman.

mplayer can play the file, but I don’t know how to use it to convert a file.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

To really help, we would need to know what the target format would be. You can use lame to convert to wav for instance in a bash script:

for i in *.mp3; do 

lame –decode $i `basename $i .mp3`.wav

done

Thank You,

On 2013-06-17 02:26, jdmcdaniel3 wrote:
>
> robin_listas;2565338 Wrote:
>> sox can’t do it:
>>
>>>
> Code:
> --------------------
> > >
> > > cer@Telcontar:~/media/HAL-9000> sox abitsilly.mp3 abitsilly.au
> > > sox FAIL formats: can’t open input file abitsilly.mp3': WAV file encoding MP3’ is not supported
> > > cer@Telcontar:~/media/HAL-9000>
> >
> --------------------

> To really help, we would need to know what the target format would be.
> You can use lame to convert to wav for instance in a bash script:

You have it in the code excerpt: .au, but any would do if from that I
can convert to au.

>
>
> Code:
> --------------------
> for i in *.mp3; do
>
> lame –decode $i basename $i .mp3.wav
>
> done
>
> --------------------

OK, to wav it works.


> cer@Telcontar:~/media/HAL-9000> lame --decode abitsilly.mp3 abitsilly.wav^C
> cer@Telcontar:~/media/HAL-9000> file abitsilly.wav
> abitsilly.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 16000 Hz
> cer@Telcontar:~/media/HAL-9000> sox abitsilly.wav abitsilly.au
> cer@Telcontar:~/media/HAL-9000> file abitsilly.au
> abitsilly.au: Sun/NeXT audio data: 16-bit linear PCM, mono, 16000 Hz
> cer@Telcontar:~/media/HAL-9000>

But to .au it does not. I need this format:

/usr/share/sounds/au/hal9.au: Sun/NeXT audio data: 8-bit ISDN mu-law, mono, 8000 Hz

because this plays the sound in scripts:


> cer@Telcontar:~/media/HAL-9000> cat /usr/share/sounds/au/hal9.au > /dev/audio

But the abitsilly.au file generated above does not play that way, it is
noise. lame generates 16 bit PCM, and it has to be, I think, 8 bit.

I’ll try to play it with the command “play”, but I prefer “cat”, it is
more reliable at the point I run it.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

ffmpeg will convert it.

ffmpeg -i test.mp3  test.au

@robin_listas

audacity is ok for exporting to other audio formats

in this instance its possibly a gui for ffmpeg

cheers

On 2013-06-17 10:46, brucecadieux1 wrote:
>
> ffmpeg will convert it.
>
>
> Code:
> --------------------
> ffmpeg -i test.mp3 test.au
> --------------------

Fails.


> cer@Telcontar:~/media/HAL-9000> ffmpeg -i abitsilly.mp3 abitsilly2.au
> ffmpeg version 1.0.6 Copyright (c) 2000-2013 the FFmpeg developers
> ...
>
> Stream mapping:
>   Stream #0:0 -> #0:0 (mp3 -> pcm_s16be)
> Press [q] to stop, ?] for help
> size=     145kB time=00:00:04.64 bitrate= 256.0kbits/s
> video:0kB audio:145kB subtitle:0 global headers:0kB muxing overhead 0.016150%
> cer@Telcontar:~/media/HAL-9000> file abitsilly2.au
> abitsilly2.au: Sun/NeXT audio data: 16-bit linear PCM, mono, 16000 Hz
> cer@Telcontar:~/media/HAL-9000> cat abitsilly2.au > /dev/audio
> ^C
> cer@Telcontar:~/media/HAL-9000>

It is converted, but plays noise.

If you people want to try it yourselves, the mp3 file is here (the site
reports wav, but it is mp3).


http://www.dailywav.com/program.php?Program=2001

and the result has to be played via cat to /dev/audio directly, without
a player. The files I know that play have this format:


> /usr/share/sounds/au/hal9.au: Sun/NeXT audio data: 8-bit ISDN mu-law, mono, 8000 Hz

It could be the 16 bit vs 8 bit, the sampling… no idea.

Searching for codecs with “sun” on them:


ffmpeg -codecs:

libavutil      51. 73.101 / 51. 73.101
libavcodec     54. 59.100 / 54. 59.100
libavformat    54. 29.104 / 54. 29.104
libavdevice    54.  2.101 / 54.  2.101
libavfilter     3. 17.100 /  3. 17.100
libswscale      2.  1.101 /  2.  1.101
libswresample   0. 15.100 /  0. 15.100
libpostproc    52.  0.100 / 52.  0.100
D.VIL. sp5x                 Sunplus JPEG (SP5X)
DEVI.S sunrast              Sun Rasterfile image

-decoders

libavutil      51. 73.101 / 51. 73.101
libavcodec     54. 59.100 / 54. 59.100
libavformat    54. 29.104 / 54. 29.104
libavdevice    54.  2.101 / 54.  2.101
libavfilter     3. 17.100 /  3. 17.100
libswscale      2.  1.101 /  2.  1.101
libswresample   0. 15.100 /  0. 15.100
libpostproc    52.  0.100 / 52.  0.100
V....D sp5x                 Sunplus JPEG (SP5X)
V....D sunrast              Sun Rasterfile image

-encoders


libavutil      51. 73.101 / 51. 73.101
libavcodec     54. 59.100 / 54. 59.100
libavformat    54. 29.104 / 54. 29.104
libavdevice    54.  2.101 / 54.  2.101
libavfilter     3. 17.100 /  3. 17.100
libswscale      2.  1.101 /  2.  1.101
libswresample   0. 15.100 /  0. 15.100
libpostproc    52.  0.100 / 52.  0.100
V..... sunrast              Sun Rasterfile image


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

Gave this a try:


ffmpeg -i FileName.mp3 Filename.au

and it plays properly. Maybe missing some codec?

On 2013-06-17 13:16, Knurpht wrote:
>
> Gave this a try:
>
> Code:
> --------------------
>
> ffmpeg -i FileName.mp3 Filename.au
>
> --------------------
>
> and it plays properly. Maybe missing some codec?

it doesn’t here. Play it by doing:


cat Filename.au > /dev/audio

My file is converted, but fails this test. If this works for you, please
try this other file:


wget http://www.dailywav.com/1003/abitsilly.wav
file abitsilly.wav
mv abitsilly.wav abitsilly.mp3
ffmpeg abitsilly.mp3 abitsilly.au
cat abitsilly.au > /dev/audio

That’s the method of playing I need, cat, not a player.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

Try


ffmpeg -i abitsilly.mp3 -acodec pcm_s8 abitsilly.au

to get a 8bit output.


martinh@ganymed:~/tmp> file abitsilly.au
abitsilly.au: Sun/NeXT audio data: 8-bit linear PCM [REF-PCM], mono,
16000 Hz


PC: oS 12.3 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.10.3 | GTX 650 Ti
ThinkPad E320: oS 12.3 x86_64 | i3@2.30GHz | 8GB | KDE 4.10.4 | HD 3000
HannsBook: oS 12.3 x86_64 | SU4100@1.3GHz | 2GB | KDE 4.10.3 | GMA4500

On 2013-06-17 16:03, Martin Helm wrote:
> Try
>


> ffmpeg -i abitsilly.mp3 -acodec pcm_s8 abitsilly.au
> 

to get a 8bit output.


> martinh@ganymed:~/tmp> file abitsilly.au
> abitsilly.au: Sun/NeXT audio data: 8-bit linear PCM [REF-PCM], mono,
> 16000 Hz
> 

Ah, interesting… but plays noise. :frowning:

There must be something else we are missing. Bitrate?

>
> cer@Telcontar:~/media/HAL-9000> ffmpeg -i abitsilly.mp3 -acodec pcm_s8 -b:a 8k abitsilly4.au
> ...
> Input #0, wav, from 'abitsilly.mp3':
>   Duration: 00:00:04.61, bitrate: 256 kb/s
>     Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s
> Output #0, au, to 'abitsilly4.au':
>   Metadata:
>     encoder         : Lavf54.29.104
>     Stream #0:0: Audio: pcm_s8 ([2][0][0][0] / 0x0002), 16000 Hz, mono, u8, 128 kb/s
> Stream mapping:
>   Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s8)
> Press [q] to stop, ?] for help
> size=      72kB time=00:00:04.61 bitrate= 128.0kbits/s
> video:0kB audio:72kB subtitle:0 global headers:0kB muxing overhead 0.032531%
> cer@Telcontar:~/media/HAL-9000> file abitsilly4.au
> abitsilly4.au: Sun/NeXT audio data: 8-bit linear PCM [REF-PCM], mono, 16000 Hz
> cer@Telcontar:~/media/HAL-9000> file abitsilly4.au

It ignores the bitrate setting.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)


ffmpeg -i abitsilly.mp3 -acodec pcm_s8 -ar 8000 abitsilly.au

martinh@ganymed:~/tmp> file abitsilly.au
abitsilly.au: Sun/NeXT audio data: 8-bit linear PCM [REF-PCM], mono, 8000 Hz

Does that work better (I cannot test the cat as I do not have a
/dev/audio to cat to).

Try to install winff, it is a gui frontend for ffmpeg.

I just converted it using ffmpeg, no errors, no problems and the file plays.

ffmpeg -i abitsilly.wav abitsilly.au

Here is the converted file, I played it on three different openSUSE computers, if it just plays noise for you then there is something wrong on your end.

http://itsyourpc.net/bruce/files/abitsilly.au

On 2013-06-17 23:46, brucecadieux1 wrote:
>
> I just converted it using ffmpeg, no errors, no problems and the file
> plays.
>
>
>
>
> Code:
> --------------------
> ffmpeg -i abitsilly.wav abitsilly.au
> --------------------

How do you play it? You have to do:


cat abitsilly.au > /dev/audio

It does not play, it is noise. If you use another method to play it, it
is not valid.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

On 2013-06-17 16:44, Martin Helm wrote:
>


> ffmpeg -i abitsilly.mp3 -acodec pcm_s8 -ar 8000 abitsilly.au
>
> martinh@ganymed:~/tmp> file abitsilly.au
> abitsilly.au: Sun/NeXT audio data: 8-bit linear PCM [REF-PCM], mono, 8000 Hz
> 

> Does that work better (I cannot test the cat as I do not have a
> /dev/audio to cat to).

Better, but a lot of noise, it is not intelligible :frowning:

I thought this would be easier. That device must need an old format :frowning:


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

Carlos,
I just tried a few samples. I used Pacpl its in the Packman repos.
First thing I did was convert to .flac but it wouldn’t go from the .wav that it claims to .flac
So still using pacpl I then converted to .wma from that I was able convert to .ogg or .flac without noise or problem.
I use KDE & pacpl integrates very well into it (just rclick select Actions then select PACPL-Convert)if you use Gnome I don’t know.

On Mon, 17 Jun 2013 10:28:06 GMT, “Carlos E. R.”
<robin_listas@no-mx.forums.opensuse.org> wrote:

>On 2013-06-17 10:46, brucecadieux1 wrote:
>>
>> ffmpeg will convert it.
>>
>>
>> Code:
>> --------------------
>> ffmpeg -i test.mp3 test.au
>> --------------------
>
>Fails.
>
>


>> cer@Telcontar:~/media/HAL-9000> ffmpeg -i abitsilly.mp3 abitsilly2.au
>> ffmpeg version 1.0.6 Copyright (c) 2000-2013 the FFmpeg developers
>> ...
>> 
>> Stream mapping:
>>   Stream #0:0 -> #0:0 (mp3 -> pcm_s16be)
>> Press [q] to stop, ?] for help
>> size=     145kB time=00:00:04.64 bitrate= 256.0kbits/s    
>> video:0kB audio:145kB subtitle:0 global headers:0kB muxing overhead 0.016150%
>> cer@Telcontar:~/media/HAL-9000> file abitsilly2.au
>> abitsilly2.au: Sun/NeXT audio data: 16-bit linear PCM, mono, 16000 Hz
>> cer@Telcontar:~/media/HAL-9000> cat abitsilly2.au > /dev/audio
>> ^C
>> cer@Telcontar:~/media/HAL-9000> 
>

It is converted, but plays noise.

If you people want to try it yourselves, the mp3 file is here (the site
reports wav, but it is mp3).


>http://www.dailywav.com/program.php?Program=2001
>

I checked the site, as i suspected it is a .wav file. Thet should show up
if you do:


file  <2001 dave and hal.dub>

Or whatever name you saved the file under inside <> (but without the <>
themselves).

and the result has to be played via cat to /dev/audio directly, without
a player. The files I know that play have this format:


>> /usr/share/sounds/au/hal9.au: Sun/NeXT audio data: 8-bit ISDN mu-law, mono, 8000 Hz
>

It could be the 16 bit vs 8 bit, the sampling… no idea.

Searching for codecs with “sun” on them:


>ffmpeg -codecs:
>
>  libavutil      51. 73.101 / 51. 73.101
>  libavcodec     54. 59.100 / 54. 59.100
>  libavformat    54. 29.104 / 54. 29.104
>  libavdevice    54.  2.101 / 54.  2.101
>  libavfilter     3. 17.100 /  3. 17.100
>  libswscale      2.  1.101 /  2.  1.101
>  libswresample   0. 15.100 /  0. 15.100
>  libpostproc    52.  0.100 / 52.  0.100
> D.VIL. sp5x                 Sunplus JPEG (SP5X)
> DEVI.S sunrast              Sun Rasterfile image
>
>-decoders
>
>  libavutil      51. 73.101 / 51. 73.101
>  libavcodec     54. 59.100 / 54. 59.100
>  libavformat    54. 29.104 / 54. 29.104
>  libavdevice    54.  2.101 / 54.  2.101
>  libavfilter     3. 17.100 /  3. 17.100
>  libswscale      2.  1.101 /  2.  1.101
>  libswresample   0. 15.100 /  0. 15.100
>  libpostproc    52.  0.100 / 52.  0.100
> V....D sp5x                 Sunplus JPEG (SP5X)
> V....D sunrast              Sun Rasterfile image
>
>-encoders
>
>
>  libavutil      51. 73.101 / 51. 73.101
>  libavcodec     54. 59.100 / 54. 59.100
>  libavformat    54. 29.104 / 54. 29.104
>  libavdevice    54.  2.101 / 54.  2.101
>  libavfilter     3. 17.100 /  3. 17.100
>  libswscale      2.  1.101 /  2.  1.101
>  libswresample   0. 15.100 /  0. 15.100
>  libpostproc    52.  0.100 / 52.  0.100
> V..... sunrast              Sun Rasterfile image
>

On 2013-06-28 22:18, josephkk wrote:
> On Mon, 17 Jun 2013 10:28:06 GMT, “Carlos E. R.” <> wrote:

>> If you people want to try it yourselves, the mp3 file is here (the site
>> reports wav, but it is mp3).
>>
>>


>> http://www.dailywav.com/program.php?Program=2001
>> 

I checked the site, as i suspected it is a .wav file. Thet should show up
if you do:


> file  <2001 dave and hal.dub>
> 

Look:


> cer@Telcontar:~/tmp/AAAA> wget http://www.dailywav.com/1003/abitsilly.wav
> --2013-06-29 01:26:45--  http://www.dailywav.com/1003/abitsilly.wav
> Resolving www.dailywav.com (www.dailywav.com)... 161.58.222.143
> Connecting to www.dailywav.com (www.dailywav.com)|161.58.222.143|:80... connected.
> HTTP request sent, awaiting response... 200 OK
> Length: 18808 (18K) [audio/x-wav]
> Saving to: `abitsilly.wav'
&gt;
&gt; 100%=========================================================================================================================================&gt;] 18.808      23,7K/s   in 0,8s
&gt;
&gt; 2013-06-29 01:26:46 (23,7 KB/s) - `abitsilly.wav' saved [18808/18808]
>
> cer@Telcontar:~/tmp/AAAA> file abitsilly.wav
> abitsilly.wav: RIFF (little-endian) data, WAVE audio, MPEG Layer 3, mono 16000 Hz
> cer@Telcontar:~/tmp/AAAA>


It is an MP3, not a WAV.

But that is irrelevant for my problem.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

Just curious have you tried pacpl yet?
I did a what & how in post 16. Of course YMMV.

On 2013-07-01 07:16, Sagemta wrote:
>
> Just curious have you tried pacpl yet?
> I did a what & how in post 16. Of course YMMV.

I did not see your post. I see now on the web side that you posted on
the 20th, right where the nntp interface broke down - so it never
arrived here :frowning:

Thanks for repeating it.

I’m testing it, but I can’t:


cer@Telcontar:~/tmp/AAAA> pacpl abitsilly.mp3 --to au --outfile abitsilly.au
Perl Audio Converter - 4.0.5

Converting:  [abitsilly.mp3] -> [au] ..done.

Total files converted: 1, failed: 0

cer@Telcontar:~/tmp/AAAA> cat abitsilly.au.au > /dev/audio
bash: /dev/audio: Device or resource busy
cer@Telcontar:~/tmp/AAAA>

I may have to reboot to free the device :-/


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)