jdzyzh / mp4v2

Automatically exported from code.google.com/p/mp4v2
Other
0 stars 0 forks source link

Pre Allocate MP4 file #60

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

I would like to pre allocate the MP4 file inorder to avoid fragmentation.
Is there an API where by i can create the container by specifying the file
size.

Thanks,
Aswin.N.Paranji

Original issue reported on code.google.com by aswin.pa...@gmail.com on 3 May 2010 at 9:12

GoogleCodeExporter commented 8 years ago
Do you mean file fragmentation?  And you do mean pre-allocate a large file or 
something?

If so, you can probably do this with the custom file provider:

http://mp4v2.googlecode.com/svn/doc/trunk/api/struct_m_p4_file_provider__s.html

Original comment by kid...@gmail.com on 3 May 2010 at 3:41

GoogleCodeExporter commented 8 years ago
Let me know if this is still an issue; resolving defect.

Original comment by kid...@gmail.com on 19 May 2010 at 5:19

GoogleCodeExporter commented 8 years ago
kidjan,

sorry for responding back after 8 months. 
I'm using mp4 container to store video from a camera. I write the video sample 
for 2 minute and finds out how much space it occupies for the 2 minute file. 
Based on the first file, a second file is created to which i need to 
pre-allocate so that file fragmentation does not happen.

I went through the sample for CustomFileProvider. but that is just for reading 
from an MP4 file. I do not know how to use it for File creation. Could you 
please let me know where to set that and how to set the file size.

Also, would it be possible to use the class 'MP4File' for C++.

Thanks,
Aswin.N.Paranji

Original comment by aswin.pa...@gmail.com on 14 Jan 2011 at 10:05

GoogleCodeExporter commented 8 years ago
Aswin,

No, you can use CustomFileProvider for writing an MP4 file as well (in fact, 
this is basically how the built-in file writers in mp4v2 are implemented).  And 
I'm not sure what you mean "set the file size," but if you implement your own 
CustomFileProvider then when you write data, it will call into your code.

Original comment by jnor...@logitech.com on 17 Jan 2011 at 5:02

GoogleCodeExporter commented 8 years ago
Hi,

Let say that i know that the filesize of the mp4 will be 50MB. i want to 
allocate the space to avoid file fragmentation.

is that possible?

Also could let me know how to use the custom file provider to create a file.

Thanks,
Aswin.N.Paranji

Original comment by aswin.pa...@gmail.com on 28 Jan 2011 at 4:09

GoogleCodeExporter commented 8 years ago
Issue 78 has been merged into this issue.

Original comment by kid...@gmail.com on 29 Jan 2011 at 2:39

GoogleCodeExporter commented 8 years ago
Here is an example of using the custom file provider (also note this page 
contains most of the documentation for mp4v2:

http://mp4v2.googlecode.com/svn/doc/trunk/api/example_2provider_2provider_8c-exa
mple.html

Yes, when you open the file, I would think you can automatically allocate 50 MB 
of space--specifically, you'd do this in "my_open" in the custom file provider.

Original comment by kid...@gmail.com on 29 Jan 2011 at 2:41

GoogleCodeExporter commented 8 years ago
KidJan,

The example only shows MP4ReadProvider to read a file. is there something like 
'Mp4WriteProvider' to write the file.

i'll be creating multiple files with different size. how do i send the size 
information to 'my_open' function.

thanks,
Aswin

Original comment by aswin.pa...@gmail.com on 31 Jan 2011 at 12:12

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I guess there isn't.  It could definitely be added pretty easily, though, so if 
you decide to add it I'll incorporate it back into mp4v2.

As for how to send the size information to my_open, I can think of several 
different possibilities, but the implementation details are up to you.

Original comment by jnor...@logitech.com on 31 Jan 2011 at 5:11

GoogleCodeExporter commented 8 years ago
hi jnor,

as suggested by you. i made some modification to the code to do
preallocation of file.
Attached is the code and the sample for you to test.

could you please validate the code and see if this can be enhanced and
merged with the existing tree.

Original comment by aswin.pa...@gmail.com on 22 Feb 2011 at 5:24

GoogleCodeExporter commented 8 years ago
hi jnor,

as suggested by you. i made some modification to the code to do preallocation 
of file.
Attached is the code and the sample for you to test.

could you please validate the code and see if this can be enhanced and merged 
with the existing tree.

Thanks,
Aswin

Original comment by aswin.pa...@gmail.com on 22 Feb 2011 at 5:25

Attachments: