Log in

View Full Version : frame-accurate AVCHD editing with smart re-encoding


florinandrei
17th July 2008, 03:57
I bought an AVCHD camcorder that generates AVC files directly on a flash card. Here's an example of such a file:

https://dl.getdropbox.com/u/29966/00000.MTS

The tiny application that came with the camera can edit those files without re-encoding the whole video track. But it's an atrocious editor, it's very hard to find the cut point unless you have ninja skills with the mouse. And I am not entirely convinced it's frame-accurate, since it's very hard to point it to a given frame anyway.

I tried many other commercial applications. The problem is, if you cut the file, they re-encode the whole thing. :mad: Why are they doing that? They should re-encode just the trailing GOP fragment, if any ("smart" re-encoding).

So my question is: Do you know any application that can edit an AVCHD file frame-accurate and don't re-encode when it's not absolutely necessary? A graphical interface is very much preferred, since it takes a long time to cut video in command-line mode.

Yoshiyuki Blade
17th July 2008, 04:32
I'll assume you know how to use AVISynth, or have an idea how it works. What you can do is load your avs script into VirtualDub, and look for where you want to start frame-by-frame. When you find where you want to start your video, hit ctrl-G (goto) and copy the frame number. Go to your AVISynth script and type trim(), preferably at the end of your script. Paste your start frame within the parenthesis followed by a comma (example trim(30,)). Next, you'll want to find your "end point." Once you do, hit ctrl-g and ctrl-c (to copy the frame), and then ctrl-v (paste) it after the comma. So you'll end up something like trim(30, 2953). This will trim off everything outside that frame range.

Keep in mind, that if you apply something that changes the framerate of the video (bob deinterlace, IVTC, etc.), you will need to make sure your trims are consistent. For example.

-The video is 30 FPS

1. You do trim(30, 2953)
2. You bob, the video to 60 FPS

OR

-The video is 30 FPS

1. You bob the video to 60 FPS
2. You do trim(60, 5906)

Avisynth does things in the order that you type them in. You can't simply add your trim parameters anywhere on the script if you have framerate-changing functions such as bob deinterlacers, so its necessary to know which order they go in.

After that, you can feed the AVS script into your favorite encoder, and youll just encode whatever frames that were within the trim() function.

Ranguvar
17th July 2008, 05:53
Yoshiyuki, the problem is that he does not want to re-encode. Or, at least, only the parts necessary.

OP, I suggest trying h264tscutter (http://forum.doom9.org/showthread.php?t=128476).

Yoshiyuki Blade
17th July 2008, 07:16
Oh ya, that can also work. I figured he just didn't want to have a program unnecessarily transcode a video clip and lose quality just for a little trimming. If he intends to transcode the video at the last step, the AVISynth trimming method can work too :D.

EDIT: Looks like you'll have to rename the extension to m2ts to load it up.

Jay Bee
17th July 2008, 22:24
Someone please add a question mark to the thread title. I first thought someone had already come up with the holy grail of HD editing software.