I record mpeg4 videos from tv with my Ati aiw card. I'll need to cut commercials out of it and Virtualdub with "direct stream copy" does the job quite well without the need to re-encode.
But I have a small problem. Cuts are not too accurate. I guess the reason is because I, P or B-frames are the ones where cut can be done or something like that.
Is there a way to do frame accurate cuts to mpeg4 without re-encoding like you can do for example with VideoReDo to mpeg2?
+ Reply to Thread
Results 1 to 30 of 34
-
-
I assume you are using DivX compression with the ATI card.
1. Open file with G-Spot to see which MPEG4 codec the file was encoded with.
2. Open the file you want to edit in Virtualdub.
3. Select Video, Compression and find the video codec that was used.
4. Edit the properties of that codec to make every frame a keyframe.
5. Select Video, Fast Recompress and save new AVI. This should not affect the quality of the file.
6. Take new AVI and cut all the commercials out.
7. Direct stream copy audio and video and save final AVI. -
Get the latest version of VirtualDub. It has smart editing. It can cut on any frame and will only reencode the small sections it needs to (around the cuts).
-
@ jagabo, Does VirtualDub Mod or Mpeg2 do smart editing too? My source is MPEG2 from a Hauupauge PVR.
-
Originally Posted by olyteddy
-
arrow, just for your information, some MPEG-4 codecs have a lot of frames between keyframes. Xvid for example, has 300 frames between keyframes by default. That makes frame accurate editing very difficult without some re-encoding. This problem is common with highly compressed formats. It's the codec that's the problem, not the editor.
-
Jagabo,
I tried the smart rendering feature last week for the other thread we were talking about exact cutting of AVI in Virtualdub and talking about keyframes. This feature did not work for me because the codec settings have to be the exact same for the file you're making as the original file. any slight difference (and VDub doesn't work well with very slight differences) in the two settings and VDub will refuse to use this feature. I looked in the information page and set the codec to the same setting that info gave and it still refused to work.
You have to use smart rendering with fast recompress anyway, according to the Virtualdub help files.
Fast recompress doesn't care what the other codec settings are. It just turns every frame into a keyframe.
The instructions that I gave for setting the keyframes in the codec and fast recompressing takes hardly any time at all (basically direct stream copying the file with the fast recompress feature) and makes every frame a keyframe so that exact frame by frame editing is possible.
fast recompressing an MPEG2 file in VDub MPEG2 will give you a humongous uncompressed AVI file. You can frame by frame edit an MPEG2 file anyway since it is uncompressed when it enters VDub-MPEG2 and you have to compress it to an AVI compression anyway.
For anyone using Virtualdub, the new version, 1.7.1 ( build 27021 ) is a must. -
arrow, just for your information, some MPEG-4 codecs have a lot of frames between keyframes. Xvid for example, has 300 frames between keyframes by default. That makes frame accurate editing very difficult without some re-encoding. This problem is common with highly compressed formats. It's the codec that's the problem, not the editor.
I figured the only way it could be done was to recompress the file. Glad I didn't give up. -
I have changed the keyframe rate to one when I desperately needed to do some frame accurate editing on a Xvid, but the filesize also went up by 3-4 times.
-
The clip I tried wasn't very big. The original was 6,592kb before keyframe change and 7,102kb after keyframe change. I assume a full length movie would be pretty big but after editing and saving, you could always go back and set the keyframes back to 300 and fast recompress again to make the file smaller.
-
Thanks for the answers.
My AIW seems to use divx 4 for mpeg4 packing and set keyrames to 300. All the solutions need the exact same codec but I couldn't find that from Virtualdubs format settings page. I'll find divx version 4, install it and give then a try. -
Originally Posted by DarrellS
Originally Posted by DarrellS
Originally Posted by DarrellS
Originally Posted by DarrellS -
Originally Posted by arrow
Actually, you might not be wasting your time. Although frame accurate editing of any video is possible as long as you're not in Direct Stream Copy mode, it can be tedious. For example, if you're sitting on frame 299 of a 300 frame GOP and press Left Arrow to move to frame 298, VirtualDub has to seek all the way back frame 0 of the GOP and decode all 298 frames to display the requested frame. That can take several seconds depending on the speed of your CPU. If you're going to do lots of editing it might be faster to recompress as all keyframes. But you will be losing quality if you do that. -
I tried the new Virtualdub Smart rendering. It did the cuts right. However there was a strange side effect.
With Windows Media Player everything works fine but with Media Player Classic and Videolan there is a strange "jump" when the cutting place is played. There is a short black flash and Videolan kind of re-starts (when playing full screen the player part appears for a short period).
Has anyone else had same kind of problems?
I installed divx 4 encoder and used that with Virtualdub. Maybe I still check the codec configurations one more time... -
I never have any problems. I just set Xvid up for single pass constant quantizer encoding and pick the quantizer I want.
By using Target Quantizer, Virtualdub was able to use the same settings as the original file and use the Smart Rendering feature.
Thanks for the info.
Now that Virtualdub has this Smart Render feature, DivX and XviD may become the capture format of choice. No need to recompress a file if you can capture to a finished format and edit out what you don't want and smart render with Virtualdub. -
I haven't seen anything like that but I've only edited Xvid and a few DX50 (DIvx 5 and 6) files with smart rendering. If you single step forward through the same part of the video with VirtaulDub is there anything unusual?
I tried to change smart rendering codec to xvid in Virtualdub and it did the rendering ok but the result was same. With Divx5 Virtualdub refused to encode at all. -
After editing, try using mpeg4modifer to put a new aspect ratio through the whole file. It sounds like the AR flag is being lost for just the re-encoded frames. WMP has no problems because it is too stupid to recognise that AR flags even exist. It won't even recognise them in 16:9 flagged mpeg-2 files.
Read my blog here.
-
Thanks for the tip guns1nger! That solved the issue and video is working now in all players.
-
I was able to duplicate your problem. Xvid's AR flags when you smart reencoded the AVI were different than those in the original AVI. You can check the AR flags of the original with MPEG4Modifer, then set the AR flags the same in Xvid when you edit/encode.
Some players appear to read the AR only once and use that for the entire video. Others appear to read and adjust the AR throughout the video. -
Thanks jagabo.
I couldn't find AR settings in divx 4 encoder but found them from Xvid encoder thanks to your tip. However there was a tiny freeze during cut frame when I played the xvid encoded video. Maybe I need to play bit more with the settings.
I also tested with ffdshow encoder (I chose mpeg4 with Fourcc:divx) and set AR there to be the same as in source and that did the trick. Video was ok now right after Virtualdub smart rendering and worked at least in VLC and MPC. No freezes like with xvid. -
I've been now able to cut out commercials from my movie gallery without problems. Thanks for the tips guys!
But I want to get back to this DarrellS's method. DarrellS said that if I use exact same codec settings and fast recompress in Virtualdub it shouldn't affect the video quality.
If I need to decrease the file size is the best way to use same codec but smaller bitrate and fast recompres in Virtualdub? At least I haven't been able to find similar application than DVDShrink for mpeg4. -
Originally Posted by arrow
Originally Posted by arrow
If you must reduce the file size of a video that's MPEG 4 part 2 (Divx, Xvid, etc.) compressed, using a codec that's better than Divx/Xvid will generate better results than using Divx or Xvid, h.264 for example. But again, you will be reducing the picture quality because you recompressed, just not by as much. -
Thanks for the tip. I tried x264 vfw encoder with AIW capture and it seems to work great. Smaller size, better quality.
Only problem is that I cannot open files with Virtualdub. I get error:
MPEG Import filter: invalid pack at position 3: marker bit not set; maybe MPEG-2 stream
Could there be a problem in ATI MMC capture? -
x264 is an encoder only. ffdshow's VFW decoder can uncompress x264 video for VirtualDub. Make sure you enabled the VFW decoder, not just the DirectShow decoder.
-
I found out why Virtualdub gave that error. Video file was actually mpeg2. For some reason MMC didn't accept the new x264 profile I created and used default mpeg2 recording. That's why it looked good
.
When I got x264 avi profile accepted MMC didn't even start to record. Most likely it's too heavy codec or something. I did a test encoding session with Virtualdub and encoding process was really slow.
I enabled h.264 also from VFW decoder. Encoded h.264 file opened in Virtualdub but there was no picture. It says that codec cannot decompress to an RGB format. I should check if there is any "force YUY2" option selected.
Any ideas? -
Thanks jagabo.
I installed newest version of ffdshow and did those activations. Now it's working in Virtualdub. It takes some time for video to start after play button but I guess that's because codec is heavier. -
Another suggestion for doing frame-accurate editing with VirtualDubMod:
I'm assuming the goal is to import an MPEG2 file, edit it frame-accurately in VDubMod, and then push it through XviD or some similar codec.
One useful way of doing this is to pull the original MPEG2 file into VDubMod, set up VDubMod as a frameserver, and serve frames to a second instantiation of VDubMod. The second VDubMod will see every frame as an I-frame. Snip out all the junk, cutting at any frame you choose, and then bang the edit into XViD in the normal way. This is very simple.
Or...
Don't do the editing in VDubMod. Pull your MPEG2 stuff into an Avisynth script, controlled by AvsP. AvsP makes it very easy to do frame-accurate edits, which it translates into Avisynth code. The great joy of this is that you have much more flexibility than with the VDubMod edit method I outline above. For instance, you can set up straight cuts as Trims, and then with some simple text editing transform some of the cuts into dissolves. If you're editing out ads from a movie, sometimes you're left with a rather nasty cut, even if you are cutting frame-accurately. Avisynth gives you a very easy way to do dissolves, fade in, fade out, fade to black or whatever -- a whole palette of transitions to cover awkward cuts. Having set that up, save your Avisynth script and bang it into VDub or VDubmod for compressing in the usual way.
--
voodle -
Actualy as I stated in the first post I'm editing mpeg4 files. However thanks for the tips voodle I guess those work fine with mpeg4 files. I have to give them a try.
Similar Threads
-
New to editing with VirtualDub
By xNesX in forum EditingReplies: 2Last Post: 18th May 2011, 23:56 -
Editing HDTV TS mpeg4 files
By kogoot in forum EditingReplies: 5Last Post: 25th Aug 2009, 19:57 -
MPEG4 H.264 TS Open in VirtualDub
By lethalone in forum Video ConversionReplies: 3Last Post: 18th Jul 2009, 20:07 -
Mpeg4 editing
By Commando7 in forum EditingReplies: 2Last Post: 3rd Dec 2007, 11:38 -
MPEG2 to MPEG4 for iMovie editing on a MAC
By AAL333 in forum Newbie / General discussionsReplies: 0Last Post: 4th Aug 2007, 23:01