views:

675

answers:

3

I have just coded up a web based flv file download utility. When I try to download an flv file, the browser does not show a progress bar as in I do not see the time left for download. Somewhere I read that this happens if the flv file you are trying to download does not have a meta tag associated with it. So I ran my flv file through the Perl module FLV::Info and I see that meta tag header is present.

Below is an example of the meta tag I see for an flv file:

File name          0.360730744040669.flv
File size          167 bytes
Meta               1 event
  canSeekToEnd     1
  filesize         167
  metadatacreator  FLV::File v0.22
  metadatadate     Wed Feb  4 17:00:07 2009

Anyone any ideas?

+3  A: 

It is likely that your web server is not setting the Content-length header correctly, or something like that.

Is your file really only 167 bytes? That seems somewhat small.

jrockway
+1  A: 

As jrockway says, it's probably the Content-Length header - I'm not sure whether Firefox provides easy access by default, but the Live HTTP Headers plugin gives you access, and if you aren't using Firefox, you could use Wireshark instead (but it's a lot heavier and could take some messing around to be able to find the headers amongst the rest of your network traffic). Once you can see whether this header is getting set (and if it is, whether it is the correct value), you'll know more about how to proceed.

It is worth verifying that you get the progress bar when downloading flv files from other sites, and once that is happening you can start looking at the differences between your sample file, and the ones that behave properly.

I would be somewhat surprised if the contents of the file (which is where FLV::Info gets its details) is used mid-download to calculate progress.

Cebjyre
A: 

The stuff you read about metadata is likely related to how Flash plays videos. The metadata is needed for Flash to know how long the movie is. This is why the metadata is typically placed at the start of the file. When encoding H264 videos, the metadata is placed at the end of the file by tools such as ffmpeg, and to get the "streaming" to work properly you will need to move it to the start.

This should however not have any effect on the progress bar in the browser, that is more likely due to that, for instance, youtube does not set the Content-Length in the header.

grapefrukt