duongtung4691 / mp4parser

Automatically exported from code.google.com/p/mp4parser
0 stars 0 forks source link

getMatrix() return olways ROTATE_0 #66

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Executing:

    String m = isoFile.getMovieBox().getMovieHeaderBox().getMatrix().toString();

on any video, despite of the rotation, returns always "Rotate 0"

I have tested the versions 1.0-RC-24 and 1.0-RC-25 on a Galaxy S3 with Android 
4.

Original issue reported on code.google.com by sul...@gmail.com on 5 Aug 2013 at 6:20

GoogleCodeExporter commented 9 years ago
Please have a look at the TrackHeaderBox. Your phone might rotate the video 
track instead of the whole video.

Original comment by sebastia...@castlabs.com on 6 Aug 2013 at 3:28

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
It reproduces for me also, I'm testing it on a video I create with LG Nexus 4's 
camera(API level 4.4). 
I'm getting that the MovieBox is
MovieBox[MovieHeaderBox[creationTime=Mon Dec 30 15:07:27 GMT+02:00 
2013;modificationTime=Mon Dec 30 15:07:27 GMT+02:00 
2013;timescale=1000;duration=2667;rate=1.0;volume=1.0;matrix=Rotate 
0°;nextTrackId=3];TrackBox[];TrackBox[]]

it has only box of type MovieHeaderBox, and indeed the rotation is always 
Rotation 0.

Original comment by nati...@gmail.com on 30 Dec 2013 at 3:01

GoogleCodeExporter commented 9 years ago
I'm having the same issue in Android 4.4.4, I know that the video is rotated by 
90, I checked it in ffmpeg also and it has a rotation of 90, but 
isoFile.getMovieBox().getMovieHeaderBox().getMatrix().toString() is returning 
"Rotate 0". 

I just downloaded your library and I noticed few things that might help you fix 
the issue or narrow it down, 

1- The matrix variable in MovieHeaderBox.java is being set as shown below,
         private Matrix matrix = Matrix.ROTATE_0;

and the function is always returning it 

    public Matrix getMatrix() {
        return matrix;
    }

2- The second issue is that the matrix definition doesn't look right, for 
example, the matrix ROTATE_0 found in Matrix.java below might be wrong, 
                       public static final Matrix ROTATE_0 = new Matrix(1, 0, 0, 1, 0, 0, 1, 0, 0);

I believe this should be an identity matrix and it should be like this ( 1, 0, 
0, 0, 1, 0, 0, 0, 1 ).

Original comment by ammarnha...@gmail.com on 19 Sep 2014 at 3:21

GoogleCodeExporter commented 9 years ago
Hi,

It's seems to be ok if you use the TrackBox Data.

Something like this is ok on my video files :

isoFile = new IsoFile(filepath);
                MovieBox moov = isoFile.getMovieBox();
                for(Box b : moov.getBoxes()) {
                    // First looking for movie Header Box 
                     if (b.getType()=="mvhd"){
                        MovieHeaderBox mhb = (MovieHeaderBox) b;
                        System.out.println("Duration :"+mhb.getDuration());
                        System.out.println("Matrix Rotation :"+mhb.getMatrix());                            
                     }
                     if (b.getType()=="trak"){
                        TrackBox tb = (TrackBox) b;
                        System.out.println("Trak Matrix Rotation :"+tb.getTrackHeaderBox().getMatrix());
                     }
                    System.out.println(b);
                }

Jean

Original comment by jean.m.b...@gmail.com on 18 Jan 2015 at 7:46