This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

[INFO] MKV Cutter - tool to cut h.264 mkv files frame accurate,...
#1
Here I share the ALPHA version of a small tool I work on from time-to-time.

https://drive.google.com/drive/folders/1...share_link
What is it ment to do?
It is ment to be a small gui which allows to frame accurately (by using smart rendering) cut mkv files.

here's a general overview how MKVCutter works:
  1. analyze content with MKVInfo (to get the key frame positions, frame count, frame rate and track layout)
  2. analyze content with MediaInfo (scan type and field order, bit depth, chroma subsampling, audio delays, and the original x264 settings if the source carries them)
  3. index the content with ffmsindex so the preview can seek
  4. create AvisynthSkript to preview the content (simple script that calls FFVideoSource on the input)
  5. let user set which parts of the content he wants
  6. create audio and video cut lists for mkvmerge, create trim calls (and cut the timestamp file, if the source is vfr)
  7. let user set the output name and the temp folder
  8. call mkvmerge with the video cut lists to create a bunch of temporary files (here the cuts are always on key frames)
  9. extract those parts to H.264 elementary streams with ffmpeg
  10. analyze one of the not reencoded parts with h264_parse to improve compatibility
  11. create avisynth scripts using the trim calls and FFVideoSource to decode the GOPs that need reencoding (smart rendering)
  12. create x264 call to reencode the content provided by the avisynth scripts (profile, level, ref frames, bframes, cabac, keyint and field order are taken from the source)
  13. call x264 to reencode
  14. when all GOPs that need to be reencoded are reencoded, call mkvmerge to cut the audio - one file per part - and extract&cut the subtitles
  15. merge the new audio, video and all the reencoded and kept GOPs, giving each audio part the offset that puts it back at the start of its video part

Quote:This is how one uses 'MKV Cutter': (or how the author envisioned one would use it)
  1. Start MKV Cutter
  2. Press 'Open Source' and select the .mkv file you want to cut.
  3. MKV Cutter will now use MkvInfo, Mediainfo and ffmsindex to analyse and index the source, once it's finished a new screen will show.
  4. Here one selects the parts of the movie one wants to keep.
  5. Go to a 'start-point' of a section you want to keep.
  6. Press 'Cut-Start'
  7. Go to the 'end-point' of the current section you want to keep.
  8. Press 'Cut-End'
  9. The selected section should now be highlighted on the slider.
  10. Press 'Add to Cut-List', so the selection section will be remebered.
  11. Repeat step 5.-10. for all sections you want to keep.
  12. (optional) Press 'Save' to write the cut list to a .cut file, 'Load' reads one back in.
  13. Press 'Commit Cut-List' to finish the selection definition.
  14. In the next view you set the 'Output' (File) and 'Temp folder'
  15. Press 'Output' and set the name and location of the output file.
  16. Press 'Temp folder' to set the folder that is used for temporal files.
  17. Press 'Next' to start the actual processing.
  18. Wait till 'MKVCutter' is done and the 'Finished!' popup appears.

What it handles these days:
  • H.264 in Matroska, 8 and 10 bit, 4:2:0, 4:2:2 and 4:4:4
  • progressive, MBAFF and PAFF sources - for field coded content the container counts fields while Avisynth counts frames, so the ratio is measured and everything is converted
  • constant and variable frame rate (the timestamp file is cut along)
  • subtitles: SRT, ASS/SSA and VobSub are cut and kept
  • several audio tracks per file, copied through
  • if every cut already sits on a key frame, nothing is reencoded at all
  • it can be driven from the command line with --clinput, so a cut can run unattended

A word on the audio:
Compressed audio can only be cut losslessly on frame boundaries - 32ms for AC-3 - so every part comes out a bit shorter or longer than asked for. The parts are therefore cut into separate files and joined while muxing, each with the offset that puts it back at the start of its video part. Without that the rounding errors add up and the sound slowly runs ahead of the picture.

Limitations:
Since it's a alpha version and I really only look at it from time to time when there are some major shortcomings.
  • it only properly supports H.264 content (users reported: H.265 content can be cut, cut not frame accurate)
  • it has an ugly user-interface
  • it does not come with any bells&whistles
  • x264 encoding is still rudimentary: the settings follow the source, but the quality is always a crf 19 encode and there is no user choice
  • PGS subtitles are not cut and get dropped
  • chapters, attachments and global tags are dropped
  • audio is not reencoded, so a cut can only land on an audio frame boundary
  • Windows OS only atm. (mainly because Avisynth is used for decoding and preview; in theory ffmpeg could be used as alternative so porting to Linux&Co should be possible)


Cu Selur

Ps.: now there is a github page: https://github.com/Selur/MKVCutter
PPs.: Patches&Co are welcome.
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
#2
update 2017.06.25: MKV Cutter should now be able to mkvs with non constant time code differences (vfr content). Smile

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
#3
Uploaded MkvCutter_r20260909 which fixes a few bugs and updated the text in the first post. (also using 64bit tool versions now)

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.


Forum Jump:


Users browsing this thread: 1 Guest(s)