KEYWORDS MPEG-1, MPG, video, edit, VirtualDub, mpgtx, avi, vcd, video CD, Pinnacle, PCTV
This article describes how to edit mpeg-1 files using VirtualDub, mpgtx and a small perl script to automate the process.
I started to seek some tool that is capable splitting and joining mpeg-1 files. I have found mpgtx and started to use it together with VirtualDub. I used VirtualDub to see where the advertisements start and end and then I created the command line to join the parts of the film without the advertisements. This was cumbersome. I realized that I can automate the process with some perl script.
HOW IT WORKS
When you edit a film with VirtualDub it does not perform the actual editing functions as you do. It only stores the actions and then it executes them when you save the file. There is also a possibility to save only the actions and then perform the actual saving in a batch. This creates a text file that describes all the editing functions you performed. VirtualDub calls this file the “job file”.
When you edit the mpeg-1 file you save the result for later processing. Then you start the perl script. This script reads the VirtualDub job file and extracts the actual data needed to start mpgtx. When all the segments are there the script starts mpgtx to perform the actual job.
HOW TO INSTALL
Install VirtualDub 1.5.10 to a directory.
Note that this is not the latest version. You can also try other versions, however the methodology and the glue script was tested only with this version. Also note that the glue script depends on the format of the job file, which is not guaranteed to remain compatible between versions. The actual format was used as the version mentioned above using experiment and not documentation of the format.
To install VirtualDub all you need is to extract the files to a directory and create a short cut to VirtualDub onto the desktop. The version 1.5.10 that I use to edit mpeg-1 can be downloaded from my site from here (667KB). The advantage from downloading the code from here is that the archive contains the glue script as well, so you can install the script and VirtualDub in one shift.
Install perl 5.8.4 using ActiveState Perl interpreter. I do not provide the actual version here, because the kit is quite big and because later versions should also work executing the glue script. There is nothing special in the script that would require the specific version I used to test the glue script. Installing ActiveState Perl is quite easy: download, click on setup.exe (or some .msi file) and click, click, click. Do let the installer associate the extension pl with the interpreter to ease life.
Install mpgtx! You can download it from SourceForge and installing is simply copying the file mpgtx.exe to a directory, which is in the path. I recommend copying it to the directory where the perl interpreter is. It is usually C:\Perl\bin.
Download the glue script and copy it to the directory where VirtualDub is. Name the script to vd2mpgtx.pl. You need not do this if you downloaded the copy of VirtualDub from the ZIP file provided on this site. In that case the glue script is already in the directory where it has to be.
The final step is to create two shortcuts on your desktop. One is for VirtualDub and the other to vd2mpgtx.pl. Open the properties dialog of the shortcut pointing to vd2mpgtx.pl and ensure that the field “Start in:” points to the directory where VirtualDub is installed. This is very important because the script looks for the job file in the actual directory.
HOW TO USE IT
Thus the actual editing of mpeg-1 files is the following:
<![if !supportLists]>· <![endif]>Start VirtualDub using the desktop shortcut. Press F4. This will open the pending jobs. These are the jobs that were actually performed by vd2mpgtx but VirtualDub believes they are pending. Delete all previous jobs from the list.
<![if !supportLists]>· <![endif]>Load the mpeg-1 file to VirtualDub. It may take some time and display a lot of warnings, but you can safely ignore them. I am not too much familiar with the mpeg-1 format and I do not know what they mean, but I have never had any problem with those.
<![if !supportLists]>· <![endif]>Edit the film, cutting off the ads. Most probably you record the movies automated thus you will have some extra ads in front of the film and some other garbage at the end of the mpeg-1 file. You can cut off those also.
<![if !supportLists]>· <![endif]>Open the “save as avi” dialog box and check the check box at the bottom left that reads: “Don’t run this job now…” Specify a name for the file (do not care the extension, the glue script will rename it to mpg anyway).
<![if !supportLists]>· <![endif]>Start vd2mpgtx.pl using the desktop shortcut. When it starts it displays how it performs.
<![if !supportLists]>· <![endif]>Enjoy the created ad-free mpeg movie.
<![if !supportLists]>· <![endif]>VirtualDub
<![if !supportLists]>· <![endif]>Mpgtx
<![if !supportLists]>· <![endif]>ActiveState
<![if !supportLists]>· <![endif]>Peter Verhas creator of the glue script and this page.