Java 如何将MP4视频旋转90度?
我已尝试使用mp4parser执行以下操作:Java 如何将MP4视频旋转90度?,java,android,video,orientation,mp4,Java,Android,Video,Orientation,Mp4,我已尝试使用mp4parser执行以下操作: private void rotate(String videoPath) { IsoFile out = new IsoFile(videoPath); out.getMovieBox().getMovieHeaderBox().setMatrix(Matrix.ROTATE_90); File outputVideo = new File(videoPath+".rotated.mp4"); if (!outp
private void rotate(String videoPath) {
IsoFile out = new IsoFile(videoPath);
out.getMovieBox().getMovieHeaderBox().setMatrix(Matrix.ROTATE_90);
File outputVideo = new File(videoPath+".rotated.mp4");
if (!outputVideo.exists())
outputVideo.createNewFile();
FileOutputStream fos = new FileOutputStream(outputVideo);
out.writeContainer(fos.getChannel());
fos.close();
out.close();
}
但这只会在标题中设置一个标志,告诉视频以不同的方向播放。实际旋转视频的最简单/最快方法是什么?MP4只是一种容器格式,要实际旋转流中的帧,您需要修改数据;这可能需要解码和重新编码;或者根据编解码器对数据进行一些棘手的重新排列。无法解析实际帧数据。@Durandal,我可以试试这个。我知道编码可能需要一段时间,但我可以为此设置后台服务。