java 剪切音乐,java的MP3 /音频编辑/修剪库

I am looking for a java library that will allow me to "trim" an audio file so that I can pull out and save X amount of seconds of an audio file. Ideally, I am looking for something that would be like a substr for an audio file. If I want from 123 seconds in to 153 seconds in I would be able to do:

coollib.load('bigfile.mp3');

coollib.trimAudioSeconds(123,30);

coollib.export('newfile.mp3');

I have seen this post:

But it didn't have anything about my substr quest. I am hoping someone has needed this functionality before so they will know exactly what direction to point me.

Thanks!

解决方案

I don't know about an existing library, but what you can do is read the file header for bitrate information, then multiply that by the seconds you want to go in, read so many bytes of the file and throw them away. Then you're at the right point to start recording, read so many bytes, and stop.

A regular mp3 library should be able to tell you about bitrate without your having to read the header yourself.

Then there's the problem of variable bitrate files...

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值