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: A problem of the SoX Resampler in ffmpeg... (Read 5205 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

A problem of the SoX Resampler in ffmpeg...

the testing ffmpeg version: ffmpeg-20181202-72b047a-win64-static.zip

according to http://ffmpeg.org/ffmpeg-resampler.html ,
"precision:
For soxr only, the precision in bits to which the resampled signal will be calculated. The default value of 20 (which, with suitable dithering, is appropriate for a destination bit-depth of 16) gives SoX’s ’High Quality’; a value of 28 gives SoX’s ’Very High Quality’."

but why I got  the same result (the same MD5) in "precision 33" and "precision 20"?
Here are my command lines:
Code: [Select]
ffmpeg -i 4824.flac -af aresample=resampler=soxr -precision 33 -ar 44100 -sample_fmt s16  -c:a flac 441precision33.flac
Code: [Select]
ffmpeg -i 4824.flac -af aresample=resampler=soxr -precision 20 -ar 44100 -sample_fmt s16  -c:a flac 441precision20.flac
Both of these two files have the same MD5...
I want to ask, why didn't the command line "-precision xx" in soxr of ffmpeg get work?

Re: A problem of the SoX Resampler in ffmpeg...

Reply #1
-af aresample=resampler=soxr -precision 33 -ar 44100 -sample_fmt s16
How do you expect for 16 bit file to save 20 bit or 33 bit precision? Especially, when it is simply truncated to 16 bit. Resampler calculated values down to 33 bit, then truncated it to 16 bit. Resampler calculated values down to 20 bit, then truncated it to 16 bit.  So both files are the same - truncated to 16 bit.

Also you can use more compact command.
-af aresample=44100:resampler=soxr:precision=33:osf=s16
Also, notice that by defaulf ffmpeg doesn't dither, so it may be useful to add dither to command
for example -af aresample=44100:resampler=soxr:precision=33:osf=s16:dither_method=triangular


Re: A problem of the SoX Resampler in ffmpeg...

Reply #2
-af aresample=resampler=soxr -precision 33 -ar 44100 -sample_fmt s16
How do you expect for 16 bit file to save 20 bit or 33 bit presision? Especially, when it is simply truncated to 16 bit.

Also you can use more compact command.
-af aresample=44100:resampler=soxr:precision=33:osf=s16
Also, notice that by defaulf ffmpeg doesn't dither, so it may be useful to add dither to command
for example -af aresample=44100:resampler=soxr:precision=33:osf=s16:dither_method=triangular



OH!Get work!Thank you!Very much!
by the way,which is the best dither_method? how many dither_scale can I set?

"cheby
For soxr only, selects passband rolloff none (Chebyshev) & higher-precision approximation for ’irrational’ ratios. Default value is 0."
Sorry,I can't understand the meaning of "cheby"...

Re: A problem of the SoX Resampler in ffmpeg...

Reply #3
which is the best dither_method?
You can see differences between dither/noise shaping methods here - http://sox.sourceforge.net/SoX/NoiseShaping (what called "none" actually is "triangular") By the way, foobar2000 uses 'shibata'.
how many dither_scale can I set?
1 (default) should be fine.
Sorry,I can't understand the meaning of "cheby"...
No need to use it.

Re: A problem of the SoX Resampler in ffmpeg...

Reply #4
which is the best dither_method?
You can see differences between dither/noise shaping methods here - http://sox.sourceforge.net/SoX/NoiseShaping (what called "none" actually is "triangular") By the way, foobar2000 uses 'shibata'.
it's not easy to understand these pics in the page for me.may be "triangular" / "shibata" is good enough.
Thanks for your answer.

 

Re: A problem of the SoX Resampler in ffmpeg...

Reply #5
At 16 bits you are unlikely to hear the difference between different dither methods.

"cheby" probably refers to Chebyshev, a russian mathematician.