问题
Is there any API or library in Java available that will let me modify tags in the metadata for mp4 files? I need to modify the orientation (or rotation) tag in order to get videos to playback in the correction orientation. Something for Android would be preferrable.
回答1:
Full disclosure: I'm the creator and maintainer of the mp4parser lib.
Use http://mp4parser.googlecode.com for opening the MP4 file. Navigate to the exif box (I have never seen that box) and modify it. Then write the file back to disk.
But are you really sure the exif box is changing the playback behavior? It rather seems to be an info box that tells you something about the recording situation.
I'd rather think you should modify the matrix in the Track Header Box (/moov/trak/tkhd) to retate the video. You might want to have a look a the Matrices part of the quicktime format specification (same as MP4 - at least for the matrices)
This answer here helps you with the matrix: https://stackoverflow.com/a/8177749/829133
来源:https://stackoverflow.com/questions/14621279/modify-exif-tags-in-java-for-mp4-videos