Reputation: 67
in order to save space on my home NAS I want to convert plenty of different videos to more efficient codes.
Is there a way to limit the sampling rate to 44 100Hz in order to convert 48 000Hz to 44.1kHz but to keep Videos with 22 050Hz at that sampling rate?
The only solution I came up with is to use something like medainfo or "mplayer -vo null -ao null -frames 0 -identify $1 | grep ID_AUDIO_RATE" to get the sampling rate and decide what option to set.
Is there a smarter, more elegant way?
Thanks in advance Ben
Upvotes: 2
Views: 4012
Reputation: 2683
You can use audio filters to do something similar. See https://www.ffmpeg.org/ffmpeg-filters.html#aformat-1
So you can use -af "sample_rates=16000|22050|24000|32000|44100"
.
But have a look at this table of recommended bitrates http://wiki.hydrogenaud.io/index.php?title=Fraunhofer_FDK_AAC#Recommended_Sampling_Rate_and_Bitrate_Combinations
I'd rather recommend sample_rates=32000|44100|48000
unless you have some kind of magic that also changes the bitrate dynamically.
Upvotes: 3