Introduction | Drivers (DVB/ATSC hardware) | iTele (viewer app) | Mpegitor | Forums
Mpegitor
You what?
Mpegitor is a little app for editing MPEG-2 Program Stream movie files, in particular ones produced by recording in my Digital TV / HDTV app iTele. The idea is that you select the parts of the recording that you want to keep, and then export it to an MPEG-2 VOB file suitable for burning to a DVD.
Download
Operation
Drag a '.mpg' file onto the Mpegitor window to open it up. The movie will start playing immediately. You can't do much in Mpegitor while the movie is playing except watch it (which you are perfectly entitled to do :). You can scrub around the movie with the slider at the bottom of the window. The slider knob as well as a little text item both show the offset of the last keyframe seen by the file reader (may be a little ahead of currently displayed one). The arrow keys jump forward or backward one keyframe. Hold down option to jump forward or backward about 10 keyframes (not exact - just skips 8MB).
When you want to do some editing, you will first have to pause the playback with the pause button (or the space bar). To avoid any strenuous re-encoding, editing can only be done on keyframe boundaries, and unless you are very lucky the movie will not have paused exactly on a keyframe. You can use the 'Sync to Keyframe' menu item to move to the nearest keyframe (or thereabouts :). Also, if you use the arrow keys or playhead slider while paused then the movie will always show exact keyframes.
Once you're synced with a keyframe, you can set some editing marks. Editing works inclusively - i.e. you have to select the bits of the movie that you want to keep. (As well as being what you generally want with recordings from TV, this is actually necessary to tidy up the start and end of the .mpg file to sync on keyframes). To create a new pair of edit marks, use the 'Enter Mark at Playhead' menu item. You will see a thin grey line at the playhead in the slider. If you go to somewhere else in the movie and select the menu item again, it will extend that segment you just defined to the current position of the playhead, selecting all of the video in between. You can also use the 'Fetch Mark to Playhead' menu item to move the nearest mark to the playhead, or the 'Delete Mark at Playhead' to delete the marks that the playhead is between. Please take the time to appreciate the pretty blue Aqua selection bar - it took me 3 hours to get it looking like that! :)
Once you have some edit marks, you can move between them by holding down the command key and using the arrow keys. If you choose 'Save', then your set of marks will be saved alongside your .mpg file, with '.edit' appended to its name. Then next time you open the movie those marks will be reloaded (you can't open the .edit file yet, sorry). When you are happy with your marks, choose the 'Export to Vob' option from the file menu. Mpegitor will write a new file named like your movie with '.vob' appended to its name, including only the segments you have selected. For movies of any decent length it will take some time to write this file out, but at least you get to watch the slider knob do its thing. In the interests of speed the movie is not displayed as it is remultiplexed. Unfortunately there is as yet no way to preflight your edited movie, so you will have to use your imagination :)
And that makes a DVD how?
This is how I created a DVD. I've only done one so far, and I'm sure other people know much better ways (Sizzle? Project-X?) but this is what I did and it worked first time (to my immense surprise as you can imagine :)
- Edit source MPEG files with Mpegitor to remove unwanted bits.
- Use 'dvdauthor' to build dvd:
- mkdir ~/advd
- dvdauthor -o ~/advd episode1.mpg.vob
- dvdauthor -o ~/advd episode2.mpg.vob
- dvdauthor -o ~/advd -T
- Use 'mkisofs' to build iso image: mkisofs -dvd-video -v -o ~/advd.iso ~/advd
- Run 'Disk Utility'. Drag advd.iso from you home directory into pane on bottom left. Insert blank DVD. Click Burn button.
And then you will have a DVD! I haven't looked into dvdauthor and friends to know how to make a pretty table of contents or other stuff (so you can easily get between multiple titles, for a start!) - but those are the basics.
Note that a side effect of this method is that (if you don't delete intermediate files) you need 4x the size of the DVD in disk space (originals, vobs, dvdauthor staging area, and iso9660 image). You can do a little better if you delete the files from the step before last before each step (but don't delete your source .mpg files! See Notes below).
So, get ready, clear some disk space, take care, and happy burning! Let me know if I just helped you expand your collection of coasters!
Notes
- The algorithm to remultiplex into a vob is very provisional, so do not delete your source mpg files when you are done editing - instead delete your .vobs and keep the .mpg and .mpg.edit files.
- You may not be able to always seek in the output vob files (see previous point) - it doesn't seem to work in the Apple DVD Player, but does work (in the forward direction) with my commercial DVD unit. This is possibly due to the fact that the scr in the pack header is a mess ... also the system header bears little resemblance to reality ... however I am pretty happy with the pts/dts manipulation.
- The actual video from the selected segment that gets exported starts exactly from the frame that is displayed when you set the beginning mark, and goes until about 3 frames (the nearest 'P' frame) before the frame that is displayed when you set the ending mark. The audio is ... nearby :)
- You cannot combine multiple .mpg files into one editing session, but I want to add this feature in the future as I have a number of recordings where I stopped and restarted them after a break in a new file.
- You cannot re-edit the .vob file that is output! You should be able to play it back in Mpegitor but it won't be able to find the keyframes. Fixing this is not a big priority for me, since you should be keeping your original files around anyway.
- Works fine for playback and editing of HDTV sized streams. Oh yeah, except for the burning to DVD bit :) ... guess we'll have to wait for Blu-Ray for that.
Change Log
- Version 0.1.2
- Released 19/9/2004
- Works in Jaguar again
- Minor syncing/buffering tweaks
- Minor foreign file compatibility/robustness improvements
- Version 0.1.1
- Download Mpegitor v0.1.1 from 12/4/2004
- Added preferences to turn on/off ATI text fragment shader
- Fixed parsing of weird BBC streams with extra 0 byte of padding before first startcode in a GOP start PES packet
- Fixed crash on export of streams with no garbage before first keyframe
- Version 0.1
Last updated 19/9/2004 by John Dalgliesh