sannies / mp4parser

A Java API to read, write and create MP4 files
Apache License 2.0
2.75k stars 566 forks source link

Reading the GSpherical:ProjectionType tag #344

Closed tibbi closed 5 years ago

tibbi commented 5 years ago

I'm basically having troubles using this library. All I want is figuring out if an mp4 video I have is a spherical video, or a casual one. If I read the video file binary content on my pc I see a structure similar to https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md#appendix-1---global-metadata-sample , so I just want to somehow check in my Android app if the video contains the GSpherical:ProjectionType tag. How should it be done? I've went through this library examples and github issues, couldn't find anything helpful. I've spent a couple hours researching it, found some IsoFiles and Boxes, is it what I'm supposed to use? Does anyone have an actual code sample that I could use, not just theory? Or is using this library an overkill for my goal? Thanks

sannies commented 5 years ago

I'd say: overkill. Parsing boxes and navigating there is simple. 4 bytes length, 4 bytes type, if type is uuid then next 16 bytes are a uuid. Some boxes contain boxes. Check this example: https://github.com/sannies/mp4parser/blob/master/examples/src/main/java/com/google/code/mp4parser/example/PrintStructure.java

Am Mo., 29. Okt. 2018 um 21:31 Uhr schrieb Tibor Kaputa < notifications@github.com>:

I'm basically having troubles using this library. All I want is figuring out if an mp4 video I have is a spherical video, or a casual one. If I read the video file binary content on my pc I see a structure similar to https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md#appendix-1---global-metadata-sample , so I just want to somehow check in my Android app if the video contains the GSpherical:ProjectionType tag. How should it be done? I've went through this library examples and github issues, couldn't find anything helpful. I've spent a couple hours researching it, found some IsoFiles and Boxes, is it what I'm supposed to use? Does anyone have an actual code sample that I could use, not just theory? Or is using this library an overkill for my goal? Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sannies/mp4parser/issues/344, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKUD7F6VOQXF2T_uF5YXOfu79wOjcJNks5up2WpgaJpZM4YAPhw .

tibbi commented 5 years ago

I tried running that sample in kotlin in my app, but the result is Setting END to 15759427 ftyp@0 size: 24 free@24 size: 3191 mdat@3215 size: 15750590 moov@15753805 size: 5622 mvhd@15753813 size: 108 meta@15753921 size: 117 trak@15754038 size: 1766 tkhd@15754046 size: 92 mdia@15754138 size: 1212 mdhd@15754146 size: 32 hdlr@15754178 size: 44 minf@15754222 size: 1128 vmhd@15754230 size: 20 dinf@15754250 size: 36 stbl@15754286 size: 1064 stsd@15754294 size: 160 stts@15754454 size: 136 stss@15754590 size: 36 stsz@15754626 size: 632 stsc@15755258 size: 52 stco@15755310 size: 40 uuid@15755350 size: 454 trak@15755804 size: 3623 tkhd@15755812 size: 92 mdia@15755904 size: 3523 mdhd@15755912 size: 32 hdlr@15755944 size: 44 minf@15755988 size: 3439 smhd@15755996 size: 16 dinf@15756012 size: 36 stbl@15756048 size: 3379 stsd@15756056 size: 127 stts@15756183 size: 2008 stsz@15758191 size: 1144 stsc@15759335 size: 52 stco@15759387 size: 40 I have no idea what am I seeing. If it isn't the correct output, do you have any sample output, like what should I see? And how can I determine from it, if the video is a spherical one? Thanks

tibbi commented 5 years ago

actually, I guess that I need the uuid part, so I just have to read bytes from 15755350 to 15755350 + 454 and that will give me the needed xml? going to try that

tibbi commented 5 years ago

ok Im close to figuring it out, thanks :)