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: Format options defaults (Read 5402 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Format options defaults

I'm looking at a program which uses Flac encoding in a transcoding operation, and trying to figure out what the options listed below do.  Do they tell Flac about the format of the input or what to produce in its output?

Are there default values for each of these?

Code: [Select]
format options:
      --endian={big|little}    Set byte order for samples
      --channels=#             Number of channels
      --bps=#                  Number of bits per sample
      --sample-rate=#          Sample rate in Hz
      --sign={signed|unsigned} Sign of samples (the default is signed)

Format options defaults

Reply #1
These options are for RAW input only, i.e. WAV without a header.

There is no default value - for each option you must specify a value, but I can give some hints:

Endian is little for Windows machine,
bps is 16 for a CD-Audio content
sample rate is 44100 Hz for CD-Audio
sign is signed most probably.

Format options defaults

Reply #2
These options are for RAW input only, i.e. WAV without a header.

There is no default value - for each option you must specify a value, but I can give some hints:

Endian is little for Windows machine,
bps is 16 for a CD-Audio content
sample rate is 44100 Hz for CD-Audio
sign is signed most probably.


Thanks.  That's how it's being used.  The output is WAV from LAME, with no header (long story why it's transcoding Mp3 to Flac, but it's necessary).

So these option _must_ be specified, or else Flac will have no idea what to do and will fail or ... will it?  I would have thought that it would default to assuming redbook CD format of 2ch/16bit/44.1kHz.

Should --force-raw-format also be given, or will it matter?

Format options defaults

Reply #3
Should --force-raw-format also be given, or will it matter?
If the stream has no WAV chunks in it, only raw audio, then --force-raw-format is unnecessary.
lossyWAV -q X -a 4 -s h -A --feedback 2 --limit 15848 --scale 0.5 | FLAC -5 -e -p -b 512 -P=4096 -S- (having set foobar to output 24-bit PCM; scaling by 0.5 gives the ANS headroom to work)

Format options defaults

Reply #4
What does this bit mean, from the detailed Help?

Quote
flac checks for the presence of a AIFF/WAVE header to decide whether or not to
treat an input file as AIFF/WAVE format or raw samples.  If any input file is
raw you must specify the format options {-fb|fl} -fc -fp and -fs, which will
apply to all raw files.  You can force AIFF/WAVE files to be treated as raw
files using -fr.


There's no documentation of -fb -fl -fc -fp -fs or -fr options.  Can I assume these are short forms of --endian big, --endian little, --channels, --bps, --sampe-rate and --force-raw-format, respectively?  Or is this an outdated bit of documentation?

Format options defaults

Reply #5
oops, the -fs, etc options are ancient short forms of the new long options (gotta fix that)
-fs = --sample-rate
-fc = --channels
-fp = --bps
-fb = --endian=big
-fl = --endian=little

flac tries to detect wave/aiff from the file header.  if it does not see a valid header it assumes raw samples, in which case you have to specify all those options (and --sign=...) so it knows the raw format; it doesn't make any assumptions about it.

you only have to use --force-raw-format if the detection fails (which I've never heard of).  but it won't hurt to use it if you know you're feeding it raw samples.