https://www.youtube.com/watch?v=duxYsWrZB4M an excellent video on how to trim videos in matroska is here.
but why would you want to trim videos in matroska. matroska allows you to combine videos with the codec by right clicking a video you add to it and pressing append. it also allows you to contract or stretch videos to sync audio that may have gotten screwed up by an incorrect frame rate. it also allows you to mix incompatible audio formats for example mp4 can't contain opus but mkv can contain mp4 and opus. still it is a major pain to use matroska with opus over just doing a normal encode and the only advantages are lossless quality and you won't even get that in some situations when uploading to youtube. when should you use matroska for encoding your files when uploading to youtube. if the video files native resolution is 1080p and the native bitrate is no larger than 5000 megabits per second or your encoding at 4k and the megabits per second is no larger than 16 megabits per second. these are just approximate rules. If the resolution is any lower than this. especially if your using a frame rate higher than 30. do not use matroska because youtube doesn't encode files at 240p 60 fps. It only encodes them at 240p 30 fps. for videos where I want to retain the original quality when uploading to youtube that are at a lower resolution but at uncompressed quality. I use a capture card in obs studio with content adaptive quantization on. I use intel quicksync and a bitrate of 5000 megabits per second. for whatever reason I can keep preview on although if you were also recording audio and not recombining it in matroska the audio might not be exactly synced. I had a computer with 32 gb of ram but with this method recording a 1080p screen. I had to stop and restart immediately the recording ever 1 minute. anyway once you know what youre uploading. uploading perfect quality youtube videos is (error found here) a pain in the ass but can be done.
the youtube video above recommends trimming by frame. this is very useful. you can also trim every second if you want or you can edit in your favorite movie program and edit using millisecond centisecond and decisecond. the only problem is although trimming a clip that was cut at the end will be easy. trimming at clip that was cut from the start won't be but there is a way to do it. create an extra video track if your movie program has that functionality. I use movavi. after you add the extra video track. save your project as reference video the name of your video. open your project trim from the beginning to part of the video you want to start at. mute the background track if you wish. write where the video starts at and then trim to its end point. write where the video ends. open up notepad. write clip one and the starting and ending times. save as project clip one. every clip you cut using matroska will use those starting and ending times. label your first clip as clip one. and then write clip one and hit append. as long as you've been writing your starting and ending times in notepad as you go along it should be doable but definetly isn't simple. still it is neat that using this method you can upload things t0 youtube that are identical to how they looked when you recorded them. If you want to use the capture card method to upload things to youtube you can record a preview of how it looks in your video player and just send that to youtube. matroska might only be required for that if the audio isn't quite in sync. why would you want to do a straight record of your video editor instead of using the source files. well visual effects for videos can't be applied to matroska. to reduce the bitrate we use sometimes we apply a filter to our videos. its such a good filter its actually better to reencode the video than to use it in its original format which yes looked good but also had a very large file size.
this was recorded directly from movavi with a 5000 megabits per second bitrate with the filter applied.
the next video was recorded using the capture card method but we did lose the audio because we forgot to extract the audio from the video. we thought av1 would accept our raw rgb file but it didn't. I think it's still the best looking donkey kong country 2 video on youtube that's in it's original format. this version has audio from someone(sic quoted as in original thing)(possibly virus consider revising) else's video. my original video without the annoying audio is on my channel but it has an annoying thumbnail with me with a squirrel face. I figured it made more sense to show the quality of the video in the thumbnail in this case since you can't hover over the thumbnail.