Monday, June 15, 2009

Encoding DVDs to Hard Drive

After using Windows Media Center and Media Center Extender, I found I wanted my DVDs visible within it. At first I used a few legit digital copies of DVDs I have. The results were great. It was great until I had two hard drive crashes one after another. The first time I called and/or emailed the companies I own digital copies and told them my hard drive died and I had to reinstall. They reset my code. This was great, I could readd my movies to my media center extenders and watch it any of those rooms. I no longer had to go find those movies put them in the DVD drive and use another remote to watch them. However the second time, I did not want to go back thru the process. With time I wanted older DVDs in my media center and did not want to go buy newer versions with Digital Copies. So I started investigating how to bring them over. The answer came to me to encode. VLC media player became a natural first program I was directed to on the Internet and worked almost perfectly alone. However on my extenders it would not encode in a format they recognized. Since then this is the process I have elected to follow.

Encoding DVDs to Hard Drive can be done in many ways. There are some propriatary methods and some free methods. Luckily I am able to due this using free methods. Granted this method is not fast and takes quite a bit of time.

What is needed?
  • Microsoft Expression Encoder 2
  • Apple QuickTime
  • VLC Media Player
First, you need Microsoft Expression Encoder 2. This can be expensive, luckily I was able to get this free from Microsoft DreamSpark. Please note: That you must be in college to get this.

For the purposes of this VLC and Microsoft Expression Encoder 2, it also needs Apple Quicktime. VLC will work without it, but the file I make using VLC needs quicktime to encode to WMV.

I imagine that this can be also done with Microsoft Media Encoder 9. I however have written my script to only run thus far with Microsoft Expression Encoder 2 so no other progra will be mentioned here.

You will also need VLC media player.


The great thing about the above is that I got them all free. VLC someday alone may be able to encode perfectly to WMV, but I have had nothing but problems trying to get it to encode and work with Media Center Extenders.


The Script: The Meat and Gravy
I have developed the script so this should work with both x86 and any future or current x64 versions of the software listed above.

Without furthermore here is the script: (Just save the following text to a Batch File and you are ready to go.)

@echo off
color 70
cls

REM Initial Setup of any variables that are needed throughout

rem Set X86 Folder to run on both x86 and x64 in 32-bit mode. This assumes that no x64 software is used, only x64
set ProgRoot=%ProgramFiles%
if not "%ProgramFiles(x86)%" == "" set ProgRoot=%ProgramFiles(x86)%
rem echo %ProgRoot%

set ProgMSExpress=%ProgRoot%
set ProgRootVLC=%ProgRoot%

REM Initial Startup to Test if x64 software is there. This is still in Testing
if exist "%ProgramFiles%\Microsoft Expression\Encoder 2\Encoder" (
set ProgMSExpress=%ProgramFiles%
) else (
rem set ProgMSExpress=%ProgramFiles(x86)%
)
if exist "%ProgramFiles%\VideoLAN\VLC\vlc.exe" (
set ProgRootVLC=%ProgramFiles%
) else (
rem set ProgRootVLC=%ProgramFiles(x86)%
)






ECHO --------------------------------------
ECHO.
ECHO Welcome to DVDEncoder.bat
ECHO.
ECHO Written by
ECHO Shane Purcella
ECHO.
ECHO.
ECHO --------------------------------------
ECHO.
ECHO.
ECHO After Answering the following question, you may wish
ECHO to leave this running overnight until everything is done.

Rem Ask User Input for Title to Use
ECHO.
ECHO.
ECHO.
:input
set INPUT=
set /P INPUT=Type Title Number used by VLC to play DVD Movie: %=%
if "%INPUT%"=="" goto input
set DVDTITLE=%INPUT%



