I have a file called video_2.m4v on my computer, which is being used by another program to write data there (video), so the file size is increasing each second. What i want to do is to make something like a streaming upload:
While file is being writed it uploads it to the server. I am using this bash script under windows 7:
@echo off
echo user USER_NAME> ftpcmd.dat
echo PASSWORD>> ftpcmd.dat
echo bin>> ftpcmd.dat
echo cd ROOT_PATH>> ftpcmd.dat
echo put %1>> ftpcmd.dat
ftp -n -s:ftpcmd.dat ftp.example.com
del ftpcmd.dat
This works fine but it captures current file state (size) and just uploads it. Please don’t tell me i need to use RTMP server :).
VLC actually does what i want but i can’t switch to binary mode.
I am using following code:
set VLC_EXE=C:\Program Files (x86)\VideoLAN\VLC\vlc.exe
set SOUT_FTP_DOMAIN=ftp.example.com
set SOUT_FTP_PORT=21
set SOUT_FTP_USERNAME=user
set SOUT_FTP_PASSWORD=password
set SOUT_FTP_PATH=www/example.com
set SOUT_FILENAME=test
"%VLC_EXE%" D:\video_1.m4v :sout=#std{access=ftp,mux=mp4,dst=ftp://%SOUT_FTP_USERNAME%:%SOUT_FTP_PASSWORD%@%SOUT_FTP_DOMAIN%:%SOUT_FTP_PORT%/%SOUT_FTP_PATH%/%SOUT_FILENAME%.mp4} :sout-keep vlc://quit
As this is a programming community, I’ll answer from this point of view. Technically you can implement an FTP client which will do what you want (in other words the protocol allows this) BUT your client needs to be aware of possibility that the file changes its size on the fly. The uploading code of the client can be written in two ways: (1) get file size to X and upload X bytes, and (2) read data blocks from the file and upload them until something indicates end of file.
In your particular case I can hardly understand what can be a command to stop transmission, as the data is generated by another application.
And if you are looking to do what you need via just a batch file, then you are in wrong community and in any way what you want is not possible with http://ftp.exe.