答案 0 :(得分:1)
ffmpeg很快。你用了什么命令?也许你做了ffmpeg转码,这很慢?
怎么样?
fmpeg -i audiofile.mp3 -ss 3 -t 5 -acodec copy outfile.mp3
此重新启动从第二个3开始持续5秒进入outfile.mp3
,非常快。
答案 1 :(得分:0)
答案 2 :(得分:0)
是的,可以使用mp4parser修剪音频。
应该类似于以下内容
private CroppedTrack getCroppedTrack(Track track, int startTimeMs, int endTimeMs)
{
long currentSample = 0;
double currentTime = 0;
long startSample = -1;
long endSample = -1;
double startTime = startTimeMs / 1000;
double endTime = endTimeMs / 1000;
for (int i = 0; i < track.getSampleDurations().length; i++)
{
if (currentTime <= startTime)
{
// current sample is still before the new starttime
startSample = currentSample;
}
if (currentTime <= endTime) {
// current sample is after the new start time and still before the new endtime
endSample = currentSample;
}
else
{
// current sample is after the end of the cropped video
break;
}
currentTime += (double) track.getSampleDurations()[i] / (double) track.getTrackMetaData().getTimescale();
currentSample++;
}
return new CroppedTrack(track, startSample, endSample);
}
使用上述方法根据所需的起点和终点来修剪轨道。
movie.addTrack(getCroppedTrack(track, 0, 8000));