Hope this can help someone else out. I wrote a simple batch file to convert all of my DVD's in VOB format to mpg's. It will simply run through looking for all VIDEO_TS.IFO files, then go back a couple directories to get the name of them, in my case it is teh Movie name and before that a "genre" folder.
I tried to not hard code too much so by changing the SET variables it should accommodate most. Just save the code below to a .bat file and run it.
I am not a "programmer" by any means, and wrote it for me but decided to comment it up a bit and make it easy for most to use should they decide it to be useful. If you have any ideas to make it better, please do so, or even post the ideas here for all to use.
I will answer any questions the best I can.
Code:@echo off :: ONLY TESTED ON VISTA 32bit, test yourself before running, script provided as is. :: I wrote this so I can not only convert my VOB's to MPG, but I wanted to use it in :: a playlist with Media Browser - mediabrowser.tv - and the movie needs to be 1 number :: higher than my home theater intro so I add a 01 to the end of all movies I convert. :: You may remove that if you wish. Search and replace %%b-01.mpg with %%b.mpg :: *** TO USE *** :: Change the 3 SET lines below to match your environment :: This assumes the existing DVD directory structure is like M:\Movies\subfolder\**Movie Name**\VIDEO_TS\VIDEO_TS.IFO :: To actually run the VOB2MPG program, remove the "echo" from the front of the last line. :: the echo is there to show you what the command will actually do when run, no changes :: are made with the echo in front, also you may remove the pause once you are comfortable :: with it running otherwise you have to manually press a key to continue to the next DVD :: once processing is complete on a DVD. :: My directory structure example: :: M:\Movies\Comedy\Click\VIDEO_TS\VIDEO_TS.IFO :: M:\Movies\Anime\Kite\VIDEO_TS\VIDEO_TS.IFO SET MOVIEDRIVE=M: SET MOVIEPATH=M:\Movies SET VOB2MPGPATH=C:\VOB2MPG PRO :: CHANGE TO THE DRIVE AND BASE PATH WHERE THE MOVIE DIRECTORIES ARE STORED %MOVIEDRIVE% CD %MOVIEPATH% :: GET LIST OF ALL FOLDERS CONTAINING A VIDEO_TS.IFO FILE AND LOOP THROUGH EACH FOR /f "tokens=3-4 delims=\" %%a in ('dir VIDEO_TS.IFO /s') DO ( echo +++++++++++ echo Processing: echo Genre=%%a echo Movie Name=%%b echo. :: CHECK TO SEE IF DIRECTORY HAS ALREADY BEEN PROCESSED, IF SO SKIP IT AND MOVE ON IF EXIST "%MOVIEPATH%\%%a\%%b\%%b-01.mpg". ( ECHO File %%b-01.mpg already exists. )ELSE ( echo "%VOB2MPGPATH%\VOB2MPG.EXE" /v="%MOVIEPATH%\%%a\%%b\VIDEO_TS\VIDEO_TS.IFO" /o="%MOVIEPATH%\%%a\%%b\%%b-01.mpg" /MainTitle ) pause echo. )
+ Reply to Thread
Results 1 to 14 of 14
-
-
Thank you so much for the work on this code and it looks like exactly what I am looking for. However, I have no idea what to do with the code you have supplied. I can figure out how to change the parameters from your commenting but after that I am not sure where or what to do with the code. I am using the pro version but don't see an area for dropping in command line code. I am really sorry for my ignorance.
Cliff -
So I never really converted to MPG back when I first wrote this for various reason. However, now is the time. I had some help in being able to determine the movie name by counting backwards from the last token, and adjusted a few other things, to include some logging to keep track of it all.
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
:: version 2
:: ONLY TESTED ON WIN 7 64bit, test yourself before running, script provided as is.
:: I wrote this so I can convert my VOB's to MPG. Script is tweaked from help on experts-exchange billprew and paultomasi
:: *** TO USE ***
:: Change the 4 SET lines below to match your environment.
:: - DRIVE = What drive letter your movies are stored on, NO TRAILING \
:: - MOVIEPATH = What directory to start searching from the DRIVE path, NO TRAILING \
:: - BASEFILE = File to search for, for DVD formats, leave this alone, it counts back from this file
:: - VOB2MPGPATH = Full location of your VOB2MPG.EXE file, NO TRAILING \
::
:: Script was adjusted because I needed to count back from finding a VIDEO_TS.IFO file 2 directories
:: to get the movie name. Then with all the variables retrieved in that process, pass commands to VOB2MPG
::
:: To actually run the VOB2MPG program, remove the "echo" from the front of the last line
:: The echo is there to show you what the command will actually do when run, no changes
:: are made with the echo in front, also you may remove the pause once you are comfortable
:: with it running otherwise you have to manually press a key to continue to the next DVD
:: once processing is complete on a DVD.
:: - Find below: echo "%VOB2MPGPATH%\VOB2MPG.EXE" /v="%%a" /o="%DRIVE%%%~pb\%%~nxc.mpg" /MainTitle
:: - Remove from the front the word: echo
:: - Resulting line should be: "%VOB2MPGPATH%\VOB2MPG.EXE" /v="%%a" /o="%DRIVE%%%~pb\%%~nxc.mpg" /MainTitle
::
:: This will write out MovieName.MPG to the MovieName folder.
::
:: My directory structure example:
:: M:\Movies\Click\VIDEO_TS\VIDEO_TS.IFO
:: M:\Movies2\Kite\VIDEO_TS\VIDEO_TS.IFO
:: M:\Stuff\Movies\Kite\VIDEO_TS\VIDEO_TS.IFO
SET DRIVE=M:
SET MOVIEPATH=Movies
SET BASEFILE=VIDEO_TS.IFO
SET VOB2MPGPATH=C:\VOB2MPG PRO
CLS
:: GET LIST OF ALL FOLDERS CONTAINING A VIDEO_TS.IFO FILE AND LOOP THROUGH EACH
for /f "tokens=*" %%a in ('dir /a-d /b /s "%DRIVE%\%MoviePath%\%BaseFile%"') do (
set str=%%~pa
for %%b in ("!str:~0,-1!") do (
set str=%%~pb
for %%c in ("!str:~0,-1!") do (
:: CHECK TO SEE IF DIRECTORY HAS ALREADY BEEN PROCESSED, IF SO SKIP IT AND MOVE ON
echo %TIME% Processing: %%~nxc ... check %VOB2MPGPATH%\process.log for status
echo. >> "%VOB2MPGPATH%\process.log"
echo %DATE% - %TIME% >> "%VOB2MPGPATH%\process.log"
IF EXIST "%DRIVE%%%~pb\%%~nxc.mpg". (
ECHO File: %%~nxc.mpg already exists. >> "%VOB2MPGPATH%\process.log"
)ELSE (
echo "%VOB2MPGPATH%\VOB2MPG.EXE" /v="%%a" /o="%DRIVE%%%~pb%%~nxc.mpg" /MainTitle
echo %%~nxc processed. >> "%VOB2MPGPATH%\process.log"
)
pause
echo.
)
)
)Last edited by casperinmd; 3rd Nov 2012 at 11:40.
-
This is a great script! I'm just getting an error when I run it though:
Invalid Options: Need at least /v, /t or /All or /MainTitle or /AllTitles and /o
Any ideas? -
Just a guess, remove the () and/or ! As a test. I'm not at home to do any testing.
-
Ok, so it is the ! it does not like. It has to do with ! in DOS batch files b/c they are delimiters.
I'm going to say easiest to remove the ! in your file names and run again. Should run fine.
Note with teh "Echo" in the batch file it said it would run this when it contained a !:
"D:\VOB2MPG PRO\VOB2MPG.EXE" /v="B:\Movies\Fireman Sam Action Stations (2004)\Mo
vies\Fireman Sam Action Stations (2004)\Fireman Sam Action Stations (2004).mpg"
/MainTitle
"D:\VOB2MPG PRO\VOB2MPG.EXE" /v="B:\Movies\Fireman Sam Action Stations (2004)\VI
DEO_TS\VIDEO_TS.IFO" /o="B:\Movies\Fireman Sam Action Stations (2004)\Fireman Sa
m Action Stations (2004).mpg" /MainTitle
hth, casperinmdLast edited by casperinmd; 30th Dec 2012 at 21:12. Reason: formatting
-
Fantastic, thank you for that - i've got a little bit further this time but am now getting the following error:
Version: VOB2MPG PRO
Build: 3.2.2000
Type: System.IO.DirectoryNotFoundException
Source: mscorlib
Message: Could not find a part of the path 'Z:\Movies\Fireman Sam Action Stations (2004)\VIDEO_TS\VIDEO_TS.IFO'.
InnerException:
StackTrace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.IO.FileInfo.Open(FileMode mode, FileAccess access, FileShare share)
at VOB2MPG_PRO.IFO.x32eac27632acc346.xdf42c857cd7e14b 5(String xd580b0e8e63d4102)
at VOB2MPG_PRO.IFO.x32eac27632acc346.xa3a9daebe1fd5c9 3(String xeadccf02f8622700, Boolean xb909d68cec5e9c0b)
at VOB2MPG_PRO.xfed3de3bc2a8e64d.xe26ebb79be088df4()
at VOB2MPG_PRO.xfed3de3bc2a8e64d.x087906680a09f663(Ob ject xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at DevComponents.DotNetBar.Office2007RibbonForm.OnLoa d(EventArgs e)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at VOB2MPG_PRO.x867eb3246b182488.xc447809891322395(St ring[] xce8d8c7e3c2c2426) -
Well the GUI is causing me real issues as I get the error, "Network paths are now allowed in this version of VOB2MPG"
I would move all my movies to a local drive but as I have around 12Tb worth, i'd rather not! I thought initially it was because I was running the free version but I then paid and downloaded the PRO version and still get the same error. -
Ahh, well I am doing it all locally. Can you just run the program from the server that houses all of your files? You can install it and register again on that new computer..not like you are pirating it. (well I did, so I can do most conversion on my HTPC and some one off conversions from my main PC).
-
Thanks again for the reply. I've installed the program on the server and managed to convert the files using the GUI.
I will test the script again and let you know if I have any problems.
Similar Threads
-
Anyone Can Help to Convert This Preset to FFmpeg Command Line?
By raymng in forum Video ConversionReplies: 2Last Post: 26th Feb 2012, 13:11 -
Command line convert mpg to mp4
By csc12345678 in forum Video ConversionReplies: 1Last Post: 30th Dec 2010, 10:11 -
Looking for command line tool to convert srt to ass
By txporter in forum SubtitleReplies: 1Last Post: 23rd Feb 2010, 14:44 -
Easiest way to convert .sub to .srt? maybe some command line tool?
By clinique in forum SubtitleReplies: 2Last Post: 23rd Feb 2010, 13:42 -
Using ffmpeg command line to convert a .vob(DVD) to avi/mpeg
By alfo666 in forum Newbie / General discussionsReplies: 1Last Post: 13th Sep 2009, 04:14