Created
April 15, 2018 11:33
-
-
Save paratechnical/9655b4ef4108501b5a950afbd749aa36 to your computer and use it in GitHub Desktop.
Modify mp4 - moov atom at the front of the file (Fast Start)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add compile 'net.ypresto.qtfaststartjava:qtfaststart:0.1.0' to build.gradle | |
String videoFileNameWithoutExtension = com.google.common.io.Files.getNameWithoutExtension(path2OutputFile); | |
File outputFile = new File(path2OutputFile); // Your outputFile file | |
String pathToParent = outputFile.getParent(); | |
Path noStreamOutputFile = Paths.get(pathToParent, videoFileNameWithoutExtension + "_nostream.mp4"); | |
Files.move(outputFile.toPath(), noStreamOutputFile); | |
try { | |
QtFastStart.fastStart(new File(noStreamOutputFile.toString()), outputFile); | |
} catch (QtFastStart.MalformedFileException ex) { | |
Logger.getLogger(AudioVideoHelpers.class.getName()).log(Level.SEVERE, null, ex); | |
} catch (QtFastStart.UnsupportedFileException ex) { | |
Logger.getLogger(AudioVideoHelpers.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
Files.delete(noStreamOutputFile); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment