Hello,
I want to use madplay via command line to chop an mp3 based on a time location. madplay -s allows me to seek to a location in the file. However, I cannot find a way to have madplay output the remainder of the mp3; it wants to decode the file.
Is there a simple work around for this? Or should I just modify madplay or use libmad to write up a simple program to do this?
Thank you, Wayne Davis
Wayne F Davis wrote:
I want to use madplay via command line to chop an mp3 based on a time location. madplay -s allows me to seek to a location in the file. However, I cannot find a way to have madplay output the remainder of the mp3; it wants to decode the file.
Is there a simple work around for this? Or should I just modify madplay or use libmad to write up a simple program to do this?
Since madplay is really just a decoder/player, you'll probably be better off writing something simple using libmad directly. You can use stream->this_frame and stream->next_frame to get the frame header boundaries as each frame is decoded. Beware though you probably won't be able to make a clean splice with Layer III since some of the audio data for the frame may come before the frame header. As long as you don't care about a perfect cut, you should be fine.
You may also want to look at the source for madtime to get an idea how to measure playing time quickly (to implement the seek) using the low-level libmad API.