PDA

View Full Version : MKV x264 editor?


oddball
17th November 2006, 22:22
My search results are not giving me anything to work with. Is there an MKV editor (Show, play, cut, append, keyframe advance etc) for x264 MKV files?

killerhex
17th November 2006, 23:21
not exactly

to edit the x264 you probbably will have to extract it first

oddball
18th November 2006, 00:21
That would throw any audio and subs out of sync. I am very surprised there is no proper solution yet.

bond
18th November 2006, 11:49
there is no solution for mkv

try remuxing to mp4 and edit it in avidemux

LeMoi
18th November 2006, 13:43
MKVToolnix can append/cut mkv files...

shon3i
18th November 2006, 23:46
MKVToolnix can append/cut mkv files...
Yes but without visual control.

LeMoi
18th November 2006, 23:49
Indeed.
You can find your cutting points with virtualdub, if you have AviSynth installed, create an .avs file, with this line
DirectShowSource("file.mkv",fps=xx)
then you'll be able to see picture with its tilecodes :p

szabi
26th September 2007, 14:11
Hy

I run into the same situation.
I tried using virtualdub and vdubmod as well but mkv file can not be opened by them.
I found this this topic about usage of avisynth but DirectShowSource("file.mkv",fps=xx) did not work.
The movie was encoded by x264.

The last post is almost 1 year old I hope any solution exist for this problem.

Such a solution would be nice like xvid-avi cutting, appending with virtualdub. :)

Bye
szabi

SpAwN_gUy
28th September 2007, 14:19
the strange thing is... like you can not predict key-frames.. even through script in VDM..

today i've managed to cut with mkvtoolnix,.. but..
i can't define where are the keyframes... parts ar or too short.. or too big.. (5k to 2Mb for 720p content)

szabi
29th September 2007, 19:51
Hy

Probable you are right, there is no key frame checking possibility over avisynth script, so it would not work.

Anyway I was using mkvtoolnix for splitting my x264-mkv movie.
I checked where is the point in the movie which is good for splitting. (to avoid splitting in any continuous dialog or unbroken event ... and so on).
When I found it, I gave this splitting position by the mkvtoolninix's function "after this duration".
I was waiting for the end of this splitting, and realised that the point is not the same I marked.
I did it severeal times, the splitting time was changed every time a little bit.
Somtimes I got a wrong splitting point or a non workable second part or oversized part of movie. After several attempt I got a good solution.

It would be nice like xvid-avi with vdub. Key-frame can be found easily, and the predicted size of the splitted movie is shown so the splitting is successful after first attempt.

It is strange for me, there is no video editing program which can not give me the key-frame position with visual control in an x264-mkv movie.

Imho vdub should be developed for good handling this situation, not only any avi movie but any mkv movie as well. :)
Or mkvtoolnix should have a more advanced splitting function with visual control and key-frame stepping potential with predicted splitted movie size. :cool:

Bye
szabi

chros
29th September 2007, 22:51
Scenario:
- clip length (eg. foo.mkv): 60 min
- the wanted part is in the middle: 35:05-37:42 (so it's 2 mins and 37 seconds)

Required tool:
- current mkvmerge (with gui)
- current MPC


Cutting: find out the cutting points (you must know where the keyframe is !)
- use MPC with the built-in mkv splitter !!! (not Haali's one)
- now you can seek to keyframes with: SHIFT+mouse or SHIFT+arrows
- so seek to the closest keyframe before the cut point (where you want to cut), and look at the time at the bottom of MPC window (eg: it displays 35:00). Of course it's a rough value (we don't know anything about milliseconds), but it's not a problem ...
- then seek back to the previous keyframe and see the time now (eg.: 34:50, so the clip has keyframes at every 10 seconds)
- that's it !!! Now you can pick up any timecode between these 2 value, since mkvmerge automatically grab the next keyframe !!!
- repeat this procedure with the 2nd cut point (at the end, eg. 37:45)
- so you can enter these 2 values in mkvmerge's "...after timecodes" box: eg: 00:34:53,00:37:45
- so we got 3 files

LeMoi
29th September 2007, 23:05
And i can add that, if you want to know the milliseconds, just press CTRL+G when you are at the frame, and exact time will be displayed :)

