VideoHelp Forum




+ Reply to Thread
Results 1 to 14 of 14
  1. I'm trying to convert a 24-bit W64 to 16-bit FLAC.

    How can I do this with the FLAC command-line tool?

    P.S. a 24-bit FLAC is just too large; that's why I'm converting it to 16-bit.
    Quote Quote  
  2. A Member since June, 2004 Keyser's Avatar
    Join Date
    Feb 2013
    Location
    Westernmost point of Europe
    Search Comp PM
    I have no idea how you can do it with FLAC command line, but with foobar2000, you can select FLAC in the output file format and then choose output bit depth.
    "The greatest trick the Devil ever pulled was convincing the world he didn't exist."
    Quote Quote  
  3. Originally Posted by Keyser View Post
    I have no idea how you can do it with FLAC command line, but with foobar2000, you can select FLAC in the output file format and then choose output bit depth.
    Thanks, works as intended. I just don't understand why there is no such option in the command-line FLAC converter tool itself; and if there is, I'm not able to find it.
    Quote Quote  
  4. A Member since June, 2004 Keyser's Avatar
    Join Date
    Feb 2013
    Location
    Westernmost point of Europe
    Search Comp PM
    Originally Posted by eddman View Post
    Thanks, works as intended. I just don't understand why there is no such option in the command-line FLAC converter tool itself; and if there is, I'm not able to find it.
    I don't know the reason myself, but I suspect it has to do with the fact that FLAC is a lossless encoder, which means it won't change the audio in any way, because if it did, it wouldn't be lossless.
    "The greatest trick the Devil ever pulled was convincing the world he didn't exist."
    Quote Quote  
  5. Originally Posted by Keyser View Post
    I don't know the reason myself, but I suspect it has to do with the fact that FLAC is a lossless encoder, which means it won't change the audio in any way, because if it did, it wouldn't be lossless.
    I suppose that makes sense. Well, at least there are other tools for the job. Thanks again.
    Quote Quote  
  6. Lossy conversion (requantization with noisehaped dither) to lossless flac.

    Code:
    @ffmpeg -threads %NUMBER_OF_PROCESSORS%*1.5 -i %1 -vn -c:a flac -compression_level 12 -af "aresample=resampler=soxr:dither_method=shibata,aformat=sample_fmts=s16" %1_16.flac
    It should reduce size (not always) - extreme cases (192ksps 24 bit naim-test-2) by almost 3x times.
    Noise shaping is available for limited set of sampling frequencies (for anything higher than 48ksps - in example case noiseshaping "Shibata" was replaced by regular High Pass TPDF - for "normal" sampling frequencies noisehaping will made virtually lossy free requantization). In most of cases lossy transformation is transparent (from human auditory perspective).

    Original

    Image
    [Attachment 30469 - Click to enlarge]


    16 bit

    Image
    [Attachment 30470 - Click to enlarge]
    Last edited by pandy; 27th Feb 2015 at 06:27.
    Quote Quote  
  7. Originally Posted by pandy View Post
    Lossy conversion (requantization with noisehaped dither) to lossless flac.

    Code:
    @ffmpeg -threads %NUMBER_OF_PROCESSORS%*1.5 -i %1 -vn -c:a flac -compression_level 12 -af "aresample=resampler=soxr:dither_method=shibata,aformat=sample_fmts=s16" %1_16.flac
    It should reduce size (not always) - extreme cases (192ksps 24 bit naim-test-2) by almost 3x times.
    Noise shaping is available for limited set of sampling frequencies (for anything higher than 48ksps - in example case noiseshaping "Shibata" was replaced by regular High Pass TPDF - for "normal" sampling frequencies noisehaping will made virtually lossy free requantization). In most of cases lossy transformation is transparent (from human auditory perspective).
    That's with ffmpeg, not flac converter tool, right?

    It's just too complicated for me. The only command that I understand (I think) is "-i".
    Quote Quote  
  8. Originally Posted by eddman View Post
    That's with ffmpeg, not flac converter tool, right?

    It's just too complicated for me. The only command that I understand (I think) is "-i".
    It use FLAC library so it is like flac converter tool.

    Try it, listen, verify with your signal lineup - usually this kind of processing may be applied at the final stage of processing and for sure if this is possible then you should keep 24 bit for archiving purposes (but for example this processing may be applied to files where target is your portable player then set of reduced size files may be created in such way).
    Quote Quote  
  9. Originally Posted by pandy View Post
    It use FLAC library so it is like flac converter tool.
    I see. Guess I should've known.

    Originally Posted by pandy View Post
    Try it, listen, verify with your signal lineup - usually this kind of processing may be applied at the final stage of processing and for sure if this is possible then you should keep 24 bit for archiving purposes (but for example this processing may be applied to files where target is your portable player then set of reduced size files may be created in such way).
    It's just too many commands and I don't really know what they're doing. By the way, I'm doing it for temporary playback purposes, not permanent archiving, so 16-bit is fine.

    I thought maybe there could be a simple command for flac or ffmpeg, like how eac3to has. It's really simple in eac3to:

    eac3to input1 output -down16.

    I just don't want to use it for flac because it's quite old now.

    Maybe I should stick to foobar. I'm just too dumb for all these stuff.
    Last edited by eddman; 27th Feb 2015 at 08:25.
    Quote Quote  
  10. Originally Posted by eddman View Post
    It's just too many commands and I don't really know what they're doing.

    I thought maybe there could be a simple command for flac or ffmpeg, like how eac3to has. It's really simple in eac3to:

    eac3to input1 output -down16.

    I just don't want to use it for flac because it's quite old now.

    Maybe I should stick to foobar. I'm just too dumb for all these stuff.
    It doing conversion from whatever source to flac 16 bit, no sample rate conversion is applied, only signal is requantized (if necessary) with applied noiseshaping (when it is possible).
    Create text file with extension like cmd or bat, copy sequence, download latest zeranoe static ffmpeg win32 build and use it (drag file over batch), with few changes folders can be automatically converted, alternatively search for some universal GUI, put same command line and use as regular application.
    Quote Quote  
  11. Originally Posted by pandy View Post
    It doing conversion from whatever source to flac 16 bit, no sample rate conversion is applied, only signal is requantized (if necessary) with applied noiseshaping (when it is possible).
    I meant that at least I should learn what they do, or it'd be kind of pointless.

    -threads %NUMBER_OF_PROCESSORS%*1.5: This is clear, but I don't get the "*1.5" part.
    -i %1: input file
    -vn: don't know what this is.
    -c:a flac: output flac?
    -compression_level 12: Is this the quantization part you mentioned?
    -af "aresample=resampler=soxr:dither_method=shibata,af ormat=sample_fmts=s16" %1_16.flac: I have no idea. -af? soxr? dither? shibata? I think "sample_fmts=s16" tells it to convert to 16-bit, right?
    Last edited by eddman; 27th Feb 2015 at 08:53.
    Quote Quote  
  12. Originally Posted by eddman View Post
    Originally Posted by pandy View Post
    It doing conversion from whatever source to flac 16 bit, no sample rate conversion is applied, only signal is requantized (if necessary) with applied noiseshaping (when it is possible).
    I meant that at least I should learn what they do, or it'd be kind of pointless.

    -threads %NUMBER_OF_PROCESSORS%*1.5: This is clear, but I don't get the "*1.5" part.
    -i %1: input file
    -vn: don't know what this is.
    -c:a flac: output flac?
    -compression_level 12: Is this the quantization part you mentioned?
    -af "aresample=resampler=soxr:dither_method=shibata,af ormat=sample_fmts=s16" %1_16.flac: I have no idea. -af? soxr? dither? shibata? I think "sample_fmts=s16" tells it to convert to 16-bit, right?

    http://environmentvariables.org/Number_Of_Processors (from some unknown reason in my configuration forcing threads by factors 1.5 works better) - you may ignore this and left decision to software

    %1 is command line parameter http://www.robvanderwoude.com/parameters.php in this case this is filename with extension

    -vn means no video (only audio is processed well documented in ffmpeg doc)

    -c:a flac - yes, codec:audio flac

    -compression_level 12 - no this is tell flac library to really work hard to compress data as much as possible (value 12 is a bit not specified but it works fine for me and it provide lower file size always)

    -af - audiofilter, aresample is filter responsible for resampling but in this case we not changing sample rate - we use only dither part in resampler, =resample=soxr is sox resampling library - considered as one of best (details are available on ffmpeg and on sox pages),
    dither_method=shibata is dither with particular noiseshaping (it reduces perceived noise even if overall noise level is higher - noise is tuned to average human auditory sensitivity, shibata is curve, there is few others for details go to sox documentation),
    aformat=sample_fmts=s16 - yes - this is where 16 bit signed PCM is requested.
    Quote Quote  
  13. Originally Posted by pandy View Post
    -af - audiofilter, aresample is filter responsible for resampling but in this case we not changing sample rate - we use only dither part in resampler, =resample=soxr is sox resampling library - considered as one of best (details are available on ffmpeg and on sox pages),
    dither_method=shibata is dither with particular noiseshaping (it reduces perceived noise even if overall noise level is higher - noise is tuned to average human auditory sensitivity, shibata is curve, there is few others for details go to sox documentation)
    Thanks. That was really helpful. I'll check out those pages.

    Just one last question (hopefully); is dithering/noiseshaping really necessary here? or you mean that quality will suffer without it?
    Quote Quote  
  14. Originally Posted by eddman View Post
    Thanks. That was really helpful. I'll check out those pages.

    Just one last question (hopefully); is dithering/noiseshaping really necessary here? or you mean that quality will suffer without it?
    You welcome, and yes - dither is required from subjective and objective perspective (with some exception but they are limited - coherent sampling, fixed quantization levels) - it remove or significantly reduce quantization errors correlated with signal (partially responsible for "metallic sound" of first CD's) - probably best explanation http://www.youtube.com/watch?v=cIQ9IXSUzuM - proof that you can store signal with fractional bit resolution i.e. less than 1 bit (that's why 24 bit to 16 bit under some assumption may be considered as virtually lossless).
    Last edited by pandy; 27th Feb 2015 at 12:48.
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!