Jump to content

Recommended Posts

Posted

Hi all,

 

As part of the schools digital media sections of IT the students have to capture and edit video – since the IT Teachers want to stick with XP Movie Maker (which I understand because of its simplicity for the year 7/8/9 students) we are constantly running into problems with video file formats not being supported.

 

Usually if a student had some video that couldn’t be edited I would stick it into SUPER and re render the video on my desktop PC however with the volume of video this can sometimes take quite a while.

 

As such I was thinking does anyone know of a way that I could get one of the servers to automatically render the video for me?

 

The way I see this working (or something similar)-

 

1. Student finds they can’t use video in movie maker

2. Student cops video file to a network shared folder

3. Every few minutes the server looks at that folder to see if there is anything in there

4. Server converts video and puts it in a ‘rendered videos’ network folder

5. Server s deletes original video from folder (maybe even deletes the rendered video after a specific time period)

 

What would be even better is if this could also be done with music files to.

 

I know this is a tall order and I’d be happy to have a go at anything.

If I need to run a separate OS (or even Linux) to do this then that shouldn’t be a problem as we have plenty of RAM in our virtual server.

 

Thanks,

James

Posted (edited)

So long as you have all the required codecs to read the files on the server this should not be a problem to implement as you want. A bit of VBS or Batch on a scheduled task along with Expression Encoder and you should be able to do this easily enough.

 

How Do I: Encode a Video from the Command Line

Command-line operation

http://www.edugeek.net/forums/downloads/58812-expression-encoder-4-a.html

Edited by SYNACK
  • Thanks 1
Posted

Wow thanks thats just the kind of answer I was looking for - video was useful and I've got a bat file setup but don't know what source/target values I should be using to do the contents of a folder?

Thanks again!

Posted

You would probably need to do them one by one, your best bet would be to make a VBS script that reads through the file names in that folder one by one and for each of them runs that command line then delets the source file. Something like "encoder.exe /source " & SourceDir & "\" & FileName & " /target f:\encodedvids\" & Filename

pushed into a shell run command.

 

These should have all the required code in them, just a case of combining it into a script and setting it as a scheduled task to run every hour or so:

List All Files in Folder using VBScript

Run Method (Windows Script Host)

Copy, delete or move a file - Real's WSH VBS How-to

Posted

Wow making serious progress now-

Are using Expression Encoder 2 and Directory Monitor from deventerprise.net (expect a quick how to when I get it working perfectly).

Only one thing is - how do I get the bat file that I have setup to output the original file name with the new .wmv extension?

Another option I was thinking about was using the date/time as the filename and then the .wmv extension.

 

Any clues? :D

Posted
how do I get the bat file that I have setup to output the original file name with the new .wmv extension?

 

I use this one for FFmpeg...

 

MP4toWMV.cmd

@echo off
for %%a in (*.mp4) do ffmpeg -y -i "%%a" -b 900k -vcodec wmv2 -acodec wmav2 -ab 128k -ac 2 -ar 44100 "%%~na.wmv"

Posted
Another option I was thinking about was using the date/time as the filename and then the .wmv extension.

 

The following batch file will do that...

 

MP4toWMV_DateAsFilename.cmd

@echo off & setlocal ENABLEEXTENSIONS

:: Call Functions
call :GetTime h n s t
call :GetDate y m d

:: Convert video
for %%a in (*.mp4) do ffmpeg -y -i "%%a" -b 900k -vcodec wmv2 -acodec wmav2 -ab 128k -ac 2 -ar 44100 "%h%-%n%-%s%_%y%-%m%-%d%.wmv"

:: Exit
goto :EOF

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:GetTime hh nn ss tt
::
:: By:   Ritchie Lawrence, updated 2007-05-12. Version 1.3
::
:: Func: Loads local system time components into args 1 to 4.
::       For NT4/2000/XP/2003
:: 
:: Args: %1 Var to receive hours, 2 digits, 00 to 23 (by ref)
::       %2 Var to receive minutes, 2 digits, 00 to 59 (by ref)
::       %3 Var to receive seconds, 2 digits, 00 to 59 (by ref)
::       %4 Var to receive centiseconds, 2 digits, 00 to 99 (by ref)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal ENABLEEXTENSIONS
for /f "tokens=5-8 delims=:,. " %%a in ('echo/^|time') do (
 set hh=%%a&set nn=%%b&set ss=%%c&set cs=%%d)