Rem Ask User Input if the user wishes to only encode a set amount of movie
:timeinput
ECHO.
ECHO.
ECHO.
ECHO TYPE AN INTEGER VALUE TO ONLY ENCODE A SET AMOUNT OF MOVIE
ECHO OTHERWISE INPUT ANY OTHER NON INTEGER LETTER
set INPUT=
set /P TIMEINPUT=Type an Integer value to only encode a set amount of movie: %=%
if "%TIMEINPUT%"=="" goto timeinput


if %TIMEINPUT% EQU +%TIMEINPUT% (
set EncodeTime= --stop-time=%TIMEINPUT%
) else (
set EncodeTime=
)
rem echo %EncodeTime%
rem if %TIMEINPUT% EQU +%TIMEINPUT% @echo Variable TIMEINPUT contains an integer.

rem --stop-time=30


cls


echo Using Title %INPUT%

ECHO.
ECHO ...
ECHO.
ECHO.
ECHO.
ECHO.



Echo Generate Time at end of file
rem created unique log filename, Bit like XP\2k : 26-11-2003@Wed@03_41_pm
rem or NT4 26-11-2003@Wed@03_41__

rem get date, make if file name friendly
FOR /F "tokens=1-4 delims=/ " %%i in ('date/t') do set d=%%j-%%k-%%l
rem get time, make if file name friendly
FOR /F "tokens=1-9 delims=:. " %%i in ('time/t') do set t=%%i_%%j_%%k%%l
set LOG=%d%%t%
rem echo YOUR FILE NAME IS : %log%

rem Echo Create File as will be created using Notepad
rem notepad "%~dp0NameMe %log%.wmv"
rem pause





set TEMPFILE=%~dp0FullDVD %log%.mp4
rem echo %tempfile%
set WMVFILE=%~dp0NameMe %log%.wmv

rem pause
color 73
color 84
color 78
cls
ECHO --------------------------------------
ECHO.
ECHO Encoding Starting
ECHO.
ECHO This will take a some time
ECHO.
ECHO.
ECHO --------------------------------------
ECHO.
ECHO ...
ECHO TEMPORARY FILE USED: %TEMPFILE%
ECHO WMV MOVIE FILE USED: %WMVFILE%
ECHO ...
ECHO.
ECHO All Temporary Files will be deleted at the end of this process
ECHO.
ECHO.
ECHO.



rem echo %ProgRootVLC%
rem echo %ProgMSExpress%
rem pause



rem Change to VLC Directory
cd "%ProgRootVLC%\VideoLAN\VLC"


echo Start encoding Movie to Temporary File where this Script was run from
echo Your Temporary File is located and called %tempfile%
vlc %EncodeTime% -vvv "dvd://D:\@%DVDTITLE%" --sout-ffmpeg-qscale 1 :sout=#transcode{vcodec=mp4v,vb=1024,scale=1,acodec=mp4a,ab=192,channels=2}:duplicate{dst=std{access=file,mux=mp4,dst="%TEMPFILE%"}} vlc://quit



ECHO.
ECHO ...
ECHO ...
ECHO.
ECHO.
ECHO.





rem Change to VLC Microsoft Expression Encoder 2 Directory
cd "%ProgMSExpress%\Microsoft Expression\Encoder 2"

echo Start encoding Movie from Temporary File to WMV Format
Encoder.exe /Source "%TEMPFILE%" /Target "%WMVFILE%" /FileOutputMode AsfSingleFile /AspectRatioMode Source

rem Previous Options used
rem /VideoComplexity Best --- Removed as this created really large files and took forever and a day to make







echo Delete Temporary File
del /F /Q "%TEMPFILE%"





Let me know any suggestions and/or comments to give to this script.

How do I use the script?
Well first, I have some work to go, but don't worry it is pretty easy. Before encoding a DVD for use, you need to open VLC.

From Here, choose Media and Open Disc...

At this point a new window will pop up asking you some options to choose. You will need to find the title to encode just the material you want to encode.


Please Note: The Title differs from the Chapters. Some DVDs may include more than one movie or previews as seperate Titles. DVDs that include a Theaterical and Special Edition normally include more than one title for example. Most DVDs seems to work with a Title of 1, however I had one DVD that was all the way up in the early 30's. You just have to choose the title you want and then press Play. This will take some playing around with to get the version or title you want.



