降低采样率 Linux下压缩mp3文件


  压缩 MP3 , 最简单的方法就是降低采样率了(如果不知道什么是采样率,那么就重学数字信号处理吧), 不过这样做对音质肯定是有影响的,但是由于 MP3 压缩本身就是有损压缩, 再 “损”一些,只要别太影响音质就行了。

  Linux 下面的 lame 可以完成这一功能。关于 lame 的具体使用方法可以查看他的 Manual, 简单的情况下,就是通过 -b 来控制输出的 MP3 文件的采样率,例如:

  yyc@tubo /tmp $ file a.mp3

  a.mp3: Audio file with ID3 version 2.4.0, contains: MPEG ADTS, layer III, v1,

  128 kbps, 44.1 kHz, JntStereo

  yyc@tubo /tmp $ lame -b 64 a.mp3 b.mp3

  ID3v2 found. Be aware that the ID3 tag is currently lost when transcoding.

  LAME 3.98.2 64bits (http://www.mp3dev.org/)

  Resampling: input 44.1 kHz output 24 kHz

  Using polyphase lowpass filter, transition band: 10935 Hz - 11226 Hz

  Encoding a.mp3 to b.mp3

  Encoding as 24 kHz j-stereo MPEG-2 Layer III (12x) 64 kbps qval=3

  Frame | CPU time/estim | REAL time/estim | play/CPU | ETA

  9539/9637 (99%)| 0:07/ 0:07| 0:07/ 0:07| 30.323x| 0:00

  ----------------------------------------------------------------------------

  kbps LR MS % long switch short %

  64.0 2.1 97.9 97.0 1.9 1.2

  Writing LAME Tag...done

  ReplayGain: -0.1dB

  yyc@tubo /tmp $ ls -lh *mp3

  -rwxr-xr-x 1 yyc yyc 3.6M 6月 22 16:18 a.mp3

  -rw-r--r-- 1 yyc yyc 1.8M 11月 28 22:18 b.mp3

  yyc@tubo /tmp $

  从上面的命令中可以看出, 压缩前,该文件的采样率 128K , 压缩完成之后变成了 64K, 体积也变成了原来的一半。

相关内容