2

I've noticed that the moov atom is placed at the end for many .mp4 videos. I'd like to relocate this atom to the front of the video so that I can enable progressive downloading. Is there a way to do this programmatically in Android without using any external libraries? I don't want to also include these binaries in the app. Thanks!

1 Answers1

2

I was working on the same problem. I found this library: https://github.com/ypresto/qtfaststart-java It is super nice to use. Here is the example:

try {
            QtFastStart.fastStart(fileIn, fileOut);
        } catch (IOException e) {
            // Handle
        } catch (QtFastStart.MalformedFileException e) {
            // Handle
        } catch (QtFastStart.UnsupportedFileException e) {
            // Handle
        }

compile 'net.ypresto.qtfaststartjava:qtfaststart:0.1.0'
Kirk_hehe
  • 449
  • 7
  • 17
  • 2
    This post solved my issues. Something non intuitive that should be mentioned though is that you can't just put the same file for fileIn to fileOut. You have to do some rigamarole of making a temp file then renaming to the original filename – KoalaKoalified Jan 27 '20 at 18:51