When you go to play the movie, you will see the number that you chose briefly show on the screen and then fade away. Make sure that the movie plays fine and that it is the version you want. I normally check it si in English, the length, and that the movie goes all the way to the end. I think some manufactures try to hide under different Titles. I have almost been fooled by versions that appear to be what I want but are really just the commentary.

Launching the Script
Once you find the movie title you want, just launch the script I gave you. It will fist ask a question of
Type Title Number used by VLC to play DVD Movie:
Just enter the title you found to work earlier and press enter.


Next it will ask
TYPE AN INTEGER VALUE TO ONLY ENCODE A SET AMOUNT OF MOVIE
OTHERWISE INPUT ANY OTHER NON INTEGER LETTER
Type an Integer value to only encode a set amount of movie:

This may be confusing, however I have used this for testing and thought it a good idea to release it with this option used. If you want to test out this process and want to make sure that everythig works, just type in a value like 90 and it will record the first 90 seconds of the Movie. Type in any letter, (non integer) and it will record the full movie.


The Encoding Process
Part 1
The Encoding Proscess is a two step process. It will first bring up VLC and encode the movie to a MP4 video from where you run the script. This is a temporary file used later to encode to a WMV File by Microsoft Expression Encoder 2.

Part 2
Next it will use the temporary file mentioned above to encode to a WMV file using Microsoft Expression Encoder 2. This is all by command line and nothing other than the script is shown for this part. This process will normally take some time to encode and set up to work. It will make the file compatible with any Media Center/Media Center Extender at this point.

Cleaning up
At the end of the script it will delete the temporary file created using VLC.


Sunday, March 15, 2009

Introduction


Here I hope to show How to Make a Media Center just work for you. I plan on features that are easy and simple to use. I love my Media Center.







Media Center PC Specs
Motherboard: Asus P5K SE
Intel Core 2 Quad Q6600 @2.4Ghz
4 GB of Ram
NVIDIA GeForce 8600 GT (256 RAM)
Seagate SATA 3.5" BARRACUDA (1.5 TB )

LG Blueray/DVD Burner (lightscribe capable)
XBOX 360 HD-DVD
Windows Vista Ultimate 32-bit (Yes, Windows sees my full 4 GB of Ram, look into chipset)
PNY PCTV 800i



Media Center Extender Hardware
Currently I use the XBOX 360 as an extender in the Living Room. My XBOX 360 (well actually it is my wifes) is set to start into the Media Center at start up. We use the white $20 remote made for the 360. At times we also use a controller to set go thru the menus.

This is a great deal to use your existing Console as a Media Center. The only complaint I have of the 360 is that it is a bit loud especially if you use the DVD Drive (mainly when it starts up). I have this connected to a regular non HD TV flat screen (not a LCD, PLASMA, or other HD Capable Screen).



I also use a Linksys (Cisco) DMA2100 in our Master Bedroom as our extender.

You can find the specs for this beast at Linksys by Cisco Media Center Extender DMA2100
Note that the Linksys DMA 2200 comes with a DVD Drive

This product is great. It allows me to stream using wired (in my case) or wirelessly using the 802.11 N (I only have 2 802.11 G Routers). I have this media center extender plugged directly into our VISIO 22" HD TV via a HDMI cable.


TV Signal
I have tested my set up with the DTV and Comcast Basic Cable Plus. It appears that on Comcast, I am at the end of a long strand. My Media Center PC was losing the signal regualrly (My TV would not, so I did not want to call Comcast). I set up a booster right before plugging into my Media Center PC and I have never lost my signal Since.



I record TV and can watch, resume, pause and even continue in another room. Here is a screenshot from Microsoft of their Windows Media Center.


Next time I hope to go into the Add-Ons I use. Mainly the My Movies Add-On, the best add-on I have found thus far.