play video .wmv files while they are uploaded with rsync
I have a public server updated with rsync running each minute from a local server. The files copied are videos for our customers. These videos are constantly produced in .wmv format, some 400 each day. Our customers must be able to see them as soon as posible, they access them using a home-developed php web site that publish them.
The problem is, the video cant be viewed until finished the rsync. videos can be any size from 1 Mb to 150 Mb, with my internet access speed that can be anything from a few seconds to dozens of minutes.
While copying a file, rsync creates a temporary file with the real name of the file, but with a '.' prefix and a ramdomly generated suffix. So, from php I can know that a file is being uploaded, an actually start the play, but then rsync finish the transmission and mv the file to its correct name. To play the file I use this: <object id="MediaPlayer" width="320" height="320" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" ...
<param name="FileName" value="myvideo.wmv">
<param name="AutoStart" value="true">
Is there a way to stream the file without interruption during its upload to the server, and even after finishing the upload, while it is moved (renamed)?
thanks in advance,
I haven't tried this for your particular type of application, but the '--inplace' option should copy directly to the destination file without the rename. Check 'man rsync' for the details on the option.
Thanks! I will try it, but this is in the rasyn man for the '--inplace' option:
WARNING: The file’s data will be in an inconsistent state during the transfer (and possibly afterward if the transfer gets interrupted), so you should not use this option to update files that are in use.
May be that warning is specific to certain type of files, and does not apply to videos? Besides, will the new parts of the file be played?
What the warning is telling you is that the file is being written to; the file is changing as you are reading. The inconsistent state in this case for your application is that while it appears to all be there (the length is correct) if you try to seek past the data that has been written, the application will get an error until the rsync completes.
|All times are GMT -5. The time now is 08:24 AM.|