Re: sox vs libmagic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > Would anyone miss the libmagic functionality
> > if it was removed from SoX?

On Sep 18 10:27:00, peterparker@xxxxxxxxxxxx wrote:
> A few other posters have commented to either enable or disable at
> compilation time. I am using sox a lot, but have never compiled it
> myself and would be happy if I hadn't to in the future to either enable
> or disable libmagic, whatever my preference would be.

On Sep 19 15:51:53, mans@xxxxxxxxx wrote:
> Until someone can point to a specific problem the feature is causing,
> I see absolutely no reason for removing it.

I think it goes the other way: there needs to be
a specific reason to have it in there.

Here is SoX 14.4.2 built --without-magic:


hans@dell:tmp$ sox -n file.wav synth 1 sin 440 gain -6
hans@dell:tmp$ soxi file.wav

Input File     : 'file.wav'
Channels       : 1
Sample Rate    : 48000
Precision      : 32-bit
Duration       : 00:00:01.00 = 48000 samples ~ 75 CDDA sectors
File Size      : 192k
Bit Rate       : 1.54M
Sample Encoding: 32-bit Signed Integer PCM

hans@dell:tmp$ mv file.wav file
hans@dell:tmp$ soxi file

Input File     : 'file' (wav)
Channels       : 1
Sample Rate    : 48000
Precision      : 32-bit
Duration       : 00:00:01.00 = 48000 samples ~ 75 CDDA sectors
File Size      : 192k
Bit Rate       : 1.54M
Sample Encoding: 32-bit Signed Integer PCM

hans@dell:tmp$ mv file mp3
hans@dell:tmp$ soxi file.mp3

Input File     : 'file.mp3' (wav)
Channels       : 1
Sample Rate    : 48000
Precision      : 32-bit
Duration       : 00:00:01.00 = 48000 samples ~ 75 CDDA sectors
File Size      : 192k
Bit Rate       : 1.54M
Sample Encoding: 32-bit Signed Integer PCM

hans@dell:tmp$ play file.mp3

file.mp3:

 File Size: 192k      Bit Rate: 1.54M
  Encoding: Signed PCM
  Channels: 1 @ 32-bit
Samplerate: 48000Hz
Replaygain: off
  Duration: 00:00:01.00

In:100%% 00:00:01.00 [00:00:00.00] Out:48.0k [ =====|===== ]	    Clip:0


So I created a file.wav and renamed it to 'file' just to confuse SoX.
But it seems to recognize it as WAV just fine.

Then I renamed it to file.mp3 to cause even more confusion.
But SoX recognizes it as WAV all the same.

This is --without-magic. What exactly do we need it for?
Can someone more knowledgeable in the codebase please explain
when exactly is libmagic used to help SoX determine the a file format?
Apparently, having a *.wav file named *.mp3 is not such an example.

Hm, now that I tried the oposite (*.mp3 file named *.wav),
"play file.wav" fails with

   can't open input file `file.wav': WAVE: RIFF header not found

but "play --magic file.wav" works. Does that mean that --magic
needs to be explicitly specified for the libmagic to happen?

On Sep 18 02:53:52, fmiser@xxxxxxxxx wrote:
> seems to me using a files magic number is good way to deal with
> missing or wrong extensions.

I'll repeat: how many audio files with missing or wrong extensions
have you encountered in the last year?

Also, it seems you have to run SoX with an explicit --magic option
- have you ever used that?

	Jan


------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
Sox-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/sox-users



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux