User Tools

Site Tools


video:editing

video editing

In Brief

Release v2.0.0 of MMP: Minimalist Media Player introduced timeline editing features for both audio and video files, along with media file stream-selection.

As with any audio or video editor, the media file can be cut into segments which can either be included or excluded from the output file.

And because it's “lossless”1), no re-encoding takes place. So it's quick. Very quick! Just a few seconds, regardless of how many segments you chop up your media file into, or how many streams you include or exclude from your original media file.

audio / video / subtitle streams

Video files, especially movies, often contain multiple streams with all the soundtracks in various languages, and numerous subtitle tracks, also in various languages.
MMP: Minimalist Media Player lets you very quickly and easily select which streams will be included in the output file.

Generally speaking, you will probabaly want to only include the video stream, the audio stream in your native language and the subtitles in your native language.
You might also wish to remove a director's commentary track, along with all the foreign language subtitles.

This is all very easy: it simply requires you to click on a stream to include or exclude it.

You can scroll up and down these lists using either the scroll bars or the mouse wheel.

If fact, if all you want to do is remove particular streams from your file, you can open the timeline editing window (Ctrl [E]), deselect the streams you don't want, and click “Export”.
An exact copy of your media file will be created, minus the streams you deselected.
Your original media file is always left intact.
See Extract Audio and Remove Audio

TimeCode

Clicking the timecode display will switch it between displaying just seconds (to correspond with the start and end displays on each segment):

to displaying the seconds as HH:MM:SS

Segments

As some segments can be too short for their full details to be displayed on the timeline, the side panel duplicates the segment information with some additional information about segment duration.

Clicking a segment in the side panel selects the corresponding segment in the timeline.
Excluded / Deleted segments are displayed with the trashcan icon both in this list and on the timeline.

The .mmp file

Every change you make to the timeline is immediately saved to disk in a .mmp file named after the media file you're editing.
If you switch to another media file and then return to a previous one, your most recent editing timeline will be loaded from the corresponding .mmp file.
In switching to a new media file, however, you will clear the record of changes for the Undo/Redo operations.

At any time, you can close the timeline editing facility with Ctrl [E], use the media player functions as you wish, and then reopen the timeline again with Ctrl [E].
(Of course, this is only strictly necessary when keys have a different function in the timeline window to what they have in the main media window, namely [C], [I]/[O], [N]/[M], [L]/[S], [R]/[X], [Y]/[Z].)

For the majority of keys, you can operate the media window as normal with the timeline open.

On re-opening the timeline, your edits will immediately be restored from the .mmp file.
As before though, doing this will clear the Undo/Redo list.

Video Playback

When playing a video or audio file with the editing timeline open, MMP will stop when playback reaches the end;
MMP will not automatically play the next file as it usually does, nor will it exit if this is the final item in the playlist.
Rather, the timeline will remain open for you to continue editing.

Keyboard and Mouse Controls

All the keyboard controls of the main media display are available to control the media file as usual except for those keys used to control the timeline. These will override their corresponding normal key function.

The vertical cursor shows the current position within the media file.
This cursor can be grabbed with the mouse and moved to reposition the audo/video file.
Alternatively, the usual tabbing functions and playback functions, frame forwards [←] and frame backwards [→] etc. can be used to set the position of the media file.
The progress bar can also be clicked or Ctrl-mouse-moved to find the required part of the video (or audio).

Control Action
Ctrl [Z] Undo the previous action.
Ctrl [Y] Redo the previously undone action.
[C] Cut the segment under the vertical cursor into two segments.
Ctrl [C] Cut the segment under the vertical cursor into two segments and mark the lefthand segment as deleted. This is now the same as [I]
[I] create an In point: cut the segment under the cursor into two and mark the lefthand segment as eXcluded / deleted.
[O] create an Out point: cut the segment under the cursor into two and mark the righthand segment as eXcluded / deleted.

For the remaining operations you must first select a segment by clicking it.

Control Action
[X] eXclude (i.e. delete) the segment from the output file. The trashcan icon will be displayed on all such segments to easily see which segments will be included or excluded from the output file. Note that eXcluded segments can still be Cut in two and operated on. In that case, the lefthand segment of the two will still be marked as deleted, while the righthand one will not. You may of course alter this if you wish.
[R] Restore an excluded/deleted segment.
[M] Merge the segment with the segment to its right. Generally speaking, you don't want adjoining segments as they will cause repitition/overlap in your edited file (see the section below on Exporting). It's better to join consecutive segments into one.
[N] Merge the segment with the segment to its left. (see the comment above)
[S] Shorten the selected segment by one second. This operation cannot be performed on the final segment - to shorten the final segment, lengthen the penultimate segment. You can hold down the key for rapid repetition.
[L] Lengthen the selected segment by one second. This operation cannot be performed on the final segment - to lengthen the final segment, shorten the penultimate segment. You can hold down the key for rapid repetition.

