mp4parser icon indicating copy to clipboard operation
mp4parser copied to clipboard

No effect for the TrackMetaData setMatrix() method

Open Aissa-H opened this issue 6 years ago • 4 comments

Hello @sannies and thanks for this great lib!

I'm currently using it in an app where the user can take videos from the front and the back camera. As it was mentioned in this issue, when we want to merge videos with different rotations, we find in the result upside down sequences.

To fix it, my idea was to change the Matrix of the video track just before merging to the rotation angle I want in order to obtain a collection of videos with the same rotation value. So I used the TrackMetaData attribute of the tracks as follows:

Track t = ......
if(t.getTrackMetaData().getMatrix().equals(Matrix.ROTATE_270)){
    t.getTrackMetaData().setMatrix(Matrix.ROTATE_90);
}

Here, I'm getting the video Track which was taken from the front camera (Rotation=270) and trying to rotate it. By doing this I hope that the merge will return again the video from 90 to 270 (+180°) and so the video will not be upside down.

My problem now: the method setMatrix() seems to have no effect, I have no changes in my final merged video.

Have you any idea about it? It will be very useful I think for the lib, we will maybe be able to fix the upside down issue mentioned before!

Thank you in advance!

Aissa-H avatar Oct 25 '17 13:10 Aissa-H

Hi, Did you manage to fix this issue?

andrevdk avatar May 01 '18 06:05 andrevdk

i have the same issue,did you solve it?

shaojin8864 avatar Sep 20 '18 07:09 shaojin8864

@shaojin8864 This solution will never work because setMatrix is used only by video players eventually. This merge library is not aware of the rotation info. The only way is to rotate the video pre-merge with some video tools like ffmpeg.

andrevdk avatar Sep 20 '18 11:09 andrevdk

I hope to help you. I am trying to encode video from the camera and audio from the microphone using MediaCodec and MediaMuxer. Rendering with OpenGL.

https://github.com/lumyus/FlexCam

mendax92 avatar Apr 26 '19 06:04 mendax92