Converting .wtv to .dvr-ms and Removing Adverts in Windows 7 Media Centre

8 Jun

I recently upgraded from Vista ME to Windows 7 MCE and everything works well, except for Lifextender (which uses Comskip) which only works with the older .drv-ms file format and doesn’t support the newer .wtv format that Windows 7 records in. Lifextender was a pretty cool and very simple program that would remove all adverts from .dvr-ms files, thus shrinking the file size and getting rid of annoying adverts, double win.

I struggled to get a copy of Lifextender as the site doesn’t seem to exist anymore and I didn’t want to install the CNET rubbish, anyway I got hold of a copy and you can download it here if you like (Take another look at the buy me a beer box on the right!)

In Windows 7, right clicking on a .wtv file gives you the option to convert to .dvr-ms but doing this manually is time consuming, and time is money.

After a bit of digging, it seems that this option just runs c:\Windows\ehome\WTVConverter.exe against the selected file, so I put this script (below) together to do all the hard work for me. It scans the specified root folder, and all it’s subdirectories, finds any .wtv files, converts them to .dvr-ms and the deletes the original .wtv file. All pretty straight forward. Everything is logged so you can keep an eye on it too.

'Dave Harris

'Free for anyone to us eand modify as they wish. If it's helpful, buy me a beer (See donation button on blog!)

'So this goes throught the scpecified directory and all sub folders, finds .wtv files and converts them to .dvr-ms
'and then deletes the original file, simples.


Set objFSO = CreateObject("Scripting.FileSystemObject")
Const ForAppending = 2
Dim objFSO:Set objFSO = CreateObject("Scripting.FileSystemObject")

LogFile = "c:\ConvertWTV2DVRMS.log"
Dim objLogFile:Set objLogFile = objFSO.CreateTextFile(logfile, 2, True)

'Root of where you want to start
objStartFolder = "F:\"

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

Set objShell = CreateObject("WScript.Shell")

Set objFolder = objFSO.GetFolder(objStartFolder)

Set colFiles = objFolder.Files
For Each objFile in colFiles


ShowSubfolders objFSO.GetFolder(objStartFolder)

Sub ShowSubFolders(Folder)
    For Each Subfolder in Folder.SubFolders

        Set objFolder = objFSO.GetFolder(Subfolder.Path)
        Set colFiles = objFolder.Files
        For Each objFile in colFiles

	'if its a .wtv file
        if (right(objFile.Name,3)="wtv") then

	    myfilename = objFile.Name

	    objLogFile.Writeline(Now()&" Converting "& myfilename)

	    'use the built in converter to convert it to .dvr-ms
            objShell.Run "c:\windows\ehome\WTVconverter.exe """ & Subfolder.Path & "\" & objFile.Name & """", 1, true

	    objLogFile.Writeline(Now()&" Converted "& myfilename)

	    'now delete the .wtv original file
            fso.deletefile Subfolder.Path & "\" & objFile.Name, true

	    objLogFile.Writeline(Now()&" Deleted "& myfilename)

        end if

        ShowSubFolders Subfolder
End Sub



I then set this in a scheduled task to run a few times a day and now all my files are in .dvr-ms format. I then installed Lifextender and set it to delete all the adverts, job done, life extended.