Because [X] usually eXits the app, if you have the timeline open you can exit the app by either using the [ESCape] key, or by pressing Ctrl [0] which closes all running instances of MMP immediately.
Of course, you can also press Ctrl [E] to close the timeline and then press [X] to close the app.

Unless you have another instance of MMP playing background music while you work, the recommendation is to Ctrl [0] out of MMP while you check your edits and then relaunch MMP with your original video and re-open the timeline with Ctrl [E]. Your edited timeline will be restored from the .mmp file.

Chapters

If a media file contains chapter information (and no current .mmp file exists for the media file), segments will be automatically created from the start and end times of the chapters.
Each segment will display its chapter's title. The titles are not currently saved to the .mmp file. 2)

If you don't want to make use of the chapters that a media file contains, you can simply select any chapter segment (left-click with the mouse) and then use the [N] and [M] keys to very quickly merge that chapter segment with all segments to its left and right until you have just one segment for the entire media file.
You can then begin creating your own segments.

Exporting to a new media file

MMP: Minimalist Media Player uses FFmpeg to carry out the actual creation of your edited media file.
FFmpeg will determine the start and end of each segment according to the location of Key Frames in the original media file, so they are unlikely to correspond exactly to your cut points (see Video Cuts).

An exported segment is likely to start slightly early and end slightly early 3).

Consequently, if you have two adjacent segments with no intervening eXcluded segment, there is likely to be some overlap (duplicated frames and audio) in the resultant file.
The only way to have no overlaps at all is to either export only one segment (which may be the entire media file, or one segment defined by In and Out points) or to have gaps in the timeline created by eXcluded / deleted segments.

If you need exact cutting of clips down to the frame level, you will need to use a standard high-end video editor 4).
This is not the purpose of the timeline editing functions in MMP: Minimalist Media Player which is to provide quick-cut, “good enough”, editing of the source file.

Having said that, some fine control can be achieved by exporting your edits, checking the output and then [L]ength-ing or [S]horten-ing a segment by a couple of seconds (for example), re-exporting and re-checking the output.

Unless you happen to make a cut exactly on a keyframe 5), FFmpeg will make the cut at the nearest keyframe before your cut position. (see Video Cuts)
Generally speaking then, you can be confident that the start of a segment will be included in the resulting exported segment of the media file, and you should probably leave a few seconds (e.g. two?) at the end of a segment to be sure that it includes a keyframe that FFmpeg can make the cut at;
that way the segment won't get cut short of what you want to include. As MMP doesn't currently delete the exported segments, you can check that each one includes everything you want.

(Feel free to ask any questions over at Github Discussions).

Each segment in your timeline is exported to a separate segment file, with the individual segment files listed in a .seg file.
All the segments are then joined into the resulting output file.

Currently, each of these segment files will remain on disk for you to delete manually.
If you repeat the export, they will be overwritten, as will the output file.
A future release of MMP: Minimalist Media Player will give you the option to delete the segment files if the join is completed successfully. 6)

If the export of a particular segment fails…

…you will be given the option to ignore the error and continue with the next segment.

Alternatively, if you click “Rerun”, the app will open a command line window and rerun the FFmpeg command so that you can view the FFmpeg errors directly.
If necessary, you can correct FFmpeg's creation of individual segments and then Ctrl-click the Export button - this will run just the “Joining Segments” stage to recreate your finished output file.

DISCLAIMER

ALWAYS, and I mean always! check that your output file matches the edits you wanted to make, before you delete the original file.
You can always reopen the timeline and adjust your edits.
If you are familiar with FFmpeg, you also have the option of examining the FFmpeg command lines recorded in the .log file and then manually running the commands to adjust how FFmpeg operates on your media file.

Neither the MMP developers, nor the MPV develpers, nor the FFmpeg developers will be held responsible if you delete your original file prematurely.

Credits

The timeline editing facility in MMP: Minimalist Media Player was inspired by the excellent LosslessCut.
It is not the intention to implement all the features that LosslessCut provides.
However, there are many standard video and audio formats that the internal [html5?] player in LosslessCut does not support, requiring LosslessCut to convert them to a supported format before editing can begin.
Because MMP: Minimalist Media Player uses MPV/FFmpeg to play media files, there is hardly an audio/video format on the planet that it cannot play.
Consequently, for the standard editing functions, MMP: Minimalist Media Player has distinct advantages over LosslessCut.
Both use FFmpeg to do the actual editing.

1)
segments are extracted “as is” from the original media file and stitched together - no audio or video re-encoding takes place
2)
A future version may make this chapter import optional and may save the chapter titles to the .mmp file
3)
you can obviously make allowances for this by extending each segment by 2 seconds, for example
4)
The excellent ShotCut is an easy recommendation to make
5)
the odds are against it
6)
There will never be the option to automatically delete the original media file being edited
video/editing.txt · Last modified: 2024/06/11 15:04