Menu

Using

Dr. Juergen Sauermann

Using mpeg_cut

Starting mpeg_cut

mpeg_cut is started with a the name of a file that contains an mpeg transport stream. Often these files have a filename ending in .ts:

mpeg_cut myvideo.ts

This should start mpeg_cut and opens myvideo.ts. At this point, no video content is shown, because we are at the beginning of the file.

Saving the modified file

At any point in time, you can push the Save button (or the S key on your keyboard). This saves those parts of the input the input file that you have marked for saving (see below). The color of the Save button indicates if the current marking has changed (yellow) or not (green) since the last time it was changed.

Saving the file takes a while; the Save button turns green after saving is finished.

The input file is never changed; instead a new file with an additional extension .out is created (myvideo.ts.out in the above example).

Concepts

Before explaining the details of how mpeg_cut is used (and what is does), a few concepts should be explained.

Current file position

The current file position is a position (a byte offset) in the input file with the following properties:

  • It is at a packet boundary
  • It is at an I-frame boundary, unless the movie is running (see below)

The current file position is shown in different ways:

  • The video area that makes up most of the mpeg_cut window shows the video content at the current file position

  • The TS: label shows the timestamp of the current file position

  • The Pkt: label shows the packet number of the current file position
  • The file cursor (vertical black bar on the horizontal white bar below the video area) shows the current file position it relation to the total file size

The current file position can be changed in several ways:

  • by pushing the Stopped/Running button
  • by pushing the cutpoint buttons < or >
  • by moving one of the navigation wheels
  • by pushing the Back button
  • by clicking in the white bar containing the file cursor

Stop position

A stop position is the position of an I-frame in the input file. If you change the current file position with some of the methods mentioned above, then the new
file position is not exactly the chosen position, but the end of the next I-frame after the chosen position. The reason for this is that mpeg files should be cut at I-frame boundaries, because other frames may need them in order to be displayed correctly.

This was the reason for introducing the Back button (see below) in mpeg_cut 0.9.0, and it may explain why the lower navigation sometimes behaves unexpectedly.

Cutpoint

mpeg_cut marks the packets of the input files as:

  • packets that will be copied into the output file when the Save button is pushed
  • packets that will be skipped (i.e. not copied)

A cutpoint is is a stop position where the marking changes. When mpeg_cut starts, then no cutpoints are defined. By navigating through the input file, and by pushing the Skip/Copy button,you can add or remove cutpoints.

The Green/Red bar at the bottom of the mpeg_cut window) shows which parts of the video will be copied (green) and which will be skipped (red). Pushing the P button on the
keyboard (while the peg_cut window has the focus will print the current cutlist on stdout.

Navigation

Navigation means to change the current file position, usually as a preparation for setting or removing cutpoints. In almost all cases the purpose it to set cutpoints at the start and at the end of advertisements in a recorded movie, and mpeg_cut has been optimized for this case.

Navigation Wheels

There are 4 Navigation wheels located between the different buttons in the mpeg_cut window. The wheels have different sensitivities; the upper wheels move the current file position faster, while the lower wheels move slower. The lowest wheel moves the current file position by about one or two I-frames. I-frames vary in size, therefore the number of I-frames is not exactly one I-frame when you move the lowest wheel.

The wheels (and with then the current file position) can be moved in different ways:

  • by scrolling the wheel of your mouse (if it has one)
  • by dragging the navigation wheel (move the mouse with its left button held down)
  • by clicking the left or the right mouse button (without moving the mouse)

Cutlist left/right buttons

Deletion of a cutpoint requires that the current file position is exactly the cutpoint that shall be deleted. For this purpose there are two buttons labelled < and > (with the word CUT between them) that set the current file position to the previous or to the next file position.

Stopped/Running button

If you push the Stopped/Running button then the video is played (like on your DVR) until the button is pushed again, or another navigation button or wheel is used.

Back button

You almost found the end of a movie section and you move forward very slowly with the lowest navigation wheel. Moving forward is precise (it moves by one I-frame) while moving backwards is not (it may move one or two I-frames, or even more). So just moving the lowest navigation wheel back by one position may or may not bring you to the previous stop position. This can make fine-tuning of a cutpoint very tedious. What you can do instead is to push the Back button. mpeg_cut remembers the last stop positions and undoes the last moves.

Help

If you cannot remember all this, push the button labelled ? (left of the Back button, or push F1 on your keyboard. This changes the cursor to a question mark. Now click on any widget (button, wheel, or label) in the mpeg_cut window, and a short help text for the widget will be displayed (as of mpeg_cut 0.9.0).


Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.