play video .wmv files while they are uploaded with rsync
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
play video .wmv files while they are uploaded with rsync
hello,
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)?
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,500
Rep:
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?
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,500
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.