public void test() throws Exception { userTransaction.begin(); try { entityManager.persist(new Movie("Quentin Tarantino", "Reservoir Dogs", 1992)); entityManager.persist(new Movie("Joel Coen", "Fargo", 1996)); entityManager.persist(new Movie("Joel Coen", "The Big Lebowski", 1998)); List<Movie> list = movies.getMovies(); assertEquals("List.size()", 3, list.size()); for (Movie movie : list) { movies.deleteMovie(movie); } assertEquals("Movies.getMovies()", 0, movies.getMovies().size()); } finally { userTransaction.commit(); } }
// Constructor, methods and members all rolled up into one definition var Movie = function(name) { this.name = name; // Note that private members can be created using the closure property var _id = +(new Date()); this.getName = function() { return this.name + " " + _id; }; this.setName = function(name) { this.name = name; }; }; var m = new Movie("Beerfest");
public static void main(String[] args) throws IOException { File dest = File.createTempFile("Unmux", "main"); FileOutputStream fos = new FileOutputStream(dest); IOUtils.copy(new URL("http://org.mp4parser.s3.amazonaws.com/examples/Cosmos%20Laundromat%20small.mp4").openStream(), fos); fos.close(); Movie m = MovieCreator.build(dest.getAbsolutePath()); DefaultMp4Builder builder = new DefaultMp4Builder(); for (Track track : m.getTracks()) { Movie singleTrackMovie = new Movie(Collections.singletonList(track)); builder.build(singleTrackMovie).writeContainer(new RandomAccessFile(track.getHandler() + "_" + track.getTrackMetaData().getTrackId() + ".mp4", "rw").getChannel()); } } }
public static void main(String[] args) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException, URISyntaxException { Movie m = new Movie(); /* m.addTrack( new SMPTETTTrackImpl( new File("C:\\dev\\mp4parser-github\\ttml-example\\subtitle_5_0.xml"), new File("C:\\dev\\mp4parser-github\\ttml-example\\subtitle_5_1.xml"), new File("C:\\dev\\mp4parser-github\\ttml-example\\subtitle_5_2.xml")));*/ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); Document d = dbf.newDocumentBuilder().parse("C:\\dev\\mp4parser-github\\ttml-example\\subtitle_3_0.xml"); m.addTrack( new TtmlTrackImpl("some subtile", Collections.singletonList(d))); DefaultMp4Builder builder = new DefaultMp4Builder(); builder.build(m).writeContainer(new FileOutputStream("output.mp4").getChannel()); } }
public static void main(String[] args) throws URISyntaxException, ParserConfigurationException, IOException, SAXException, XPathExpressionException, TransformerException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder builder = dbf.newDocumentBuilder(); Document doc = builder.parse("C:\\dev\\mp4parser\\a.xml"); List<Document> split = TtmlSegmenter.split(doc, 60); /* for (Document document : split) { pretty(document, System.out, 4); }*/ Track t = new TtmlTrackImpl("a.xml", split); Movie m = new Movie(); m.addTrack(t); Container c = new DefaultMp4Builder().build(m); c.writeContainer(new FileOutputStream("output.mp4").getChannel()); }
public static void main(String[] args) throws IOException { String audioEnglish = RemoveSomeSamplesExample.class.getProtectionDomain().getCodeSource().getLocation().getFile() + "/count-english-audio.mp4"; Movie originalMovie = MovieCreator.build(audioEnglish); Track audio = originalMovie.getTracks().get(0); Movie nuMovie = new Movie(); nuMovie.addTrack(new AppendTrack(new ClippedTrack(audio, 0, 10), new ClippedTrack(audio, 100, audio.getSamples().size()))); Container out = new DefaultMp4Builder().build(nuMovie); FileOutputStream fos = new FileOutputStream(new File("output.mp4")); out.writeContainer(fos.getChannel()); fos.close(); }
public static void main(String[] args) throws IOException { Movie audioMovie = MovieCreator.build("/home/sannies/scm/svn/mp4parser/silence/sample.mp4"); Movie result = new Movie(); Track audio = audioMovie.getTracks().get(0); Track silence = new SilenceTrackImpl(audio, 2000); result.addTrack(new AppendTrack(silence, audio)); Container isoFile = new DefaultMp4Builder().build(result); FileChannel fc = new RandomAccessFile(String.format("output.mp4"), "rw").getChannel(); fc.position(0); isoFile.writeContainer(fc); fc.close(); } }
public static void main(String[] args) throws IOException { String basePath = GetDuration.class.getProtectionDomain().getCodeSource().getLocation().getFile() + "/dash/"; Movie m = new Movie(); IsoFile baseIsoFile = new IsoFile(basePath + "redbull_100kbit_dash.mp4"); List<IsoFile> fragments = new LinkedList<IsoFile>(); for (int i = 1; i < 9; i++) { fragments.add(new IsoFile(basePath + "redbull_10sec" + i + ".m4s")); } m.addTrack(new Mp4TrackImpl(1, new IsoFile("redbull_100kbit_dash.mp4"), new FileRandomAccessSourceImpl(new RandomAccessFile("redbull_100kbit_dash.mp4", "r")), "test")); DefaultMp4Builder builder = new DefaultMp4Builder(); Container stdMp4 = builder.build(m); FileOutputStream fos = new FileOutputStream("out.mp4"); stdMp4.writeContainer(fos.getChannel()); fos.close(); } }
public static void main(String[] args) throws IOException { String audioEnglish = RemoveSomeSamplesExample.class.getProtectionDomain().getCodeSource().getLocation().getFile() + "/count-english-audio.mp4"; Movie originalMovie = MovieCreator.build(audioEnglish); Track audio = originalMovie.getTracks().get(0); Movie nuMovie = new Movie(); nuMovie.addTrack(new ReplaceSampleTrack( new ReplaceSampleTrack( new ReplaceSampleTrack( audio, 25, ByteBuffer.allocate(5)), 27, ByteBuffer.allocate(5)), 29, ByteBuffer.allocate(5))); Container out = new DefaultMp4Builder().build(nuMovie); FileOutputStream fos = new FileOutputStream(new File("output.mp4")); FileChannel fc = fos.getChannel(); out.writeContainer(fc); fos.close(); }
public static void main(String[] args) throws IOException { H264TrackImpl h264Track = new H264TrackImpl(new FileDataSourceImpl("C:\\dev\\mp4parser\\isoparser\\src\\test\\resources\\count.h264")); //AACTrackImpl aacTrack = new AACTrackImpl(new FileInputStream("/home/sannies2/Downloads/lv.aac").getChannel()); Movie m = new Movie(); m.addTrack(h264Track); //m.addTrack(aacTrack); { Container out = new DefaultMp4Builder().build(m); FileOutputStream fos = new FileOutputStream(new File("h264_output.mp4")); FileChannel fc = fos.getChannel(); out.writeContainer(fc); fos.close(); } } }
public static void main(String[] args) throws IOException { String f = Avc1ToAvc3Example.class.getProtectionDomain().getCodeSource().getLocation().getFile() + "/1365070268951.mp4"; Movie m = MovieCreator.build(new FileInputStream(f).getChannel(), new FileRandomAccessSourceImpl(new RandomAccessFile(f, "r")), "inmem"); Movie m2 = new Movie(); for (Track track : m.getTracks()) { if (track.getSampleEntries().get(0).getType().equals("avc1")) { m2.addTrack(new Avc1ToAvc3TrackImpl(track)); } else { m2.addTrack(track); } } new FragmentedMp4Builder().build(m2).writeContainer(new FileOutputStream("output.mp4").getChannel()); IsoFile i = new IsoFile("output.mp4"); for (Box box : i.getBoxes()) { System.err.println(box + "@-nooffsets"); } } }
public static void main(String[] args) throws IOException { DataSource video_file = new FileDataSourceImpl("c:/dev/mp4parser2/source_video.h264"); DataSource audio_file = new FileDataSourceImpl("c:/dev/mp4parser2/source_audio.aac"); int duration = 30472; H264TrackImpl h264Track = new H264TrackImpl(video_file, "eng", 15000, 1001); //supplied duration for the attached file was AACTrackImpl aacTrack = new AACTrackImpl(audio_file); Movie movie = new Movie(); movie.addTrack(h264Track); //movie.addTrack(aacTrack); Container out = new DefaultMp4Builder().build(movie); FileOutputStream fos = new FileOutputStream(new File("c:/dev/mp4parser2/checkme.mp4")); out.writeContainer(fos.getChannel()); fos.close(); } }
public static void main(String[] args) throws IOException { EC3TrackImpl track = new EC3TrackImpl(new FileDataSourceImpl("C:\\Users\\sannies\\Downloads\\audio.ac3")); Movie m = new Movie(); m.addTrack(track); DefaultMp4Builder mp4Builder = new DefaultMp4Builder(); Container isoFile = mp4Builder.build(m); FileOutputStream fos = new FileOutputStream("output.mp4"); FileChannel fc = fos.getChannel(); isoFile.writeContainer(fc); fos.close(); } }
public static void main(String[] args) throws IOException { Movie movie = new Movie(); Track track = new DTSTrackImpl(new FileDataSourceImpl("C:\\Users\\sannies\\Downloads\\Big_Dom_Thl_ENG_5.1_HD_Lossless_1510.dtshd")); movie.addTrack(track); DefaultMp4Builder builder = new DefaultMp4Builder(); Container container = builder.build(movie); FileOutputStream fos = new FileOutputStream("c:\\dev\\isoparser-dtshd-test.mp4"); FileChannel fc = fos.getChannel(); container.writeContainer(fc); fos.close(); } }
public static void main(String[] args) throws IOException { Movie mWithVideo = MovieCreator.build("C:\\dev\\mp4parser\\examples\\src\\main\\resources\\davidappend\\v1.mp4"); Movie mWOutVideo = new Movie(); for (Track track : mWithVideo.getTracks()) { if (track.getHandler().equals("soun")) { mWOutVideo.addTrack(track); } } DefaultMp4Builder b = new DefaultMp4Builder(); Container c = b.build(mWOutVideo); c.writeContainer(new FileOutputStream("output.mp4").getChannel()); } }
public static void main(String[] args) throws IOException { Track ac3Track = new AC3TrackImpl(new FileDataSourceImpl("C:\\dev\\mp4parser\\examples\\src\\main\\resources\\count-english.ac3")); //Track ac3Track = new AC3TrackImplOld(new BufferedInputStream(new FileInputStream("C:\\dev\\mp4parser\\examples\\src\\main\\resources\\count-english.ac3"))); Movie m = new Movie(); m.addTrack(ac3Track); DefaultMp4Builder mp4Builder = new DefaultMp4Builder(); Container out = mp4Builder.build(m); FileOutputStream fos = new FileOutputStream("output.mp4"); FileChannel fc = fos.getChannel(); out.writeContainer(fc); fos.close(); } }
public static void main(String[] args) throws IOException { H264TrackImpl h264Track = new H264TrackImpl(new FileDataSourceImpl("/Users/sannies/dev/mp4parser/1532667754113.h264")); Movie m = new Movie(); m.addTrack(h264Track); Mp4Builder builder = new DefaultMp4Builder(); Container c = builder.build(m); c.writeContainer(new FileOutputStream("/Users/sannies/dev/mp4parser/1532667754113-meins.mp4").getChannel()); } }
public static void main(String[] args) throws IOException { Track track = new H265TrackImpl(new FileDataSourceImpl("c:\\content\\test-UHD-HEVC_01_FMV_Med_track1.hvc")); Movie movie = new Movie(); movie.addTrack(track); DefaultMp4Builder mp4Builder = new DefaultMp4Builder(); Container c = mp4Builder.build(movie); c.writeContainer(new FileOutputStream("output.mp4").getChannel()); }
public static void main(String[] args) throws IOException, XPathExpressionException, SAXException, ParserConfigurationException, URISyntaxException { Movie v = new Movie(); // = MovieCreator.build("C:\\dev\\DRMTODAY-872\\31245689abb7c52a3d0721447bddd6cd_Tears_Of_Steel_600000.mp4"); Track audio = new H264TrackImpl(new FileDataSourceImpl("C:\\Users\\sannies\\Downloads\\test.h264")); v.addTrack(audio); Mp4Builder defaultMp4Builder = new DefaultMp4Builder(); Container c = defaultMp4Builder.build(v); c.writeContainer(new FileOutputStream("output.mp4").getChannel()); } }
public static void main(String[] args) throws IOException { AACTrackImpl aacTrack = new AACTrackImpl(new FileDataSourceImpl("C:\\content\\Cosmos Laundromat small.aac")); H264TrackImpl h264Track = new H264TrackImpl(new FileDataSourceImpl("C:\\content\\Cosmos Laundromat small.264")); Movie m = new Movie(); m.addTrack(aacTrack); m.addTrack(h264Track); DefaultMp4Builder mp4Builder = new DefaultMp4Builder(); Container out = mp4Builder.build(m); FileOutputStream fos = new FileOutputStream("output.mp4"); FileChannel fc = fos.getChannel(); out.writeContainer(fc); fos.close(); } }