Placio74
30th September 2007, 00:02
there is no solution for mkv

try remuxing to mp4 and edit it in avidemux

Now Avidemux can open, edit and save MKV (with AVC).

Still problem with display image when use slider (not when use arrows), but...

LoRd_MuldeR
30th September 2007, 00:27
Still problem with display image when use slider (not when use arrows), but...

Try Tools -> Rebuild Frames :cool:

Placio74
30th September 2007, 01:47
Try Tools -> Rebuild Frames :cool:

Thank you very much!:thanks:
It work.

Some other... wrong audio tag for Vorbis when copy audio (MKV>MKV or OGM>MKV) - A_MS/ACM.
Edit: Mistake. I'm forgot install latest build. Above observation not relate to rev 3600.

However, Avidemux is first editor to directly edit MKV's (contain AVC video) with visual control.:)

foxyshadis
30th September 2007, 04:31
Ah, the newest version does seem to support avc w/b-frames in mkv better, cool. Still some issues with seeking backward (the frame before a keyframe will be replaced with the frame ahead instead) but seeking forward again it works fine. Quick-seeking along the timeline is still off quite a bit, but a single seek back will correct it.

I suppose I should report to mean, not here. :p

chros
30th September 2007, 12:25
Well this is a wonderful news ... !!!
But it's far from perfect: I have tried to cut an anime x264-HE-AAC encode (b-frames), and it decodes wrongly on the preview window (no matter which mode I have choosen, and whether I'va applied the Rebuild command).
And the cut-file has the right audio segment but not the video ...

So till it works perfectly, I try to convince Mosu to implement a cut feature based on timecodes (I think already almost everything is implemented in mkvmerge for it) without visual control ... :)

pcjco04
30th September 2007, 14:13
Hi,

For anime with AVC, I use to remove opening and ending with MPC for the visual control (I pause the video , then seek with SHIFT+LEFT or SHIFT+RIGHT to find what time I have to cut) and a DOS script using mkvmerge to split the video.

@ECHO OFF

set mkvmerge="%ProgramFiles%\Divx_Prog\megui\tools\mkvmerge\mkvmerge.exe"

if "%~1" == "" (
SET INPUT=
SET /P INPUT=INPUT ?
) else (
SET INPUT=%1
)

if "%2" == "" (
SET OpStart=
SET /P OpStart= Opening Start Time [0:00.000] ?
) else (
SET OpStart=%2
)
if "%OpStart%" == "" SET OpStart=0

if "%3" == "" (
SET OpEnd=
SET /P OpEnd= Opening End Time [1:30.000] ?
) else (
SET OpEnd=%3
)
if "%OpEnd%" == "" SET OpEnd=1:30.000

if "%4" == "" (
SET EndStart=
SET /P EndStart= Ending Start Time [0:00.000] ?
) else (
SET EndStart=%4
)
if "%EndStart%" == "" SET EndStart=0

if "%OpStart%" == "0" (
if "%OpEnd%" == "0" (
if not "%EndStart%" == "0" (
%mkvmerge% -o %INPUT%_new.mkv %INPUT% --split timecodes:%EndStart%
del /Q %INPUT%_new-002.mkv
)
) else (
if not "%EndStart%" == "0" (
%mkvmerge% -o %INPUT%_new.mkv %INPUT% --split timecodes:%OpEnd%,%EndStart%
del /Q %INPUT%_new-001.mkv %INPUT%_new-003.mkv
) else (
%mkvmerge% -o %INPUT%_new.mkv %INPUT% --split timecodes:%OpEnd%
del /Q %INPUT%_new-001.mkv
)
)
) else (
if not "%EndStart%" == "0" (
%mkvmerge% -o %INPUT%_new.mkv %INPUT% --split timecodes:%OpStart%,%OpEnd%,%EndStart%
) else (
%mkvmerge% -o %INPUT%_new.mkv %INPUT% --split timecodes:%OpStart%,%OpEnd%
)
%mkvmerge% -o %INPUT%_new.mkv %INPUT%_new-001.mkv +%INPUT%_new-003.mkv
del /Q %INPUT%_new-001.mkv %INPUT%_new-002.mkv %INPUT%_new-003.mkv %INPUT%_new-004.mkv
)

