2

I tried using FFProbe's command, but it's not enough to determine if the audio is CBR or VBR. ffprobe -v error -show_format -show_streams 123_1429602551009.051025.m4a

Thanks

Nishan Bende
  • 41
  • 1
  • 8

1 Answers1

1

With ffmpeg, I'm pretty sure it's possible, but it wouldn't be easy according to what I know. It would be cool to see if an idea I have would work, though I don't have time to check it, now. (I'll look into how it could be done (referencing this Video StackExchange answer). Before I do that, I'm going to suggest the use of mediaplayer. There's the website with the Windows download, or you can use

sudo apt-get install mediaplayer # Debian-type
sudo dnf install mediaplayer # RedHat-type, better command, IMHO
sudo yum install mediaplayer # RedHat-type, other command

As an example of using that, I have an audio which I created as a *.wav file - bballdave025_tomp3.wav . Since it's raw data in that format, it can only be a constant bitrate as a wave. I used Audacity (official software page and github) to re-encode it as a VBR MP3 file - bballdave025_tomp3_vbr.mp3 - and a CBR MP3 file - bballdave025_tomp3_cbr.mp3 .

$ mediainfo bballdave025_tomp3.wav | grep -i "bit rate"
Overall bit rate mode                    : Constant
Overall bit rate                         : 706 kb/s
Bit rate mode                            : Constant
Bit rate                                 : 705.6 kb/s

$ mediainfo bballdave025_tomp3_cbr.mp3 | grep -i "bit rate"
Overall bit rate mode                    : Constant
Overall bit rate                         : 192 kb/s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s

$ mediainfo bballdave025_tomp3_vbr.mp3 | grep -i "bit rate"
Overall bit rate mode                    : Variable
Overall bit rate                         : 101 kb/s
Bit rate mode                            : Variable
Bit rate                                 : 101 kb/s
Minimum bit rate                         : 32.0 kb/s

You can always leave off the grep if you want to see more information.

Note: If you want to figure things out for the audio part of a video containing audio, you'll need to separate the audio into its own file to use this strategy. Something like:

ffmpeg -i input.mp4 -vn -a:c output.mp3

(I haven't tested that), then

mediainfo output.mp3

(At least I don't know any other way to do it.)


Idea/skeleton for doing it with ffmpeg

From the source, the original idea with video was

ffmpeg -i input.mp4 -an -c:v copy -segment_time 0.00001 -f segment i%0d.mp4

Then to run ffprobe on each of the segments. We'll need to change this to deal with just the audio - anyone wanting to do this would need to look into the docs to figure out the exact command needed. We can then batch our way through the ffprobe on each, picking out the bitrate. For one of the audio segments

$ ffprobe -hide_banner i01.wav
Input #0, wav, from 'i01.wav':
  Duration: 00:00:01.00, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 1 channels, s16, 705 kb/s

So, for a group, you could parse out between 'bitrate: ' and ' kb/s', then run sort -u on it. If you get more than one number, you have a variable bit rate. (At least that's an idea, which would need fleshing out by an interested person.)

bballdave025
  • 1,347
  • 1
  • 15
  • 28