ffmpeg将音频比特率限制为128kb / s

时间:2013-05-01 17:35:29

标签: ffmpeg

我想将文件上转换为256kb / s。 (我知道我正在失去质量和所有 那,我知道我真的想要上转换64kb / s => 256kb / s)

我正在使用的命令

ffmpeg -i "Same Love.m4a" -acodec libfaac "Same Love.m4a" -b:a 256kb \
  -loglevel debug

我已经使用了我能想到的每一种组合,而ffmpeg只会上转换 到128kbs!

这是我的输出日志

$ ffmpeg -i "Same Love.m4a" -acodec libfaac "ready_to_import_to_itunes/Same Love.m4a" -b:a 256kb -loglevel debug
ffmpeg version 1.0 Copyright (c) 2000-2012 the FFmpeg developers
  built on Oct 12 2012 12:31:30 with Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/1.0 --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 59.100 / 54. 59.100
  libavformat    54. 29.104 / 54. 29.104
  libavdevice    54.  2.101 / 54.  2.101
  libavfilter     3. 17.100 /  3. 17.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc6ab006600] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc6ab006600] ISO: File Type Major Brand: mp42
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc6ab006600] File position before avformat_find_stream_info() is 30844
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc6ab006600] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc6ab006600] File position after avformat_find_stream_info() is 31216
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Same Love.m4a':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom3gp63g2a3gp4
    creation_time   : 2012-08-11 09:56:26
  Duration: 00:05:18.71, start: 0.000000, bitrate: 64 kb/s
    Stream #0:0(und), 1, 1/44100: Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 64 kb/s
    Metadata:
      creation_time   : 2012-08-11 09:56:26
      handler_name    : soun
[abuffer @ 0x7fc6aac0e560] Setting entry with key 'time_base' to value '1/44100'
[abuffer @ 0x7fc6aac0e560] Setting entry with key 'sample_rate' to value '44100'
[abuffer @ 0x7fc6aac0e560] Setting entry with key 'sample_fmt' to value 's16'
[abuffer @ 0x7fc6aac0e560] Setting entry with key 'channel_layout' to value '0x3'
[graph 0 input from stream 0:0 @ 0x7fc6aac0e660] tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x3
[aformat @ 0x7fc6aac0eba0] Setting entry with key 'sample_fmts' to value 's16'
[aformat @ 0x7fc6aac0eba0] Setting entry with key 'channel_layouts' to value '0x4,0x3,0x7,0x107,0x37,0x3f'
Output #0, ipod, to 'ready_to_import_to_itunes/Same Love.m4a':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom3gp63g2a3gp4
    encoder         : Lavf54.29.104
    Stream #0:0(und), 0, 1/44100: Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 128 kb/s
    Metadata:
      creation_time   : 2012-08-11 09:56:26
      handler_name    : soun
Stream mapping:
  Stream #0:0 -> #0:0 (aac -> libfaac)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc6ab006600] demuxer injecting skip 1024
[aac @ 0x7fc6ab02f600] skip 2048 samples due to side data
[aac @ 0x7fc6ab02f600] skip whole frame, skip left: 0
EOF on sink link output stream 0:0:default.28.0kbits/s
No more output streams to write to, finishing.
size=    5028kB time=00:05:18.71 bitrate= 129.2kbits/s
video:0kB audio:4974kB subtitle:0 global headers:0kB muxing overhead 1.093817%
[AVIOContext @ 0x7fc6aac0ca20] Statistics: 2580581 bytes read, 0 seeks

认为正在发生的事情是ffmpeg确定确实没有 有利于达到256k,所以将它限制在128.

如何强制以指定的比特率输出文件? (我试过了 用mp3也是如此)

1 个答案:

答案 0 :(得分:1)

ffmpeg -i 'Same Love.m4a' -acodec libfaac -b:a 256k 'Same Love-256.m4a'
  • 选项必须之前它们影响的文件,我移动了-b:a
  • 也是256k而不是256kb