essential61/mp4analyser

mp4analyser does not process mp4 files > approx. 2,5 GB

Pleonasmus opened this issue · 4 comments

Just today I started to use mp4analyser. It is a very helpul tool, thanks to the author. However, it only managed to load a mp4 file of 2.713.599.692 Bytes length (and any smaller file I used), but failed with another mp4 file with 3.249.745.066 Bytes in length and larger ones.

It throws exceptions:

Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Doc\AppData\Local\Programs\Python\Python38\lib\tkinter_init_.py", line 1883, in call
return self.func(*args)
File "D:\Entwicklungsprojekte\MP4 Analyzer\mp4analyser.py", line 174, in open_file
new_file = mp4.iso.Mp4File(filename)
File "D:\Entwicklungsprojekte\MP4 Analyzer\mp4\iso.py", line 57, in init
current_box = box_factory(f, current_header, self)
File "D:\Entwicklungsprojekte\MP4 Analyzer\mp4\iso.py", line 41, in box_factory
the_box = _box_class(fp, header, parent)
File "D:\Entwicklungsprojekte\MP4 Analyzer\mp4\iso.py", line 258, in init
current_box = box_factory(fp, current_header, self)
File "D:\Entwicklungsprojekte\MP4 Analyzer\mp4\iso.py", line 41, in box_factory
the_box = _box_class(fp, header, parent)
File "D:\Entwicklungsprojekte\MP4 Analyzer\mp4\iso.py", line 258, in init
current_box = box_factory(fp, current_header, self)
File "D:\Entwicklungsprojekte\MP4 Analyzer\mp4\iso.py", line 41, in box_factory
the_box = _box_class(fp, header, parent)
File "D:\Entwicklungsprojekte\MP4 Analyzer\mp4\iso.py", line 258, in init
current_box = box_factory(fp, current_header, self)
File "D:\Entwicklungsprojekte\MP4 Analyzer\mp4\iso.py", line 41, in box_factory
the_box = _box_class(fp, header, parent)
File "D:\Entwicklungsprojekte\MP4 Analyzer\mp4\iso.py", line 548, in init
bytes_left = self.size - (self.header.length + 8)
AttributeError: 'Header' object has no attribute 'length'

I'm just running the module from the idle shell.

Installed Python version:
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32

I'm running WINDOWS 10 Home, Version 10.0.18362 Build 18362 on my PC.

Best regards

Hi,
Can you try changing line 548 of iso.py from

`bytes_left = self.size - (self.header.length + 8)`

to

bytes_left = self.size - (self.header.header_size + 8)

Let me know if it works.

Steven

Hi Hans,
The issue was not with file size. Some atoms/boxes such as 'tsel' are quite rare, so the code may not have been exercised before.

Regarding your query I can make some general comments.

Files conforming to the MP4 standard generally have 1 of 2 formats.

Firstly, there is the monolithic mp4 file format where there is a single 'moov' box containing metadata and a single 'mdat' box containing the media samples. Within the 'moov' box are series of tables underneath the stbl atom that effectively provide an index to the individual frames of the video within the mdat.

The second format is "fragmented mp4", used in applications like mpeg-dash where there is a 'moov' atom at the beginning that does NOT contain sample tables but just generic metadata, followed by an alternating sequence of 'moof' and 'mdats' where the moof contains the pointers to the individual samples of the following mdat.

I suspect your camera files are some kind of hybrid between the above 2 formats and you need to find out where the sample tables are located. There may be some private uuid atoms defined.

Steven