Placio74
30th September 2007, 14:56
...
But it's far from perfect: ...

Yes. Not perfect, but... You try latest SVN build (rev 3600 at this moment)?

chros
30th September 2007, 17:47
Yes. Not perfect, but... You try latest SVN build (rev 3600 at this moment)?
Yes, I have tried rev 3600 build by LoRd_MuldeR ...

@pcjco04: thank you for your script, I'll look into it ...
EDIT: Perhaps you can read this topic too ... (http://forum.doom9.org/showthread.php?t=63956)

SpAwN_gUy
1st October 2007, 09:35
well... the funny thing is ... hehe..
so the thing is.. that VD and VDM can open MKVs.. but they are complaining on vfw decoder to be installed.. (i've tried x264vfw and ffdsow's vfw.. no good..)

i will try the Avidemux

harycover
4th December 2007, 14:42
mkvtoolnix (global tab) can split mkv files with audio and subtitles working fine, but without visual control

SpAwN_gUy
4th December 2007, 15:16
mkvtoolnix (global tab) can split mkv files with audio and subtitles working fine, but without visual controlyes, indeed, if you've read the first page, you would know that.. it is very hard to predict where Exactly it Will cut, 'cause you never know (well.. only if keyframe is obvious) where the keyframe is..

harycover
4th December 2007, 15:29
sorry, didn't read everything... however tried avidemux and I can't seem to have satisfiying results : it give me mkv files that I can read but not browse, even when I "reconstruct frames"

so I'll stick to mkvtoolnix for the moment

mean
4th December 2007, 20:24
Try with a version more recent than r3696
It was the cues not done correctly, that prevented seeking

aLu
24th February 2008, 12:36
Thanks again, chros & pcjco04! This keyframe preview with MediaPlayer Classic is a ***very helpful tool*** I think many users are unaware of.
Before finding this page I had decided that the best way to find the IDR-frames in AVC video was to demux and use Donald Graft's DGAVCDec (http://neuron2.net/dgavcdec/dgavcdec.html)together with Avisynth/VirtualDub.
Unfortunately, Cut Assistant (http://sourceforge.net/projects/cutassistant/) doesn't support MKV, otherwise it would be interesting because of its Smart Rendering capability - cutting frame-accurately by reincoding between keyframes.
I wish Matroska support was growing faster among the editing apps.

chros
3rd March 2008, 10:31
Thanks again, chros & pcjco04! This keyframe preview with MediaPlayer Classic is a ***very helpful tool*** I think many users are unaware of.
I'm glad that we can help you !
Unfortunately, Cut Assistant (http://sourceforge.net/projects/cutassistant/) doesn't support MKV, ...
I haven't known this app, I'll try it with other containers , thanks !

legionator2
12th March 2008, 08:09
About the MPC & mkvmerge method, I have used it for a while. Sometimes it's still not exactly what I want, though the input seems to be correct. But in generally, it often gives very accurate result.

chros
12th March 2008, 13:45
About the MPC & mkvmerge method, I have used it for a while. Sometimes it's still not exactly what I want, though the input seems to be correct. But in generally, it often gives very accurate result.
If you like you can upload a sample to somewhere ...

legionator2
14th March 2008, 11:08
Sorry but I think it's against the rules, since I tried with a fansub, though the series hasn't been licensed yet.

shawn8888
2nd June 2008, 00:53
Thank you very much chros for the solution on the 11th!
I have tried Avidemux but like you said, it is far from perfect because the result file is not able to play.

Hope someday there is a better tool for mkv editing.

chros
2nd June 2008, 10:08
Thank you very much chros for the solution on the 11th!
You're welcome ! And tell your friends about it ...

Greets

roozhou
2nd June 2008, 10:42
About the MPC & mkvmerge method, I have used it for a while. Sometimes it's still not exactly what I want, though the input seems to be correct. But in generally, it often gives very accurate result.

Mkvmerge will cut at the nearest I-frame behind the timecodes you enter.

e.g. There are two I-frames at 10s and 20s, and you tell mkvmerge to split at 11s. You will get one video from start to19.999s and the other from 20s to end.

lollol
23rd July 2008, 22:23
I tried to split a h264 file (MKV) with avidemux, but it doesnt work... it gives me a corrupted file

I just spent literally hours to find out how to split this file, and cant find anything...

VirtualDubMod: when i open the file, it says it cant find a VwF decoder, while i have installed ffdshow and selected the coded in 'vwf options'
mkvtoolnix: when i choose "split by size", it does work, but when i split by time, it doesnt :S It just gives me the whole file, instead of splitting it.

Can someone please tell me what im doing wrong? Even searched on this forum and google, but always get vdubmod, avidemux and mkvtoolnix... none of them work for me :(

Revgen
24th July 2008, 02:08
Would it be possible to create an MKV input plugin for VirtuaDub 1.8.0?

lollol
24th July 2008, 02:27
VirtualDubMod already supports MKV files natively, so what the use for a plugin?

However, i am surprised it cant open genuine x264 files, cause it cant detect the ffdshow vfw decoder

LoRd_MuldeR
24th July 2008, 02:48
VirtualDubMod already supports MKV files natively, so what the use for a plugin?

However, i am surprised it cant open genuine x264 files, cause it cant detect the ffdshow vfw decoder

VirtualDubMod is an ancient fork of VirtualDub, which was abandoned long ago. You really should go with up-to-date VirtualDub now!
Also the MKV support that was hacked into VirtualDubMod is so much outdated that even the Matroska site warns you about VirtualDubMod.
Nevertheless I'm not aware of a MKV Plugin for VirtualDub 1.8.x yet...

"VirtualDubMOD: Project is more or less abandoned, nobody is working on it actively. Also, it can't support most of the modern MKV files anymore. (...) Better use mkvtoolnix or avi-mux GUI."

foxyshadis
24th July 2008, 07:06
Virtualdubmod only creates and opens vfw-mode mkv files created by virtualdubmod - in other words, they're a glorified avi. If your file isn't, you get tons of errors. Avidemux can handle them, but why not go right to the source: Use mkvmerge(gui) to split by times? It has a tab dedicated to different modes of splitting a file.

lollol
24th July 2008, 15:38
Virtualdubmod only creates and opens vfw-mode mkv files created by virtualdubmod - in other words, they're a glorified avi. If your file isn't, you get tons of errors. Avidemux can handle them, but why not go right to the source: Use mkvmerge(gui) to split by times? It has a tab dedicated to different modes of splitting a file.Thats what i tried, but it didnt work for me :S

It just gave me the whole file again... however, i can cut with the latest avidemux build (something must have been fixed, cause i couldt do that before), but i can only cut at keyframes.

And the keyframes in my MKV file come only after 10 seconds :S Is that normale for a H264 MKV file? That u can only kut at keyframes AND that the keyframes only come after 10 seconds?

@ Mulder: thnx for the explanation, i never knew VbudMOd was abandoned (as staxrip still uses it). Now i will try to make a mp4 from the mkv file, and try to open it in latest virtualdub

Revgen
25th July 2008, 21:56
You have to adjust your max GOP when you encode to AVC. Otherwise it's a pain to edit regardless of whether you use MP4 or MKV.

lollol
26th July 2008, 00:20
What do u recommend and how can i change it?

I use StaxRip profiles, but i assume i can change the GOP.

Is it these settings:

http://i37.tinypic.com/14mwdjn.png

LoRd_MuldeR
26th July 2008, 00:25
The rule of thumb says: Min GOP Size = FPS; Max GOP Size = FPS * 10

So this looks okay, assuming your video is 25 fps...

lollol
26th July 2008, 12:54
Hmm, so there is no way of cutting more accurate when u have a x264 video?

A bit disappointing

LoRd_MuldeR
26th July 2008, 16:48
It's the same with every video format and every video encoder:
When cutting the encoded video, each segment has to start with an I-Frame (IDR-Frame) and there must not be any "lonesome" B-Frames at the end of a segment.

A shorter key-frame interval will allow you to cut more accurate, but it will also sacrifice compression...

lollol
27th July 2008, 03:21
Hmm, i remember cutting XviD video's with frame accuracy, but i assume that is because of the small GOP size and thus the crap compression?

Are u aware of any software which can do frame-accurate cutting of H264 by RE-ENCODING the B-frames? Yes, i know it would be sacrificing quality, but i really would like to know if such software exists :)