View Full Version : Editing m2ts without re-encoding
djesteban
19th May 2011, 00:09
Hi,
I have two copies of a same blu-ray movie (two different edition), but they both contain slightly different cuts and extra footage.
My goal here is to combine the different parts of those two versions in order to make my own cut with all the extra footage. Now, I really want to go the non-destructive way (no re-encode) while I'm editing. I only want to re-encode the end result (I will use x264)
Here's some info about the m2ts' streams:
They are both MPEG-4 AVC encodes and are of the same resolution (that's even if you crop the letterbox), though one (US edition) shows a framerate of 23.976fps, while the other (UK edition) displays a framerate of 24fps. They also share the same spec for the audio; a DTS-MA 5.1 1536Kbps.
Here's what I've tried already:
- I've tried using Avidemux to edit the footage... but I did not get favorable results. First off, I have noticed that there's a weird bug when you open a demuxed h264 stream in Avidemux. The first frame seems to be replaced by some other frame in the sequence, and then when you try to export it using Copy as the video option and changing the format to MPEG video, so that it doesn't reencode anything, it omits the first frame on export, so your new clip is always a frame short. Also, Avidemux cannot cut DTS-MA stream, so I have tried converting the DTS-MA to uncompressed WAV 24bit with eac3to but Avidemux downconverts that to 16bit on export...
I then tried using the avsproxy_gui that comes with Avidemux and I loaded a dgi that I had prepared; that seems to fix the missing frame issue, but by using this method, it seems I can't export my clip without re-encoding (I can export raw, but it makes huuuge files).
- Next thing I tried, was to make my cuts using DGIndexNV, which would've work like a charm if only I could advance one frame at a time (frame-by-frame), but it seems DGIndexNV only permits to skip to the next GOP(?!). This is frustrating in this case, because DGIndexNV is able to snip the DTS-MA track also, which would make it perfect for the job :(
Any suggestion would be greatly appreciated!!
Thanks!
rik1138
19th May 2011, 02:42
Hi,
- Next thing I tried, was to make my cuts using DGIndexNV, which would've work like a charm if only I could advance one frame at a time (frame-by-frame), but it seems DGIndexNV only permits to skip to the next GOP(?!). This is frustrating in this case, because DGIndexNV is able to snip the DTS-MA track also, which would make it perfect for the job :(
Any suggestion would be greatly appreciated!!
Thanks!
I don't think you will be able to edit the m2ts on a frame-accurate basis with anything. You can't just cut a GOP in the middle (that's probably why DGIndexNV is jumping to GOPs). If all your cuts/edits happen to be exactly on I-frames, then you shouldn't have a problem (with the video at least), but that's unlikely to happen.
Since you do plan on re-encoding it anyway when you are all finished, the easiest thing might be to just convert the video to an uncompressed format. That way you can edit frame-by-frame with no problem, and when you are done just re-encode the final output. Yeah, it makes huge files, but that might be your only option.
If there's a tool that will only re-encode a GOP if you cut it in half, that might be your next bet... But I don't know if anything like that exists...
Ghitulescu
19th May 2011, 07:34
Don't forget about smart rendering, which is possible also with .M2TS. Only the affected GOPs are reencoded, a minor price to be paid.
yetanotherid
19th May 2011, 09:50
Which programs can be used for smart rendering when editing m2ts files?
Ghitulescu
19th May 2011, 10:26
smartcutter
yetanotherid
21st May 2011, 06:03
Damn.... I was going to download it but it's not free. I'll keep it in mind for the future though.
I'm not sure though the OP would want to buy a program simply to edit a single BluRay disc, but I guess it depends how important it is to him.
djesteban, do you have a preference for the encoding program you'll use when the editing is done?
I was thinking you could open each version with MeGUI and create your AVISynth script for encoding with it. MeGUI has a script cutter with a preview window which I'm pretty sure will allow you to set cuts on a frame accurate basis. You should be able to also apply the same cuts to the audio track. Once the cuts are added to the script you should then be able to re-encode it. I'm not sure how much editing you're wanting to do but you'd basically only be encoding the bits you want to keep and then join them all together later.
Or there's info here on using AVISynth to cut and join video. http://www.afterdawn.com/guides/archive/using_avisynth_page_7.cfm
The different frame rates might be a problem though. If you encoded each section as a separate MKV it'd be pretty easy to join them together with MKVToolNix. What I'm not sure on is whether you can join MKVs if the frame rates don't match. You'd have to try it unless someone else here can tell you. If you can it might be as simple as joining all the separate encodes together, if you can't it's fairly easy to use MKVToolNix to change the frame rate first, but then you've got to time stretch the audio to match (which MKVToolNix can also do if you work out the math).
It sounds like it be a lot of work though....
Alternatively you could probably open the video via an AVISyth script with a program such as VirtualDub (or possibly Avidemux) which should then let you edit on a frame accurate basis. Or I'm fairly sure if you created an AVISynth script to open the original video and wrapped it into an AVI using a program such as MakeAVS (comes with ffdshow) you could then open the AVI (which contains a script pointing to the original m2ts file and the audio) with VirtualDub or Avidemux. Once it's open you should then be able to cut the AVI on a frame accurate basis with VirtualDub and re-save the cuts as new, separate AVIs (using direct stream copy). Once you have all of your cuts saved as separate AVIs you could then join them all together into a new AVI using VirtualDub (once again using direct stream copy for the video) which should leave you with a new AVI you can then re-encode using any program which can open and re-encode AVIs. I'm pretty sure that'd work, but once again, the differing frame rates will probably be a "gotcha".
I use AVISynth scripts wrapped into AVIs for encoding quite regularly as it allows me to encode pretty much any file type using AutoGK (which only works with mpeg video and AVIs). I haven't tried editing those AVIs too much but I did just open one with VirtualDubMod, made a couple of cuts, saved each as new AVI, then used VirtualDubMod to append the newly saved AVIs together (using direct stream copy each time) and it worked like a charm. The newly saved AVI then opened with MPC-HC and played normally, with the cuts exactly where they were supposed to be, and the AVI is still only about 60mb in size because it still doesn't contain any actual video.
In your case, it's just those frame rates.....
Ghitulescu
21st May 2011, 06:56
He didn't mention that it should be a freeware, only.
If you prefer to spend the 29€ in electricity bills it's your choice ... The other payware that do smart cutting are way to expensive (Edius)
tsmuxer and multiavchd can do cuts, they are not perfect (in this respect, of course) but apart from donations their use is free of charge.
ilkertezcan
28th June 2011, 18:53
@djesteban: Another solution: MKV transcoding.
XMedia Recode: http://www.xmedia-recode.de/download.html
Open m2ts file. In Format tabs;
As output format select to "Matroska Video".
File extension: MKV. Output stream type: "Video and audio".
In Video tabs;
Click to "video copy".
In Audio tabs;
Modus: "Copy".
And saving: Click to "Add Job" on toolbar. After "Encode".
And result: So, Our m2ts file saved without reenecoding.
MKV editing is possible. FccHandler's Matoska input plugins for Virtualdub: http://home.comcast.net/~fcchandler/Plugins/Matroska/index.html
So it's possible editing in Virtualdub.
Last advice; Virtualdub's expermential version:
http://forums.virtualdub.org/index.php?act=ST&f=15&t=19755
djesteban
14th July 2011, 04:30
Hi, just wanted to say thanks to everyone who replied and helped in this post.
Fianlly, I was able to do it with DGindexNV using GOP cuts... I just didn't know how it was working at the time, but by experimenting, I was able to make perfect cuts where I wanted.
Thank again!
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.