+ Post New Thread
Results 1 to 8 of 8
How do you do....it? Thread, Video Rendering Server - a How to Guide in Technical; First things first – Why would I want to do this? With the sheer number of devices out there all ...
  1. #1
    jamesfed's Avatar
    Join Date
    Sep 2009
    Location
    Reading
    Posts
    2,192
    Thank Post
    134
    Thanked 340 Times in 287 Posts
    Rep Power
    84

    Video Rendering Server - a How to Guide

    First things first – Why would I want to do this?
    With the sheer number of devices out there all using different file formats for video you may sometimes come across a video format that cannot be played/edited in Windows; setting up a video rendering server can help solve this by converting the video into a nice .wmv format.

    This article has been together with advice from a number of EduGeek users (see this thread for the helpers) and a little bit of blind luck; as with all processes there are many ways to go about it and this is just one way.

    Software needed-
    Microsoft Windows – Any copy should work fine but I’m using Windows 7 running inside a virtual machine
    Microsoft Expression Encoder v2 (doesn’t work with higher versions as they don’t support command line)
    Directory Monitor from deventerprise.net (its free!)
    Notepad (or your fav .bat editor)

    Something to take note of-
    Video rendering is processor intensive and can consume a tone of your system resources, think carefully about how/where you want to run this as it could seriously muck things up (performance wise).

    The meat-
    1. Install Expression Encoder and Directory Monitor
    2. Create a share on your rendering PC with two subfolders named ‘Input’, ‘Output’ and ‘Scripts’
    3. Apply security settings for users to write/read to input, to read from output
    4. Apply security settings to Scripts so that the local user (or whoever is going to be logged into your rendering server) can read (let everyone else read the folder too if you like to show the script)
    5.Create a bat file with the following code and put it in scripts –

    Code:
    @echo off & setlocal ENABLEEXTENSIONS
    
    :: Call Functions
    call :GetTime h n s t
    call :GetDate y m d
    
    :: Wait (for file to upload)
    echo just gonna wait for the file to upload 
    choice /d y /t 60 > nul 
    echo that should be done! time to get going again :)
    
    :: Convert video
    "C:\Program Files (x86)\Microsoft Expression\Encoder 2\encoder.exe" /source %1 /target "c:\encode\video\output\%h%-%n%-%s%_%y%-%m%-%d%.wmv"
    
    :: Delete origional file
    del %1
    
    :: 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
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    Take note of the ‘Convert video’ section – you may need to change the Expression Encoder and Source paths depending on your setup!

    6. Start Directory Monitor and add a shortcut to it in your start up files (to load it automatically if you need to reboot).
    7. Use it to monitor any new files being created in your input folder and then run the .bat script in ‘Scripts’.
    You can also modify the time that the application looks to the folder for new files from the settings menu.
    8. Deposit a test video into Input, the video encoder should detect it, run the script (which will wait for a few seconds for the video to finish uploading), convert the video and put it in your output folder and then delete the source video.

    You might also wish to consider running some kind of script (maybe in scheduled tasks) to empty the output folder of its contents every now and again to save you doing this manually.

    Right that’s it do enjoy
    Last edited by jamesfed; 9th July 2010 at 02:22 PM. Reason: Add link

  2. #2

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,331
    Thank Post
    622
    Thanked 1,578 Times in 1,415 Posts
    Rep Power
    413
    Just thinking out loud, if we give our students write access to a share they would use it to share exe's and images so maybe delete these types of file when they are detected?

    Ben

  3. #3
    jamesfed's Avatar
    Join Date
    Sep 2009
    Location
    Reading
    Posts
    2,192
    Thank Post
    134
    Thanked 340 Times in 287 Posts
    Rep Power
    84
    Quote Originally Posted by plexer View Post
    Just thinking out loud, if we give our students write access to a share they would use it to share exe's and images so maybe delete these types of file when they are detected?

    Ben
    Good point - one kinda semi good thing is the bat file that runs deletes the file once the render is done so the file would only stay there while the bat file figures out it can't accualy do anything with it and then poof file is gone to oblivion

  4. #4


    Join Date
    Feb 2007
    Location
    51.405546, -0.510212
    Posts
    8,755
    Thank Post
    221
    Thanked 2,628 Times in 1,938 Posts
    Rep Power
    779
    Quote Originally Posted by jamesfed View Post
    Microsoft Expression Encoder v2 (doesn't work with higher versions as they don't support command line)
    Thanks for the guide, James. Once small issue I am finding is that it is next to impossible to download v2.0 from any website that isn't dodgy (like RapidShare). This prompted me to see if there was a way to do this with the latest version of Expression Encoder (v4.0) - and it appears that there is.

    If you look in the "FolderWatcherService" folder within "%ProgramFiles%\Microsoft Expression\Encoder 4\SDK\Samples", you will find the source code to create a Windows service that does exactly the same thing as your batch file. I have written a little guide to get this working. Although there's a lot to do initially, the end result is definitely worth it.


    Software Required
    1. Windows XP with SP3, Windows Vista, Windows 7, Windows Server 2008 or 2008 R2.
      The more processor cores this computer has, the better. A dual Xeon X5680 would be perfect, although not essential.
    2. Microsoft .NET Framework v4.0: Full Profile or Client Profile.
    3. Microsoft Expression Encoder 4: Standard (Download) or Professional.
    4. Microsoft Visual C# 2010 Express (Download). If you already have it installed, Visual Studio 2010 could be used instead. Once steps 5-7 have been completed, you can uninstall this program if you do not need it for anything else.
    5. A text editor that can save in UTF-8 format. Notepad is fine, although I use Notepad2 myself.

      Optional (but recommended)
    6. A DirectShow MPEG-2 decoder such as ffdshow-tryouts (free) or this codec from Elecard ($25) to add support for dvr-ms, mod and vob formats. You will need the x86 version because Expression Encoder 4 is a 32-bit application (even on 64-bit OSs).
    7. The latest version of Apple's QuickTime. Installing this will enable Expression Encoder to import and convert the following audio and video formats: 3g2, 3gp, dv, m4v, mov, mp4, aiff, m4a and m4b. When I tested this, I found just ffdshow on its own isn't enough to decode these formats.
    8. Microsoft Silverlight v4.0. This is required by Expression Encoder, but only if you want to use the Silverlight encoding presets.


    Instructions
    1. Install whichever optional programs you want from the list above. I did the first two.

    2. Install .NET Framework v4.0. The "Client Profile" version is fine.

    3. Install Expression Encoder 4. I'm using the standard edition since it's free.

    4. Install Visual C# 2010 Express. This is also free, but you will need to register to receive a product key from Microsoft.

    5. Run Visual C# 2010 Express. If you are using Vista or 7, right-click its start menu shortcut and select "Run As Administrator". If you don't do this, step 7 will fail.

    6. Open the EncoderFolderWatcherService.csproj project file located in one of the following two folders.

      32-bit Windows: "%ProgramFiles%\Microsoft Expression\Encoder 4\SDK\Samples\FolderWatcherService"
      64-bit Windows: "%ProgramFiles(x86)%\Microsoft Expression\Encoder 4\SDK\Samples\FolderWatcherService"

    7. On the right of the Visual C# IDE you will see a side-bar called "Solution Explorer". Right-click EncoderFolderWatcherService and select "Build". The first time you do this, you will be prompted to save a solution file. Accept the default of EncoderFolderWatcherService.sln and save this to the same folder as the .csproj file. After a few seconds, the source code will be compiled into an EXE and saved into the "\Bin\Release" sub-folder, along with two other files.

    8. This step is entirely optional. If you would like to run the service directly from the Release folder, you can skip to the next step. However, if you prefer the service to be located somewhere else on your HDD, you will need to copy the entire Release folder and paste it in a different location. A sub-folder within %SystemRoot%\System32 could be used, or you can do what I did and copy it to the root of my C: drive and rename the folder to AutoEncoderService so you know what it is.

    9. Next, create a new folder which will be "watched" by the service. Ideally this should not be within the folder containing the service. It can either be a local folder or a shared folder (so your users can put videos into it). As long as the service has read/write access to it, the latter can be on the local machine or another server. In both cases, make sure the volume it is on has plenty of disk space. See the "additional info" post below for the correct permissions to apply. When the service is started for the first time, it will create its own folder hierarchy within the watched folder.

    10. Go to the foldering containing the service, open the configuration file called EncoderFolderWatcherService.exe.config with your favourite text editor and change the values as you see fit. The ones I did are listed below:

      watcherRootDirectory - This is the folder that was created in the step above. It should be changed from \\Server\WatchFolder to a local folder such as X:\Videos or a shared folder like \\ServerName\ShareName. Unless you are the only person who is going to be using the encoder service, a shared folder would be better.

      retryFileCopyDurationSeconds - This is the amount of time (in seconds) you want the service to wait for new files to be copied into the Source folder. Increase this number if it takes longer than 30 seconds for videos to successfully finish copying. I changed it to 120.

      timeToKeepOldFilesSeconds - This value is the amount of time (in seconds) the service will perform housekeeping and clean up old encodes/logs/sources that have been left in the watched folders. The default is 604800 seconds (which is 168 hours or 7 days). If you feel this is too long, you should change it. I changed it to 259200 seconds (3 days).

      I didn't edit any of the e-mail notification settings since I don't want hundreds of e-mails in my inbox every day.

    11. Open a command prompt, change to the service folder and enter the following command to install it. You will need admin rights to do this.

      Code:
      EncoderFolderWatcherService.exe -install

      A dialog box titled "Set Service Login" will appear. This is where you enter the credentials the service will run under. If you want to run it under the SYSTEM account, enter NT AUTHORITY\SYSTEM for the username and leave the two password boxes empty. Alternatively, you could create a user account specifically for this task. If you do, make sure the username is in the format of DOMAIN\USERNAME otherwise the service will fail to install. Once you click OK you should receive a message saying "Microsoft Expression Encoder 4 Folder Watcher has been successfully installed". Do not close the command prompt as you will need it again in a moment.

    12. Go back to the command prompt and enter the command below to start the service. If successful, it will list it as "Running."

      Code:
      EncoderFolderWatcherService.exe -start

      Close the command prompt.

    13. Set the appropriate NTFS permissions on your watched folder (as per the post below).

    14. Open Expression Encoder, choose Transcoding Project and create one or more encoding presets. A preset is an XML file that tells the encoder how you want your files to be encoded. Instructions on how to do this can be found in the help file or here on the MSDN website. Once you have done this, copy it/them into the Presets sub-folder within the watched folder. For testing purposes, you can use the preset I have attached to the next post.

    15. That's all there is to it! Copy a video into the Source folder (it must be on the supported formats list), and after a short while, you will find a WMV in the Output folder which can be imported into Windows Movie Maker.

  5. Thanks to Arthur from:

    SYNACK (11th July 2010)

  6. #5


    Join Date
    Feb 2007
    Location
    51.405546, -0.510212
    Posts
    8,755
    Thank Post
    221
    Thanked 2,628 Times in 1,938 Posts
    Rep Power
    779
    Additional Info

    How does this all work?
    When a media file is dropped into "Source", a watcher will claim it. Move it to the working directory and encode it once for every preset in the Presets folder. The logs will be written to the Log directory and the final output files will appear in the Output directory under a folder with the same name as the preset used.

    Folders
    Code:
    + WatchedFolder
    -- + Source       Serves as your watch folder. Any file placed in this folder is encoded according to the presets you put in the Presets folder.
    -- + Working      Contains the files that are currently being encoded.
    -- + Presets      Serves as the location where you put the presets that dictate how you want your files to be encoded.
    -- + Logs         Contains details about each encoding job.
    -- + Output       Contains all of the final encoded files.

    Permissions
    Code:
    + WatchedFolder   Service: Modify / Users: Read (Share = Everyone: Full Control)
    -- + Source       Service: Modify / Users: Modify
    -- + Working      Service: Modify / Users: None
    -- + Presets      Service: Modify / Users: None
    -- + Logs         Service: Modify / Users: None
    -- + Output       Service: Modify / Users: Read

    Things to watch out for
    • If someone copies a video into the Source folder which cannot be converted, it will be deleted immediately by the service. Therefore it's probably a good idea for the user to keep the original video file (at least until they are happy with the converted video).
    • Since Microsoft's desktop operating systems have a maximum simultaneous inbound connection limit, it would be best to locate the watched folder on a server to prevent users from having issues copying the videos into the shared folder.


    Tips
    • If you install the folder watcher service on several different computers, you can point them all at the same folder and distribute the workload between them. Due to the way the service works, there won't be any conflicts.
    • The File Screening feature in File Server Resource Manager on Windows Server 2003 R2 (or newer) can be used to stop people from putting non-video files into the Source folder.
    • Similarly, access-based enumeration can be used to "hide" folders which users won't have access to (i.e. Working, Presets and Logs).
    • You may find that the folder watcher service will sometimes stop running. By default, it will not restart itself. Therefore, it is worth setting the recovery options for the "Microsoft Expression Encoder 4 Folder Watcher" service using Services.msc.
    • To prevent a specific format from being converted, modify the ignore list on line 24 of SourceFileManager.cs in the Visual C# IDE before you compile the folder watcher service. For example, for .dv files do this...

      Code:
      From: private static string[] ignoreList = new string[] { ".db", ".ini" };
      Code:
      To: private static string[] ignoreList = new string[] { ".db", ".ini", ".dv" };
    Attached Files Attached Files

  7. #6
    jamesfed's Avatar
    Join Date
    Sep 2009
    Location
    Reading
    Posts
    2,192
    Thank Post
    134
    Thanked 340 Times in 287 Posts
    Rep Power
    84
    Quote Originally Posted by Arthur View Post
    Thanks for the guide, James. Once small issue I am finding is that it is next to impossible to download v2.0 from any website that isn't dodgy (like RapidShare). This prompted me to see if there was a way to do this with the latest version of Expression Encoder (v4.0) - and it appears that there is.
    This is why I need to learn to use things like Visual Studio
    I got my copy of Encoder as part of our School agreement

    All the same this is looking like a much better option!

  8. #7

    Join Date
    Dec 2012
    Location
    St Albans
    Posts
    8
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Thanks for the guides James and Arthur!

    I have just got this up and running on Windows Server 2012 with expression encoder 4 - I did need to install the desktop experience before the the service would successfully output anything though. Hope this is useful for anyone else trying to do this.

  9. #8
    Marci's Avatar
    Join Date
    Jun 2008
    Location
    Wakefield, West Yorkshire
    Posts
    888
    Thank Post
    84
    Thanked 234 Times in 193 Posts
    Rep Power
    82
    If you have an Adobe Creative Cloud license, these days it tends to be quicker just to install Adobe Media Encoder CC somewhere on a spare VM / server, set up it's watch folders, and leave it to it.

SHARE:
+ Post New Thread

Similar Threads

  1. Adobe Premier video rendering issue
    By d-taylor in forum Educational Software
    Replies: 11
    Last Post: 14th March 2012, 08:13 PM
  2. Video Rendering Server
    By jamesfed in forum How do you do....it?
    Replies: 20
    Last Post: 9th July 2010, 02:48 PM
  3. Replies: 5
    Last Post: 30th January 2007, 08:21 AM
  4. Firefox not rendering same as IE
    By SimpleSi in forum Web Development
    Replies: 5
    Last Post: 16th December 2006, 05:39 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •