monstersb / mp4parser

Automatically exported from code.google.com/p/mp4parser
1 stars 0 forks source link

Allow to add/remove boxes in IsoFile #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am trying to solve the problem with MP4 streaming. FFPMEG place Moov atom 
header to the end of MP4 which prevents proper streaming in FLASH.

I used trunk version of mp4parser:
IsoBufferWrapper isoBufferWrapper = new IsoBufferWrapper(new 
File("C:/test.mp4"));
IsoFile isoFile = new IsoFile(isoBufferWrapper);
isoFile.parse();
isoFile.parseMdats();

Box[] boxes = isoFile.getBoxes();

IsoFileConvenienceHelper.switchToAutomaticChunkOffsetBox(isoFile);
//moving MOOV header to front
Box[] fixed = new Box[]{boxes[0], boxes[3], boxes[2], boxes[1]};

//no direct api to change the order of boxes in isoFile
Field field = isoFile.getClass().getDeclaredField("boxes");
field.setAccessible(true);
field.set(isoFile, fixed);

IsoOutputStream isos = new IsoOutputStream(new FileOutputStream(new 
File("c:/testFixed.mp4")));
isoFile.getBox(isos);

So i have used reflection to change boxes array in IsoFile. Without that i will 
get incorrect offset because boxes in isoFile will use old offsets when writing 
to file.

P.S May you please release trunk 1.0-alpha-2-SNAPSHOT as artifact to maven ?

Original issue reported on code.google.com by werde...@gmail.com on 13 Jan 2011 at 7:46

GoogleCodeExporter commented 9 years ago
Ooops didn't look into the defects for a long time. It's done and available as 
1.0-beta-2

Original comment by Sebastian.Annies on 16 Apr 2011 at 7:28