analyze() is running slow

analyze() is running slow

Postby quali74 » Wed May 20, 2009 10:55 am

Hi

Does anybody know why the analyze() function could run slowly? My video files are 70 MB large and it takes a very long time for the GetID3 to extract the width and height.

Thanks
quali74
User
 
Posts: 3
Joined: Wed May 20, 2009 9:49 am

Re: analyze() is running slow

Postby Pernod » Wed May 20, 2009 10:59 am

What do you call a very long time? The size of the file shouldn't be relevant as GetID3 is only looking at the file header in most cases. What is the file format of the videos (avi, mkv, etc.)?
Pernod
getID3() contributor
 
Posts: 100
Joined: Sat Mar 21, 2009 12:30 pm
Location: London, UK

Re: analyze() is running slow

Postby quali74 » Wed May 20, 2009 11:08 am

The video format is FLV. It takes about 30 seconds.
With another video which is WMV, it runs fine and very fast.

I only need the width and height. Is there a way I analyze() could only return those values?
quali74
User
 
Posts: 3
Joined: Wed May 20, 2009 9:49 am

Re: analyze() is running slow

Postby Pernod » Wed May 20, 2009 12:34 pm

From looking at the code, GetID3 is actually seeking for header data throughout the entire file, whereas it should actually only seek through the actual header. This would explain the time taken.

This should be reported as a bug.
Pernod
getID3() contributor
 
Posts: 100
Joined: Sat Mar 21, 2009 12:30 pm
Location: London, UK

Re: analyze() is running slow

Postby franki » Wed May 20, 2009 3:50 pm

read this: viewtopic.php?f=3&t=886

The link I posted could be useful.
franki
User
 
Posts: 7
Joined: Fri Sep 19, 2008 4:53 am

Re: analyze() is running slow

Postby Pernod » Wed May 20, 2009 6:56 pm

I now see that the reason for seeking throughout the whole file is to determine the duration, but the duration is also available in the metadata so there is no need to do this.

I'm also seeing incorrect audio details being returned so it could take a little while to figure this out.
Pernod
getID3() contributor
 
Posts: 100
Joined: Sat Mar 21, 2009 12:30 pm
Location: London, UK

Re: analyze() is running slow

Postby quali74 » Thu May 21, 2009 3:49 am

hi

that is correct. I also get errors regarding the audio used in the FLV.

Notice Undefined offset: 3 in getid3\module.audio-video.flv.php 234
quali74
User
 
Posts: 3
Joined: Wed May 20, 2009 9:49 am

Re: analyze() is running slow

Postby Pernod » Thu May 21, 2009 9:23 am

I have made the following changes to the flv module:
- Added details of missing audio/video codecs.
- Fixed parsing of audio tag.
- playtime_seconds is now set to duration from onMetaData. If the duration metadata does not exist then the whole file will be parsed.

All details returned have been verified against MediaInfo.

Hope James can include this with the next release.
Attachments
module.audio-video.flv.v0.5.zip
(3.81 KiB) Downloaded 406 times
Pernod
getID3() contributor
 
Posts: 100
Joined: Sat Mar 21, 2009 12:30 pm
Location: London, UK

Re: analyze() is running slow

Postby James Heinrich » Sun May 24, 2009 8:43 am

Good work, thanks. I've reviewed the changes and will include them in the next release (including v2.x)

[edit]attachments replaced with newer ones in later post[/edit]
James Heinrich
getID3() v1 developer
 
Posts: 1203
Joined: Fri May 04, 2001 11:00 am
Location: London, ON, Canada

Re: analyze() is running slow

Postby Pernod » Sun May 24, 2009 9:54 am

Thanks, was hoping for some feedback from the OP but seems to have disappeared.
Pernod
getID3() contributor
 
Posts: 100
Joined: Sat Mar 21, 2009 12:30 pm
Location: London, UK

Re: analyze() is running slow

Postby James Heinrich » Mon May 25, 2009 5:47 pm

Now v0.6 is even better with better support for h264, thanks Evgeny Moysevich.
Attachments
module.audio-video.flv.php
v2.x
(21.66 KiB) Downloaded 233 times
module.audio-video.flv.php
v1.x
(21.9 KiB) Downloaded 250 times
James Heinrich
getID3() v1 developer
 
Posts: 1203
Joined: Fri May 04, 2001 11:00 am
Location: London, ON, Canada


Return to Support 1.x (resolved)

Who is online

Users browsing this forum: No registered users and 1 guest

cron