Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- ::Converts mov files to mp4's that are compatible with i-devices (iPhone, iPad) and Android
- set WORKING_DIR="C:\Documents and Settings\Jordan.Sun\Desktop\temp\NBC"
- cd WORKING_DIR
- ::This is to make sure we don't run this script if another instance is already running. At the end of this script, we delete this temporary file.
- IF EXIST media.date (
- goto :eof
- ) ELSE (
- echo Process started at: >> media.date
- gnudate >> media.date
- )
- :: Finding any files modified more than 10 min ago but less than 2 days ago, then adding them to the file list that we parse and ftp if the file isn't being written to.
- :: "file.list" is of the form:
- :: FILENAME,FILESIZE
- IF NOT EXIST files.list (
- FOR /F "tokens=*" %%A IN ('gnufind *.mp4 -mmin +10 -mtime -2 -print') do (
- echo %%A,%%~zA >> files.list
- )
- goto :cleanup
- )
- ::Check if the file size (%%~zA) has changed since the last time the script ran (%%B, which is the second column in the files.list file)
- ::If it hasn't changed, then the file isn't being written to so we convert it it, and then "delete" it from the list by writing it to a new temp "files.list" and deleting the original.
- ::If the file HAS changed, then we don't FTP it and keep it in files.list
- FOR /F "tokens=1,2 delims=, " %%A IN (files.list) do (
- IF "%%B"=="%%~zA" (
- echo Here's B: "%%B" and heres A: "%%~zA"
- ffmpeg -i "%%A" -vcodec libx264 -sameq -maxrate 10000000 -bufsize 10000000 -vprofile baseline -level 30 -acodec libvo_aacenc "%%~nA.mp4"
- ) ELSE (
- echo %%A,%%~zA >> files.list2
- )
- )
- ::Here we "update" the files.list. If there are no more files (ie - no live events are going on), then files.list stays blank.
- del files.list
- IF EXIST files.list2 (
- rename files.list2 files.list
- )
- goto :cleanup
- :cleanup
- del media.date
Add Comment
Please, Sign In to add comment