Opened 10 years ago

Last modified 8 months ago

#4078 open enhancement

Specify audio bitrate per-channel

Reported by: Haravikk Owned by:
Priority: wish Component: ffmpeg
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Fairly self-explanatory, but currently we can specify audio bit-rate for the entire stream, but this requires us to calculate the total bitrate from the number of input channels ourselves.

This is fine for single files, but for batch-encoding a mixture of stereo and surround-sound content it's not as ideal, or even for encoding a file that contains multiple audio-streams.

To accommodate these use-cases I'd like to request an alternative syntax for specifying audio channels with a per-channel bit-rate so that I can instead just specify say 64k per channel for AAC, with ffmpeg automatically using a total of 128k for stereo or 384k for 5.1 etc.

I'm not sure what the best way to do this would be. I suppose one option would be to have a new parameter -bc for "bits per channel", so I could specify something like ffmpeg -i "$INFILE" -acodec aac -bc:a 64k "$OUTFILE"

An alternative would be allowing some kind of suffix to the -b option such as: ffmpeg -i "$INFILE" -acodec aac -b:a 64k/c "$OUTFILE"

Change History (4)

comment:1 by Carl Eugen Hoyos, 10 years ago

Priority: normalwish
Status: newopen
Version: unspecifiedgit-master

comment:2 by elmarikon, 10 years ago

That is a very good idea.
I would love to have this feature!

comment:3 by Timothy Zorn, 8 years ago

This would help immensely with batch encoding.

comment:4 by Cameron, 8 months ago

I was having this issue today. Would be great to support this basic feature.

The default for libopus uses this behavior to set the default bitrate:

https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/refs/heads/master:/libavcodec/libopusenc.c#l382

For example libopus could re-purpose the 'global-quality' that is currently unused:
https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/refs/heads/master:/libavcodec/libopusenc.c#l118

Either-way, having a 'base_bit_rate' would be wonderful for making life more simple.

Another example, but not so great, is opusenc, it allows you to over-specify the quality, as the number channels change, it will still encode at max quality...

opusenc --bitrate 2048 sets the maximum quality... but it will max out at around ~255 /channel internally...

Note: See TracTickets for help on using tickets.