Home / pim / 2022.12.14
Name Modified Size InfoDownloads / Week
Parent folder
pim.readme.txt 2022-12-14 1.7 kB
pim 2022-12-14 1.3 kB
Totals: 2 Items   3.0 kB 0
pim v2022.12.14 | FFmpeg made simpler | POSIX shell script

Lossless Video/Audio Cut with FFmpeg

Installation: Place pim script into /usr/local/bin directory (for example)
together with pim.readme.txt file. If you would like to place pim.readme.txt
into other directory, edit pim; specify the full path as an argument of
myreadmepath variable.

Usage

Specify a video/audio file, the end of the section that you want to trim, and
optionally the start of the section that you want to trim. If no start time is
given, FFmpeg will start from the beginning. Time format is "H[H]:M[M]:S[S]".
You can give the milliseconds, too (after "S[S]."). The edited file will be
produced in the current working directory (where you run this script from).

Use mpv media player to determine the exact timestamps. Move your mouse over
the lower part of mpv window. Click on the time to change for detailed view.
Click on the right time to change between the remaining time and total
duration. Leave the mouse over there and you can view the time constantly.
Change with <Alt-Tab> to your terminal and enter the timestamps.

When performing a lossless cut, it is only possible to start on a keyframe.
Whether you understand what that means or not, the important thing to remember
is that the start time and length of the movie will not be exact. The length
will mostly likely be a little longer than you specify.

To display this help text run pim without any argument.

References:

https://www.joyoshare.com/video-cutting/ffmpeg-trim-cut-video.html
http://loopduplicate.com/content/lossless-video-cut-with-ffmpeg

This POSIX script was checked at: https://www.shellcheck.net/
Source: pim.readme.txt, updated 2022-12-14