javaandroidmp4parsergopro

How to get GoPro HiLight tag in mp4 video in Android or Java


I manually added tags to mp4 video using GoPro - Quik.

According to Chriki answer on superuser and GoProInfo.cpp HiLight tags are stored in box type HMMT in milliseconds of mp4 video.

Path = `moov\udta\HMMT`

But I didn't found any tag milliseconds using sannies/mp4parser code

    InputStream in = new BufferedInputStream(urlConnection.getInputStream());

    ReadableByteChannel chanel = Channels.newChannel(in);

I continue my R&D and got result for this code

IsoFile isoFile = new IsoFile(chanel);
                MovieBox movieBox = isoFile.getMovieBox();
                List<UserDataBox> userDataBoxes = movieBox.getBoxes(UserDataBox.class);

                stringBuilder.append("moov>UserBoxes:\n");
                for (int i = 0; i < userDataBoxes.size(); i++) {
                    stringBuilder.append(userDataBoxes.get(i));
                    stringBuilder.append("\n");
                    UserDataBox erDataBox = userDataBoxes.get(i);
                    for (int i1 = 0; i1 < erDataBox.getBoxes().size(); i1++) {
                        stringBuilder.append(erDataBox.getBoxes().get(i));
                        stringBuilder.append("\n");
                    }
                    stringBuilder.append("\n");
                    stringBuilder.append("\n");
                }

Output:

moov>UserBoxes:
UserDataBox[MetaBox[HandlerBox[handlerType=mdir;name=��];AppleItemListBox[org.mp4parser.boxes.apple.AppleEncoderBox@619e00b]]]
    MetaBox[HandlerBox[handlerType=mdir;name=��];AppleItemListBox[org.mp4parser.boxes.apple.AppleEncoderBox@619e00b]]

update: I got HMMT with isoviewer. It is using following library

<dependency>
            <groupId>com.googlecode.mp4parser</groupId>
            <artifactId>isoparser</artifactId>
            <version>1.1.14</version>
        </dependency>

Problem still not resolved cause com.googlecode.mp4parser IsoFile class doesn't have constructor for ReadableByteChannel used for retrieving data from remote streams.

enter image description here

The real problem with library is that sannies/mp4parser doesn't returns UnknownBox from UserDataBox while googlecode/mp4parser does but there is only library that work with video url that sannies/mp4parser. Need to fix or any workaround.

Any solution. Thanks


Solution

  • Issue with Quik software, it doesn't save tags inside file as I was expecting. It save tags against media unique id. You have to read tags from mp4 video that is created with GoPro Camera.

    Getting from mp4 url code snippet

    InputStream inputStream = new BufferedInputStream(new URL("http://localhost:6582?BRIDGE&%2FGOPR0175.MP4&GOPR0175.MP4&80898399").openConnection().getInputStream());
    GoProTagsBox tags = GoProUtil.getHilights(inputStream);
    
    stringBuilder.append("Count: "+tags.getCount());
    if(tags.getHiLights() != null){
        for (long l : tags.getHiLights()) {
            stringBuilder.append("\nHiLight: "+l);
        }
    }
    

    Getting from GoPro mp4 file code snippet

    GoProTagsBox tags = GoProUtil.getHilights(new RandomAccessFile(Environment.getExternalStorageDirectory().getAbsolutePath() + "/GOPR0175.MP4", "r"));
    

    Working fine in both cases.

    Using https://github.com/Qamar4P/JaadAndroid android versions of jaad