-b:a doesn't give me desired output bitrate
Hello. I'm trying to concatenate two OPUS audio files (from WhatsApp) into an MP3. On my first try without specifying output bitrate I found that the MP3 file is far too big (10 MB) than the sum of the input OPUS files (1 and 2 MBs). Then I figured it was because of the output bit rate not being set. But even with using -b:a to set the bitrate to the same as the input, I find that for some reason the output seems to use a higher bitrate and the output is still bigger than the sum of its inputs. Please guide me as to how I can get my desired effect of getting an output MP3 file that is comparable in size to the sum of its input OPUS files. $ ffmpeg -f concat -safe 0 -i <(printf "file '$PWD/%s'\n" *.opus) -b:a 18k -c libmp3lame output.mp3 Input #0, concat, from '/dev/fd/63': Duration: N/A, start: -0.002167, bitrate: N/A Stream #0:0: Audio: opus, 48000 Hz, mono, fltp Stream mapping: Stream #0:0 -> #0:0 (opus (native) -> mp3 (libmp3lame)) Press [q] to stop, [?] for help Output #0, mp3, to 'output.mp3': Metadata: TSSE : Lavf57.71.100 Stream #0:0: Audio: mp3 (libmp3lame), 48000 Hz, mono, fltp, 18 kb/s Metadata: encoder : Lavc57.89.100 libmp3lame size= 5319kB time=00:22:41.61 bitrate= 32.0kbits/s speed= 103x video:0kB audio:5319kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.004351% $ for x in *.opus output.mp3 ; do ffprobe $x ; done Input #0, ogg, from 'AUD-20170705-WA0000.opus': Duration: 00:07:41.82, start: 0.002167, bitrate: 18 kb/s Stream #0:0: Audio: opus, 48000 Hz, mono, fltp Input #0, ogg, from 'AUD-20170705-WA0001.opus': Duration: 00:14:59.78, start: 0.002167, bitrate: 18 kb/s Stream #0:0: Audio: opus, 48000 Hz, mono, fltp Input #0, mp3, from 'output.mp3': Metadata: encoder : Lavf57.71.100 Duration: 00:22:41.64, start: 0.023021, bitrate: 32 kb/s Stream #0:0: Audio: mp3, 48000 Hz, mono, s16p, 32 kb/s $ ls -l *.opus output.mp3 1096672 Jul 5 06:30 AUD-20170705-WA0000.opus 2124414 Jul 5 06:30 AUD-20170705-WA0001.opus 5446797 Jul 5 07:01 output.mp3 -- Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा
On Wed, Jul 05, 2017 at 07:11:34 +0530, Shriramana Sharma wrote:
On my first try without specifying output bitrate I found that the MP3 file is far too big (10 MB) than the sum of the input OPUS files (1 and 2 MBs). Then I figured it was because of the output bit rate not being set.
It is being set, but according to lame/libmp3lame's documentation, the lowest constant bitrate it can encode at 48 kHz sample rate is 32 kbits/s. That's why your "-b:a 18k" results in 32 kbits/s:
Input #0, mp3, from 'output.mp3': Metadata: encoder : Lavf57.71.100 Duration: 00:22:41.64, start: 0.023021, bitrate: 32 kb/s Stream #0:0: Audio: mp3, 48000 Hz, mono, s16p, 32 kb/s
Either MP3 isn't really suitable for such very low bitrates, or you need to find a different encoder. ffmpeg only supports libshine next to libmp3lame, but since libshine doesn't have a psychoacoustic model, I doubt you'll get anything worth listening to out of 18 kbits/s. I believe MP3 just isn't suitable. Opus is basically quite efficient. MP3 can't match that. If you need those recordings in MP3, they'll be larger. If it's an option, you may want to try the codec HE-AAC v2 instead. (You'll need libfdk_aac to encode to that variant, I believe.) I understand that codec is also great with low bitrates (and I have heard quite "good" sounding music in 48 kbits/s stereo.) Cheers, Moritz
On Wed, Jul 05, 2017 at 09:52:21 +0200, Moritz Barsnick wrote:
It is being set, but according to lame/libmp3lame's documentation, the lowest constant bitrate it can encode at 48 kHz sample rate is 32 kbits/s.
Actually, that's a limitation of the MP3 codec, not of the libmp3lame encoder.
I believe MP3 just isn't suitable. Opus is basically quite efficient. MP3 can't match that. If you need those recordings in MP3, they'll be larger. If it's an option, you may want to try the codec HE-AAC v2 instead. (You'll need libfdk_aac to encode to that variant, I believe.) I understand that codec is also great with low bitrates (and I have heard quite "good" sounding music in 48 kbits/s stereo.)
So this remains the recommendation: Live with it or choose a suitable codec. How about Opus? ;-) Moritz
Thanks for those very clear replies. I guess there isn't any particular reason I need to stick to MP3. I should have read https://en.wikipedia.org/wiki/Opus_(audio_format) earlier, from which I learnt that it is the replacement for Vorbis and also says (IIUC) OPUS is more efficient than MP3. OPUS it is then. Thanks! -- Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा
participants (2)
-
Moritz Barsnick -
Shriramana Sharma