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.

This transcodes the entire .mp3 to a .wav

mpg123 -w output.wav input.mp3

Is there any way I can transcode a portion from the 10 second mark to the 20 second mark at a 44100hz?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

Note : What you want isn't directly possible with mpg123. I recommend using SoX instead -- the "Swiss Army Knife of sound processing".

Transcoding only a portion of an MP3 file to WAV and resampling it to a different rate

  • Install SoX along with MP3 format support from the terminal with sudo apt-get install sox libfmt-sox-mp3

  • You can then perform the transcoding you require via this command:

    sox -V3 input.mp3 -r 44100 output.wav trim 0:10 0:10
    
    • The -r option, inserted before the output file name, indicates that you want to resample the output to 44100 Hz.
    • The trim option, inserted after the output file name, indicates that you want to transcode only the portion beginning at 0 minutes and 10 seconds (first 0:10), for a length of 10 seconds from that point (second 0:10).
    • The -V3 is optional and simply tells sox to display the input/output parameters and transcoding progress for your information.
share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.