ffmpeg: setting audio bitrate

Asked by Toan

Hi, I have the lastest ffmpeg medibuntu installed and I have problem encoding video with audio bitrate different than default.

For e.g., if do

ffmpeg -i in.avi -title "A title" -vcodec copy -acodec aac -ac 2 -ar 48000 -ab 128 out.avi

ffmpeg produces a video with no sound. The output is following
===============================================
Seems stream 0 codec frame rate differs from container frame rate: 30000.00 (30000/1) -> 29.97 (30000/1001)
Input #0, avi, from 'in.avi':
  Duration: 00:22:04.6, start: 0.000000, bitrate: 1699 kb/s
  Stream #0.0: Video: mpeg4, yuv420p, 640x480, 29.97 fps(r)
  Stream #0.1: Audio: ac3, 48000 Hz, stereo, 192 kb/s
Output #0, avi, to 'out.avi':
  Stream #0.0: Video: mpeg4, yuv420p, 640x480, q=2-31, 29.97 fps(c)
  Stream #0.1: Audio: aac, 48000 Hz, stereo, 0 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
===============================================

The same thing (nosound) happens if I set "-ab 128". However if I omit -ab option, ffmpeg produces video with sound but with the default 64kbps bitrate. Replacing "-acodec acc" to "-acodec mp3" doesn't help.

Is this a bug? or did I do something wrong ?

Question information

Language:
English Edit question
Status:
Solved
For:
Medibuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Guillaume Martres
Solved:
Last query:
Last reply:
Revision history for this message
Toan (nguyenthetoan) said :
#1

This is what happens if I omit the "-ab" option

ffmpeg -i in.avi -title "A title" -vcodec copy -acodec aac -ac 2 -ar 48000 out.avi

Seems stream 0 codec frame rate differs from container frame rate: 30000.00 (30000/1) -> 29.97 (30000/1001)
Input #0, avi, from 'in.avi':
  Duration: 00:22:04.6, start: 0.000000, bitrate: 1699 kb/s
  Stream #0.0: Video: mpeg4, yuv420p, 640x480, 29.97 fps(r)
  Stream #0.1: Audio: ac3, 48000 Hz, stereo, 192 kb/s
Output #0, avi, to 'out.avi':
  Stream #0.0: Video: mpeg4, yuv420p, 640x480, q=2-31, 29.97 fps(c)
  Stream #0.1: Audio: aac, 48000 Hz, stereo, 64 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1

Revision history for this message
Guillaume Martres (smarter) said :
#2

Could you please provide the "in.avi" file? Even a cutted version of 2/3 seconds will do.

Revision history for this message
Best Guillaume Martres (smarter) said :
#3

The unit of the "ab" parameter has been changed to bits, try with "-ab 128k"

Revision history for this message
Toan (nguyenthetoan) said :
#4

Thanks Guillaume Martres, that solved my question.