发布于 2018-06-11 17:41:12
ffmpeg很快。你用的是什么命令?也许你做了ffmpeg代码转换,这是慢的?
关于
fmpeg -i audiofile.mp3 -ss 3 -t 5 -acodec copy outfile.mp3这个重新复用从秒3开始,持续5秒到outfile.mp3,非常快。
发布于 2018-06-05 17:51:05
发布于 2020-11-27 05:12:08
是的,它可以裁剪音频与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));https://stackoverflow.com/questions/50693534
复制相似问题