Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How do I change the bitrate for both the video & audio together in one line?

Was frustrated with avconv not doing something right so I was messing around with ffmpeg to see if I could circumvent the problem I was having with avconv. If its not one thing its something else.

The command

  • ffmpeg -v verbose -i inputfile.mkv -map 0.0 -vcodec mpeg2video -b:v 6000k -map 0.1 -acodec ac3 -b:a 384k -ac 2 -map_metadata 0:0 outputfile.mpg

Ignores the bitrate settings and produces error about the parameter value but doesn't produce errors about parameter syntax.

ffmpeg version 0.8.6-6:0.8.6-1ubuntu2
Input #0, matroska,webm, from 'inputfile.mkv':
Duration: 02:10:06.70, start: 0.000000, bitrate: 896 kb/s
Stream #0.0: Video: h264 (High), yuv420p, 1280x544, PAR 1:1 DAR 40:17, 24 fps, 24 tbr, 1k tbn, 48 tbc (default)
Stream #0.1(chi): Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s (default)
Metadata:
  title           : 粵語
Stream #0.2(chi): Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s
Metadata:
  title           : 国语
Stream #0.3(chi): Subtitle: dvdsub (default)
Metadata:
  title           : 繁中
Stream #0.4(chi): Subtitle: [0][0][0][0] / 0x0000
Metadata:
  title           : 繁中
Stream #0.5(chi): Subtitle: dvdsub
Metadata:
  title           : 简中
Stream #0.6(eng): Subtitle: dvdsub
Metadata:
  title           : eng
[buffer @ 0x1c9fda0] w:1280 h:544 pixfmt:yuv420p
Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'
[ac3 @ 0x1c6df60] channel_layout not specified
[ac3 @ 0x1c6df60] No channel layout specified. The encoder will guess the layout, but it might be incorrect.
[ac3 @ 0x1c6df60] invalid bit rate
Output #0, mpeg, to 'outputfile.mpg':
Stream #0.0: Video: mpeg2video, yuv420p, 1280x544 [PAR 1:1 DAR 40:17], q=2-31, 200 kb/s, 90k tbn, 24 tbc (default)
Stream #0.1(chi): Audio: ac3, 48000 Hz, stereo, flt, 200 kb/s (default)
Metadata:
  title           : 粵語
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Error while opening encoder for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or height

If I change the bitrate parameter syntax to not be specific about video/audio then they both get set to the latter setting.

  • ffmpeg -v verbose -i inputfile.mkv -map 0.0 -vcodec mpeg2video -b 6000k -map 0.1 -acodec ac3 -b 384k -ac 2 -map_metadata 0:0 outputfile.mp

Starts to convert but with an improper bitrate for the video.

Output #0, mpeg, to 'outputfile.mpg':
Metadata:
encoder         : Lavf53.21.1
Stream #0.0: Video: mpeg2video, yuv420p, 1280x544 [PAR 1:1 DAR 40:17], q=2-31, 384 kb/s, 90k tbn, 24 tbc (default)
Stream #0.1(chi): Audio: ac3, 48000 Hz, stereo, flt, 384 kb/s (default)
Metadata:
  title           : 粵語
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
share|improve this question
    
1. Use a recent real ffmpeg (not fake ffmpeg) by downloading a build or compiling ffmpeg. 2. Show complete ffmpeg console output of ffmpeg -i input -c:v mpeg2video -q:v 2 -an output.mpg –  LordNeckbeard Sep 9 '13 at 18:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.