View Full Version : Editing MPEGs without re-rendering?
Simple edits like trimming and joining videos. Easy to do with .AVIs in VirtualDub, save with "Direct Stream Copy".
I haven't found a good way to do that with MPEGs. Vdubmod can import an MPEG, but not save it. I have a couple commercial programs that are supposed to do that, like Ulead Video Studio 7SE, but have had some problems with that.
Does TmpGenc do that well and simply? Can it open an MPEG file, do simple edits like trimming and joining, then save (of course with no change in resolution, bit rate, etc.) quickly without re-rendering?
If it doesn't, could anyone recommend any other programs that could, that can do simple edits on mpegs, and save without re-rendering, simply and quickly?
robguy
26th July 2004, 17:15
I've found two commercial products that work simply, and do not cause audiosync problems. Both products are made by Womble.
1. MPEG-VCR.
2. MPEG Video Wizard 2003. (I prefer this one.)
Use them constantly to edit MPEGs created from DVD-RW, DVD-RAM and DVD+R of TV episodes I've recorded on my Sony/Panasonic/Phillips standalones.
There is a third program, VideoReo. I have mixed feelings about it, though. In my experience, audiosync is lost after the first edit. With Womble, there have been no such issues. In addition, Womble does not re-encode (VideoRedo doesn't re-encode, either).
TMPGEnc DVD Author is only 12 frames accurate, which leads to some sloppy edits. The Womble products are frame accurate -- what you edit is what you get.
I usually use either TMPG DVDA or TMPG+ to convert VOBs to MPEG-2; then open them and edit in a Womble product, and save them to a folder I use to hold DVDA files. Then, I just create my menu and send to DVD Output folder. If resize is needed, I use DVDShrink to size them and burn the DVD. No problems with Womble in the 20 times or so I have used it.
EricBall
3rd August 2004, 19:01
There are some challenges when editing MPEG compressed video & audio without recompressing.
MPEG video increases compression through the use of P and B frames which are derived from past (P&B) and future (B) frames. Thus if you cut before a P or B frame or after a B frame then you will corrupt that frame. The only safe edits are before an I frame and after an I or P frame.
MPEG and AC-3 audio are based on frames (typically 32ms), so any cut not on a frame boundary will require recompressing. The audio frame length is not the same as a video frame length. Thus any edits will change the audio-video synchronization.
Additional challenges include fixing the GOP timestamps and the Top_Field_First and Repeat_First_Field flags (for film). Oh, and don't trust any editor which doesn't include it's own MPEG decoder since many MPEG codecs don't provide accurate frame counters.
EricBall
5th February 2005, 04:28
Having just finished my project of splicing in the extra Pod Race sequences from the Phantom Menace DVD into the main movie, I can give some tips to anyone else looking to do some lossless DVD editting.
For this project I coded some tools based upon the MPEG-2 and AC-3 specs. The main purpose was to identify which bytes to cut from/to based upon which frames I needed. I also had to decode the MPEG picture headers enough to make sure I cut before an I frame and after an I or P frame. (Actually, that's not 100% true as I'll mention in a moment.)
I'll assume that you can use tools like DVD Decrypter to extract the M2V and AC3 files. One note: for audio it's best to extract multiple sequential chapters as a single file and include additional chapters at the beginning/end or you might be missing some frames depending on the delay.
The first challenge is identifing which video frames you want to cut to/from. I ended up using the the MPEG Software Solutions Group MPEG-2 decoder to decode the M2V frames to individual Targa files. I found I couldn't trust the frame counters of anything else. (Although VirtualDub/AviSynth may have something which does.)
Even then, ideally you want to start with a an I frame from a closed GOP sequence. Even if this isn't marked, this is true if the frame before the I is either another I frame or a P frame. Although this sounds restrictive, it's typically true of a scene change.
Note: You actually cut to the Sequence Header before the GOP, which is required before every GOP in the DVD spec.
The end frame should also be an I or P frame. Just watch out for B frames which occur after the I/P in the file but before it in time.
The final step for the video, after byte-wise copying the bits you want, is to go back and fix the GOP timestamps and the TFF/RFF cadence. (For film and NTSC or PAL60 at least, don't know about PAL50.)
The audio is actually easier than I thought. AC3 is made up of 1536 sample frames, which works out to 32ms at 48KHz. So the first AC3 frame (for NTSC) = (first M2V frame # * 1001 / 24 - AC3 delay) / 32 and the number of AC3 frames = number of M2V frames * 1001 / (24*32)Sub in 30 instead of 24 for video. If you want you can play around with the overall audio delay (try +/- 16ms to start with) if you have synch problems. But watch your splices because the synch can shift. I got lucky and didn't have to do anything other then delay one splice in order to mask some SFX which happened at the splice.
andru123
23rd February 2005, 22:40
Why dont you try
File->MPEG Tools->Merge&Cut
?
It seems to do all that you want.
I did not work with that much but the simple small files I did worked well.
EricBall
23rd February 2005, 23:34
Originally posted by andru123
Why dont you try
File->MPEG Tools->Merge&Cut
?
It seems to do all that you want.
TMPGEnc's Merge&Cut is a simple GOP editor, and (on my machine at least) the frame selection isn't that easy to use. I wanted to have as much control and flexibility as possible. (So although I did cut on GOP boundaries, I could have cut to exact frames.) It also doesn't appear to handle native AC3 audio streams.
Destra
28th February 2005, 07:15
I use Cuttermaran - The Mpeg Cutter and it works very well. You first De-Multiplex in TMPGEnc, then edit with Cuttermaran and then Multiplex the result again with TMPGEnc. Cuttermaran is easy to use and is free so get it here (http://www.cuttermaran.de).
hank315
28th February 2005, 18:35
Even then, ideally you want to start with a an I frame from a closed GOP sequence. Even if this isn't marked, this is true if the frame before the I is either another I frame or a P frame. Although this sounds restrictive, it's typically true of a scene change.Maybe you could explain this a little better, think it's not entirely correct.
EricBall
28th February 2005, 19:14
Originally posted by EricBall
Even then, ideally you want to start with a an I frame from a closed GOP sequence. Even if this isn't marked, this is true if the frame before the I is either another I frame or a P frame. Although this sounds restrictive, it's typically true of a scene change.
Originally posted by hank315
[B]Maybe you could explain this a little better, think it's not entirely correct.
When a scene change occurs there typically is very little similarity between the frames before and after the change. Thus, a good MPEG encoder will recognize this and not bother with trying to do any prediction and just kick out a new I frame to start the scene. So the two GOPs before and after the scene change will look like:
(in time) ..PBBIBBPBBPIBBPBBP... (where each I frame begins a GOP)
closed_GOP is an optional flag to indicated the first frame (in time) after the GOP has no backwards dependance on frames in the prior GOP. So if the frame before the I frame (in time) is a P frame then the GOP is closed. Theoretically you could have a B frame with no backwards dependence, but I suspect most encoders will just encode a P frame in those cases.
Also see http://forum.doom9.org/showthread.php?s=&threadid=43206 for more nitty-gritty details of the closed_GOP flag.
hank315
1st March 2005, 00:23
Now I see the misunderstanding, your order is temporal.
A decoder sees the frames in a spatial order, maybe it's better to use that.
Think we mean the same, it's just a matter of definition ;)
Theoretically you could have a B frame with no backwards dependence, but I suspect most encoders will just encode a P frame in those cases.Just don't count on that, a lot of encoders will just insert an I-frame and leave the GOP open.
EricBall
22nd March 2005, 06:31
If by spatial you mean order in the file, yes. An open GOP will have B frames stored after the I frame, although the B frames occur before the I frame in time. No B frames stored after the I frame = closed GOP (even if the encoder doesn't mark it as such).
Note: this isn't true for all scene changes. Sometimes the encoder decides the two frames are similar, especially for fade in/out.
video_magic
2nd April 2005, 04:07
Originally posted by Destra
I use Cuttermaran - The Mpeg Cutter and it works very well. You first De-Multiplex in TMPGEnc, then edit with Cuttermaran and then Multiplex the result again with TMPGEnc. Cuttermaran is easy to use and is free so get it here (http://www.cuttermaran.de).
this is almost how I have just learnt how to do it :) This way I describe here is for a fairly typical mpeg-1 video in VCD format with mp2 audio
You could get latest free version of TMPGEnc from here
http://www.tmpgenc.net/e_download.html
In TMPGEnc go to File - MPEG Tools - and click on Simple Demultiplexer tab.
Simple screen here. Load up your mpeg video and the two form-boxes underneath show you that your *.m1v (video stream) and *.mp2 (audio stream) will be saved. Click Run on this screen and when that's done you have finished with TMPGEnc.
Get MPLEX 2.0 (modified) from this website of 'Peter Cheat' (who sometimes posted on Doom9).
http://petercheat.host.sk/libav/
From the zip file you got extract the files somewhere.
Get Cuttermaran v1.63 (latest at the time of posting) from
http://www.cuttermaran.de/
And before you do anything here, notice that this program requires MS Dot Net version 1.1 which you should also follow the link on Cuttermarans download page to get. So you install Dot Net. Then probably restart your Windows :) and THEN install Cuttermaran.
When you have installed Cuttermaran and are running the program, go to
ACTIONS - Settings - Muxing - and choose an output path (for the files you will be working with). When you have done that then still on the muxing screen choose - CONFIGURE (next to where it says 'used Muxer'). Browse in the Mplex path to the Mplex executable that you got from Peter Cheat, and then 'OK' your way out of the couple of screens back to the main Cuttermaran screen.
Now in Cuttermaran all you have to do is click near the top left hand corner to select your *.m1v that you extracted with TMPGenc from your original mpeg, if you didn't fiddle with any renaming then your audio *.mp2 should also be loaded.
All you do now is play and pause (button near middle of the screen) and you also have a drag-progress bar underneath - which also has slow-motion back an forward arrows at the ends. Now you will notice a 'Cut In' and a 'Cut Out' button on the right hand side where you choose the start and end for selections of ranges of the video that you DO WANT to keep, you can only 'Cut In' and 'Cut Out' at certain frames though, which is where you use the slow-motion arrows on the progress bar until you are on an I or P frame which is where you are allowed to make cuts. when you have selected a range with a start and end using the cut-in and cut-out then you choose 'add range to cut list' button. So you can go through your video adding ranges you want to keep to this list: example - if you had a program that had advert breaks that you wanted to omit, and just have the rest of the program as one video minus the adverts, you would select ranges of the video excepting the sections of advert. Okay, when you have your range or list of ranges, then you choose the 'Cut Video/Audio' button on the right hand side, and follow the prompts
You should end up with 'cut' copies of your files (have cut in the name) plus your new mpeg video! :)
Of course you watch this video and see if you like it :D
That's a simplistic overview.
ylkb
4th April 2005, 03:43
what about canopus mpeg craft ?
You can set more cutin,cutout points to make more separate files in one time .You can choose to re-rend or not,or just rend the cutted places. And it's much quicker ...
(sorry for my poor English :p)
Abond
5th April 2005, 00:16
You mean this progie for 70$? No thank you. I can do the same without money and even more reliable.
@Yo
Cuttermaran+TMPG = cut frame accuracy (easy)
Cuttermaran OR TMPG = cut GOP accuracy (easy)
TMPG = merge(join) easy (well thwe accuracy dont know)
ReJig = merge frame accuracy Well moderate easyness.
AviSynth = you may cut and join what you want with frame-to-frame accuracy (difficult, you must learn this and that)
Hope this helps
mustardman
22nd May 2005, 00:12
I take your point. Not too many people want to spend $70 for a program, but the real issue is, will it save you $70 worth of hassle. What do you get paid at work, $30 an hour. So, if Canopus is going to save you 3 hours of mucking around (including installing software and doing the editing), then maybe it is worth it?
Not that you'll do this stuff at work, but wouldn't you rather spend your 3 hours with your kids or wife (OK, maybe not!). It would amount to chucking a sickie to do the same thing.
Besides, for the really tight, no doubt you could get hold of a 'special version'.
Back to the functions of the programs! Does either method mentioned also allow you to join sequences? I have heard a lot about cutting a single stream, but nothing about joining multiple streams and cutting the transition points (or within sequences as well of course).
Cheers,
MM
[edit]
After looking at the Canopus site, I can't find any reference to "MPEG craft". Can you please be a bit more specific?
Here is the link:
MPEGcraft (http://www.canopus.us/US/products/MPEGcraft_HomeEdge/pa_MPEGcraft.asp)
--------
> Support for MPEG -1 and MPEG-2 system streams
> Frame-accurate navigation for precise cutting, including mouse wheel
timeline scrubbing
> GOP-based editing to avoid re-encoding while cutting or stitching
> Fast, high-quality re-encoding
> Multiple MPEG file stitching
> Sequential file export for trimmed segments
> Hardware encoding support for StormEncoder, MPEGPRO MVR and
MVR1000 series
Abond
22nd May 2005, 10:03
@mustardman
Try Cuttermaran and try MPEGcraft.
After that come and post...
When I said more reliable I mean also the time point *shrug*.
@ylkb
And it's much quicker ...
Faster than... what?;)
lbecque
30th May 2005, 22:23
I haven't found a good way to do that with MPEGs. Vdubmod can import an MPEG, but not save it. I have a couple commercial programs that are supposed to do that, like Ulead Video Studio 7SE, but have had some problems with that.
I use Ulead Video Studio 7SE to do that all the time and its the best tool I have found for it. Make sure you turn smartrender on and preview off. If you make sure that your project properties are the same as the MPEG file then it will smartrender which means that its not really rendering the file but just applying the cuts and joins.
emazur
16th June 2005, 15:39
I use tmpgenc mpeg editor from the tmpegenc dvd easypack:
http://www.tmpg-inc.com/product/deps.html
it also includes slightly stripped down version of tmpgenc 3.0 express and tmpegenc dvd author all for about $50
zilog jones
17th June 2005, 16:21
I tried Cuttermaran recently with great results - it did exactly what I wanted, and it's student-friendly (i.e. free!)
Squee0
5th August 2007, 15:23
I've been using Womble MPEG Video Wizard DVD to edit out commercials on .ts/.tp files from HDTV capture, however whenever I'm working with 720p or 1080i files it uses 100% CPU Usage to export the project into .ts/.tp automatic and takes about as long as the length of the project. Any ideas what it's doing? when I click on the details button it says 100% copy. It is much faster for 480i files and takes about a minute or so to expert 22mins worth of video.
Womble is the only program that I've found that can do percise frame edits with HDTV captures, HDTV2MPEG doesn't get very accurate and has some issues, MPEG2Cut also doesn't work as well it it should, I've tried a bunch of professional $$ programs and they all suck as well. was wondering if somehow the settings on Womble got fucked up. Also while watching after it finished exporting some of the video became glitchy when it wasn't in the original and it's not even near a cut, any suggestions would be greatly appreciated, also VideoREDo didn't work keeps crashing.
levi
15th August 2007, 03:58
I've tried many freebies, but VideoReDoPlus is the best tool I've used for MPEG2 editing, including HDTV.
robguy
15th August 2007, 04:38
I believe the problem you may be having is more easily solved than sinking money into yet another program. Since you're used to Womble, and have apparently paid for the program, fire off an e-mail to Womble at support@womble.com. They're pretty good about answering questions about problems you're having.
Let us know what they have to say.
Let us know how things go for you.
Squee0
18th August 2007, 20:32
eMailed Womble Support and got the following response, seems that it wasn't suppose to be doing what it is.
The problem has been found:
the editor breaks all large GOP to make
the exported MPEG file compliant with
the DVD restriction, which requires that
the maximum size of a GOP not exceeds
16/18 frames for PAL/NTSC video.
Since the TS file has a regular GOP size of 30 frames,
this leads the editor to re-encode one frame by
converting a middle P-frame into an I-frame for
every GOP, and thus the slow down.
The editor is designed to turn this ON or OFF
via the options control
Options...-> Export -> GOP size compliance for DVD recording
with its default value being OFF.
However, the editor turns it ON for all export jobs,
and completely ignores the option control, hence
the error.
We will fix this bug shortly, and I will inform you then.
robguy
18th August 2007, 20:52
Glad you got some action. Sometimes, you have to wonder if software companies don't use us to beta test their stuff.
Squee0
18th August 2007, 21:22
yeah it's sad that companies don't test everything throughly before releasing to the public, been noticing a lot more problems recently with this sort of issue with respect to websites and things not working, or you can't even access the site unless you use www, and then when you eMail them about it, they are like we know that's a problem, we don't know how to fix it but you are suppose to be able to access the website without the www.
Anyways hopefully they will get a quick turn around time in the fix, wonders what other bugs exist that are causing problems that I haven't noticed, but are affecting my exports.
robguy
19th August 2007, 01:04
Yeah, I had some bad luck with video/audio sync with VideoRedo and VideoRedoPlus, and just got tired of getting no answers.
But it's the same with virtually every piece of software -- you just hope you can use it without too many bugs needing to be squashed. Not only that, but I have better things to do than spend my life on some forum board trying to find an answer to my problem. Open Source is no different.
Revgen
30th August 2007, 08:35
I use ProjectX. Frame accuracy is usually very reliable. Especially with HDTV Transport streams.
Squee0
4th October 2007, 15:22
I didn't have any luck with Project X the results just looked like crap at the cuts.
Womble still hasn't fix the bug in their editor and it's been 2 months, they made it appear as if they were going to fix it... maybe we need more people complaining so that they fix it sooner.... Problem was that it ignored the settings and reencoded all GOP structures to make them DVD Complaint.
PhillipWyllie
5th October 2007, 03:15
What about the free ProjectX(from downloads page). I know it's designed for DVB broadcasts, but MPEG-2's just work fine.
halsboss
5th October 2007, 05:10
Latest VideoRedoPlus works fine for some with HD ?
http://forum.doom9.org/showthread.php?p=1047955#post1047955
Maybe PVAStrumento to demux 1st then edit with Mpeg2Schnitt ? Works OK most times with SD and shows logs of stream inconsistencies http://forum.doom9.org/showthread.php?p=814236#post814236
Can't hang around, electrical wiring problems in the house...
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.