if 1%hh% LSS 20 set hh=0%hh%
endlocal&set %1=%hh%&set %2=%nn%&set %3=%ss%&set %4=%cs%&goto :EOF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:GetDate yy mm dd
::
:: By:   Ritchie Lawrence, 2002-06-15. Version 1.0
::
:: Func: Loads local system date components into args 1 to 3.
::       For NT4/2000/XP/2003.
:: 
:: Args: %1 var to receive year, 4 digits (by ref)
::       %2 var to receive month, 2 digits, 01 to 12 (by ref)
::       %3 Var to receive day of month, 2 digits, 01 to 31 (by ref)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal ENABLEEXTENSIONS
set t=2&if "%date%z" LSS "A" set t=1
for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('echo/^|date') do (
 for /f "tokens=%t%-4 delims=.-/ " %%d in ('date/t') do (
   set %%a=%%d&set %%b=%%e&set %%c=%%f))
endlocal&set %1=%yy%&set %2=%mm%&set %3=%dd%&goto :EOF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

  • Thanks 1
Posted

Perfect!!

 

Code is now-

@echo off & setlocal ENABLEEXTENSIONS

:: Call Functions
call :GetTime h n s t
call :GetDate y m d

:: Convert video
"C:\Program Files (x86)\Microsoft Expression\Encoder 2\encoder.exe" /source %1 /target "c:\encode\output\%h%-%n%-%s%_%y%-%m%-%d%.wmv"

:: Exit

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:GetTime hh nn ss tt
::
:: By:   Ritchie Lawrence, updated 2007-05-12. Version 1.3
::
:: Func: Loads local system time components into args 1 to 4.
::       For NT4/2000/XP/2003
:: 
:: Args: %1 Var to receive hours, 2 digits, 00 to 23 (by ref)
::       %2 Var to receive minutes, 2 digits, 00 to 59 (by ref)
::       %3 Var to receive seconds, 2 digits, 00 to 59 (by ref)
::       %4 Var to receive centiseconds, 2 digits, 00 to 99 (by ref)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal ENABLEEXTENSIONS
for /f "tokens=5-8 delims=:,. " %%a in ('echo/^|time') do (
 set hh=%%a&set nn=%%b&set ss=%%c&set cs=%%d)
if 1%hh% LSS 20 set hh=0%hh%
endlocal&set %1=%hh%&set %2=%nn%&set %3=%ss%&set %4=%cs%&goto :EOF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:GetDate yy mm dd
::
:: By:   Ritchie Lawrence, 2002-06-15. Version 1.0
::
:: Func: Loads local system date components into args 1 to 3.
::       For NT4/2000/XP/2003.
:: 
:: Args: %1 var to receive year, 4 digits (by ref)
::       %2 var to receive month, 2 digits, 01 to 12 (by ref)
::       %3 Var to receive day of month, 2 digits, 01 to 31 (by ref)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal ENABLEEXTENSIONS
set t=2&if "%date%z" LSS "A" set t=1
for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('echo/^|date') do (
 for /f "tokens=%t%-4 delims=.-/ " %%d in ('date/t') do (
   set %%a=%%d&set %%b=%%e&set %%c=%%f))
endlocal&set %1=%yy%&set %2=%mm%&set %3=%dd%&goto :EOF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

Last thing to do now is to get it to delete the origional file when its done and thats me happy for the day :)

Posted
Last thing to do now is to get it to delete the origional file when its done and thats me happy for the day :)

 

Which was indeed just call the del command for %1

 

Wow this project has worked out better than expected!

Time to do a little testing and then I'll mash together a How to

Posted

How about reading the owner of the original creator of the file then having the server dump the converted movie in the home folder and then delete the original?

 

Ben

Posted

James. I noticed you missed out the goto :EOF in your batch file. You should keep that. By the way, thanks for the link to that Directory Monitor program. It looks really good. :)

 

How about reading the owner of the original creator of the file then having the server dump the converted movie in the home folder and then delete the original?

That's a brilliant idea! Is there an easy way to do that?

Posted
James. I noticed you missed out the goto :EOF in your batch file. You should keep that.

 

Ooops its in there now :) I've also added a pause in the code to as everytime someone tried to upload a file it tried to start rendering immedately (and as the file wasn't totaly uploaded it failed).

 

Should have the final steps to take out in the next few hours (to many things today being the only Tech in!).

Posted
The following batch file will do that...

 

Hi Arthur - if this is your code could I have your permission to include it (in its current state) in the guide I'm putting together?

 

Thanks,

James

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...