Analyzing flv takes too long

Analyzing flv takes too long

Postby franki » Fri Sep 19, 2008 5:00 am

Just in comparison to a mp3 (about same size) it takes demo.browse.php approx. 10 - 14 seconds to analyze a flv. mp3 just needs half a second. Perhaps this can be a reason why I have problems with SWFUPLOAD and getid3. Maybe!! it takes too long for the flash uploader. Any idea how I can speed up analyzing flv?

TIA

Edit: Tested with XAMPP on Mac OSX, PHP 5.25, getid3 is v1.7.8b2. It seems to be that the whole file is read. ... Tested a bit and indeed the file pointer is moved until the end of the file ($ThisFileInfo['avdataend'] = 12641385). Is this really necessary? I do not know where the meta-information of a flv is placed - at the beginning? at the end? For MY needs mimetype, duration and bitrate will be enough.

Edit 2: I just reduced avdataend to 15000 and with a small delay of 2 seconds the flash uploader responded. That's the good news, bad is: the returned duration and bitrate is of course complete nonsense now (0 seconds and a bitrate of 13639 kBit/s).
Last edited by franki on Fri Sep 19, 2008 1:22 pm, edited 2 times in total.
franki
User
 
Posts: 7
Joined: Fri Sep 19, 2008 4:53 am

Re: Analyzing flv takes too long

Postby James Heinrich » Fri Sep 19, 2008 5:24 am

The sample .flv files I have here don't take unusually long to process. Please post (or PM me) a link to a sample .flv file that takes 10+ seconds to process and I'll take a look at it.
James Heinrich
getID3() v1 developer
 
Posts: 1203
Joined: Fri May 04, 2001 11:00 am
Location: London, ON, Canada

Re: Analyzing flv takes too long

Postby franki » Tue Sep 23, 2008 2:50 am

I have found something here: http://www.tommylacroix.com/2008/07/04/ ... n-the-fly/

I don't know if this could be of use for you? You'll also find the source there.
franki
User
 
Posts: 7
Joined: Fri Sep 19, 2008 4:53 am

Re: Analyzing flv takes too long

Postby James Heinrich » Tue Sep 23, 2008 7:33 am

Apparently the line that breaks out of the loop once all the needed data was found is missing.

edit: broken code removed

Processing time for provided 12MB sample file on my test machine went from 1.56s to 0.25s, I would expect slower machines to see a proportionately larger decrease in processing time.
James Heinrich
getID3() v1 developer
 
Posts: 1203
Joined: Fri May 04, 2001 11:00 am
Location: London, ON, Canada

Re: Analyzing flv takes too long

Postby franki » Tue Sep 23, 2008 8:12 am

Cool! Will test it this evening and report! Thanks a lot!
franki
User
 
Posts: 7
Joined: Fri Sep 19, 2008 4:53 am

Re: Analyzing flv takes too long

Postby qwertywin » Wed Sep 24, 2008 9:00 am

is this the same for 1.7.7?
qwertywin
User
 
Posts: 10
Joined: Mon Sep 22, 2008 9:29 am

Re: Analyzing flv takes too long

Postby franki » Wed Sep 24, 2008 11:05 am

Should be the same, but I did not look. Unfortunately the if-clause is not working - in the sense of speed yes - in the sense of accuracy no. Duration is now 0:00 seconds and the file has now a bitrate of 332,668 kbps. :-(
franki
User
 
Posts: 7
Joined: Fri Sep 19, 2008 4:53 am

Re: Analyzing flv takes too long

Postby James Heinrich » Wed Sep 24, 2008 8:19 pm

Hmm, you're right, I tested that poorly, sorry :(

On second look, the only way to get duration is to examine the timestamp of the last data block in the file. Perhaps if I wrote some ingenious back-scanning code to look for the audio/video block starting from the end of the file it would be the "good" way of optimizing speed for long files; as it is right now getID3 scans forward through each data block (only parses the first instance of each, but still needs to read each location).

At this time I cannot offer any significant performance improvements, sorry (the back-scanning code is non-trivial, the data blocks don't have an easy-to-detect signature to scan for).
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 0 guests

cron