You are not logged in.

#1 2019-12-28 10:25:44

l0tek
Member
Registered: 2018-12-28
Posts: 29

[solved] m4a support in sox?

I've tried the version in community and also recompiled sox from git, but it just fails with error "formats: no handler for file extension `m4a'".

Does anyone know if there is a way to add m4a support, or if there is an alternative tool I can use to generate a spectrogram from bash?

Last edited by l0tek (2019-12-28 12:20:54)

Offline

#2 2019-12-28 10:36:42

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: [solved] m4a support in sox?

Maybe read the file with faad and pipe the decoded audio to sox?


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#3 2019-12-28 11:32:18

l0tek
Member
Registered: 2018-12-28
Posts: 29

Re: [solved] m4a support in sox?

Good idea, thanks.

Offline

#4 2019-12-28 11:52:15

l0tek
Member
Registered: 2018-12-28
Posts: 29

Re: [solved] m4a support in sox?

Ok, I've tried:

faad -w -f 2 input.m4a | sox -V -t raw -n sinc 15-300 spectrogram -x 5000 -m -l -z 100 -o output.png

but sox says "ignoring `-t raw'" and "FAIL sox:  Not enough input filenames specified" (the rest of the output is confusing to read, perhaps because of the piping)

Offline

#5 2019-12-28 11:59:02

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: [solved] m4a support in sox?

You have to specify an input file, there is a special notation for stdin: "-".
https://jlk.fjfi.cvut.cz/arch/manpages/ … _Filenames

By the way, if you want to use raw pcm, then you'll have to set the same bit depth for both tools as well as the correct sample rate, encoding and channel count.

Last edited by progandy (2019-12-28 12:17:03)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#6 2019-12-28 12:20:32

l0tek
Member
Registered: 2018-12-28
Posts: 29

Re: [solved] m4a support in sox?

Ah you're right, I forgot the "-". Thanks.

Closing, but if someone knows of a patch for native m4a support please let me know.

Offline

#7 2019-12-28 20:50:00

teckk
Member
Registered: 2013-02-21
Posts: 519

Re: [solved] m4a support in sox?

or if there is an alternative tool I can use to generate a spectrogram from bash?

How about:

ffmpeg -i file.m4a -lavfi showspectrumpic out.png

Offline

#8 2019-12-29 06:58:58

l0tek
Member
Registered: 2018-12-28
Posts: 29

Re: [solved] m4a support in sox?

teckk wrote:

How about:

ffmpeg -i file.m4a -lavfi showspectrumpic out.png

Didn't know ffmpeg could do that, but it doesn't seem to have enough tunables for what I'm trying to accomplish with sox (see comment #4). Thanks anyway.

Offline

Board footer

Powered by FluxBB