View Full Version : Batch file to convert 4K files using rtvtools
jason531
01-07-04, 11:31 AM
Hi,
I did a quick search but couldn't find where anyone has done this already, so I wrote a quick batch file and am posting it here in case anyone else finds it useful.
I have a number of files that I downloaded from my 450x that I want to edit with Womble and convert to DivX. First, I need to correct the PTS errors and such and don't want to use Womble's GOP Fixer since I prefer to do this in batch mode.
This batch file works on Windows 2000 and XP. It assumes the .mpg and corresponding .ndx files are in the current directory. For each .ndx file, it does the following:
[list=1]
Creates a default edit text (.txt) file. This does NOT mark/detect any commercial breaks. (I do this manually in Womble).
Runs rtvedit to create a 5K-compatible file (necessary for rtvconvert).
Runs rtvconvert to create the Womble-ready (and DVD-compliant) file.
[/list=1]
Good luck!
-Jason
Code updated 1/7/04 at 1205 (GMT-6) to fix loop problem
@echo off
path=c:\rtvtools\rev4\bin\win32;%PATH%
FOR %%F IN (*.ndx) DO (
echo temp> %%~nF.tmp
)
FOR %%F IN (*.tmp) DO (
echo F%%~nF.mpg> %%~nF.txt
echo E>> %%~nF.txt
rtvedit "%%~nF.txt"
rtvconvert "%%~nF1.mpg" "%%~nF2.mpg"
del "%%F"
)
Originally posted by jason531
@echo off
path=c:\rtvtools\rev4\bin\win32;%PATH%
FOR %%F IN (*.ndx) DO (
echo temp> %%~nF.tmp
)
FOR %%F IN (*.tmp) DO (
echo F%%~nF.mpg> %%~nF.txt
echo E>> %%~nF.txt
rtvedit "%%~nF.txt"
rtvconvert "%%~nF1.mpg" "%%~nF2.mpg"
del "%%F"
)
I can't wait to try this when I get home. I've stuck with the DOS Command method because I prefer to RTVedit/RTVconvert/Womble edit the files as well.
One thing I've introduced into my routine is removing the first 2-5 seconds of each program when RTVedit-ing it, simply because it seems to make the file a little more bulletproof.
How 'bout if I add a line into your batch file to have the first few seconds trimmed from the mpg?
...
echo F%%~nF.mpg> %%~nF.txt
echo A000:05.000> %%~nF.txt
echo E>> %%~nF.txt
...
Can you confirm if that's the right syntax to do the trick?
Thanks,
Tim
jason531
01-07-04, 02:34 PM
Actually, you need one more ">" character, like this:
...
echo F%%~nF.mpg> %%~nF.txt
echo A000:05.000>> %%~nF.txt
echo E>> %%~nF.txt
...
A single ">" creates a new file, while a double ">>" appends to the file. I hope it works for you -- it looks good to me.
Originally posted by jason531
...A single ">" creates a new file, while a double ">>" appends to the file...
Of course! I knew my batch writing skills had a lot of rust on them.
Thanks,
Tim
jason531
01-09-04, 10:27 AM
Originally posted by tluxon
One thing I've introduced into my routine is removing the first 2-5 seconds of each program when RTVedit-ing it, simply because it seems to make the file a little more bulletproof.
Tim,
By "more bulletproof," do you mean less likely to have audio sync problems? I am having audio sync problems with some files I converted.
Best regards,
Jason
Yes. When I first started using rtvtools, I noticed I was having synch problems occasionally, especially on longer programs. I stumbled across a post where either Lee Thompson or agent-x mentioned trimming off the first few GOPs of a file to a poster that was having problems. I tried it myself and it worked on one of my problem files. Ever since then I have used the line "A000:05.000" as the first editing line in my rtvedit script and haven't had any problems. I'm pretty sure the 5 seconds could be 2 seconds and make no difference - I just don't usually need to keep the first 5 seconds of any of my files.
Cheers,
Tim
Jason,
When I first looked at this batch file, I thought it would only act on the files associated with the one you drag and drop onto it, but it turns out that your batch file converts ALL the programs in its folder. I'd rather not convert the whole folder, nor do I prefer to have to move the files to a "rtvec" folder to in order to batch convert selectively.
How would you modify this batch file so it only rtvedit/rtvconverts the single program associated with the file you drag and drop on top of it?
Thanks,
Tim
MrFussy
01-12-04, 08:57 AM
You'd probably have to pass each of the selected files as command line parameters. Your batch file would then have to parse this list. I know I've done stuff like this before, but its been a while ... OK, a long time ago.
Originally posted by tluxon
Jason,
When I first looked at this batch file, I thought it would only act on the files associated with the one you drag and drop onto it, but it turns out that your batch file converts ALL the programs in its folder. I'd rather not convert the whole folder, nor do I prefer to have to move the files to a "rtvec" folder to in order to batch convert selectively.
How would you modify this batch file so it only rtvedit/rtvconverts the single program associated with the file you drag and drop on top of it?
Thanks,
Tim
jason531
01-12-04, 09:52 AM
Sorry about that.
This should work for dragging and dropping. Please let me know if you have any problems.
-Jason
P.S. This assumes all of the files you want to convert are in the same folder if you drag/drop more than one file.
@echo off
path=c:\rtvtools\rev4\bin\win32;%PATH%
FOR %%F IN (%*) DO (
cd %%~dpF
%%~dF
echo temp> %%~nF.tmp
)
FOR %%F IN (*.tmp) DO (
echo F%%~nF.mpg> %%~nF.txt
echo A000:03.000>> %%~nF.txt
echo E>> %%~nF.txt
rtvedit "%%~nF.txt"
rtvconvert "%%~nF1.mpg" "%%~nF2.mpg"
del "%%F"
)
I was doing a search for batch files to do this same thing and this was the only thing I've found... however, I would like to use evtdump to aid rtvedit in deleting the commercials (I've had great luck with getting it to work perfectly on the files I work with most). And I DO like the idea of being able to run it and process an entire folder at once. How could I edit this file to do that? My batch writing skills are so rusted, I can understand what this one is saying but definitely don't trust myself to edit it...
Thanks a bunch. :) :)
jason531
03-01-04, 04:55 PM
Actually the "process every file in the current folder" version was up further in the thread, but here are both versions for reference:
Process all files in current folder version
@echo off
path=c:\rtvtools\rev4\bin\win32;%PATH%
FOR %%F IN (*.ndx) DO (
echo temp> %%~nF.tmp
)
FOR %%F IN (*.tmp) DO (
echo F%%~nF.mpg> %%~nF.txt
echo A000:05.000>> %%~nF.txt
echo E>> %%~nF.txt
rtvedit "%%~nF.txt"
rtvconvert "%%~nF1.mpg" "%%~nF2.mpg"
del "%%F"
)
Process files specified as command-line args (drag/drop version)
@echo off
path=c:\rtvtools\rev4\bin\win32;%PATH%
FOR %%F IN (%*) DO (
cd %%~dpF
%%~dF
echo temp> %%~nF.tmp
)
FOR %%F IN (*.tmp) DO (
echo F%%~nF.mpg> %%~nF.txt
echo A000:05.000>> %%~nF.txt
echo E>> %%~nF.txt
rtvedit "%%~nF.txt"
rtvconvert "%%~nF1.mpg" "%%~nF2.mpg"
del "%%F"
)
If there is sufficient interest, I'll add some comments to the code and perhaps throw a page onto my site describing how to set up drag/drop for this.
msuc5vette
12-09-04, 08:10 PM
I feel like I keep bouncing from searched post to searched post.
I would like to edit the following batch file to delete the commercials automatically, but I don't fully understand what a few of the lines are doing.
Primarily these three lines:
echo F%%~nF.mpg> %%~nF.txt
echo A000:05.000>> %%~nF.txt
echo E>> %%~nF.txt
I understand that it is creating a file based on the mpg to use to rtvedit, and it adds 5 seconds, but where to I instruct it to delete the commercials?
A batch library would be an awesome addition to the FAQ~!
@echo off
path=c:\ReplayTV\rev4\bin\win32;%PATH%
FOR %%F IN (*.ndx) DO (
echo temp> %%~nF.tmp
)
FOR %%F IN (*.tmp) DO (
echo F%%~nF.mpg> %%~nF.txt
echo A000:05.000>> %%~nF.txt
echo E>> %%~nF.txt
rtvedit "%%~nF.txt"
rtvconvert "%%~nF1.mpg" "%%~nF2.mpg"
rem del "%%F"
)
You would need to apply the .evt file to edit out commercials, and unless you have flawless .evt files, an unattended automated process is tenuous. I used these batch files solely to convert my many 4K-created mpegs into 5K/DVD-compliant mpegs. I use Womble/Mpeg Video Wizard for correcting GOP errors and frame-accurate editing - nothing else comes close to working as quickly and as well.
Enjoy,
Tim
cincyreds
02-18-05, 04:59 AM
For anyone still interested in batch files for automating rtvedit/rtvconvert, see this post for a new batch file I made for Windows XP:
RTVDragDrop (http://www.avsforum.com/avs-vb/showthread.php?postid=5197636#post5197636)
If there is sufficient interest I'm not averse to enhancing it with any reasonable request.
:)
Dean
obi5kenobi
05-17-05, 06:39 PM
In case anyone is wondering this doesn't seem to work with Showstopper files. I tried this with a showstopper file and the output files was somehow 0k even though it looked like it was doing something for a while. I don't suppose a version of this could be made for Showstopper files?
vBulletin v3.0.6, Copyright ©2000-2009, Jelsoft Enterprises Ltd.