LosslessCut has basic support for automation through the CLI. See also HTTP API.
LosslessCut [options] [files]
Note that these examples assume that you have set up the LosslessCut executable to be available in your PATH
(command line environment). Alternatively you can run it like this:
# First navigate to the folder containing the LosslessCut app
cd /path/to/directory/containing/app
# Then run it
# On Linux:
./LosslessCut arguments
# On Windows:
./LosslessCut.exe arguments
# On MacOS:
./LosslessCut.app/Contents/MacOS/LosslessCut arguments
LosslessCut file1.mp4 file2.mkv
See available settings. Note that this is subject to change in newer versions.
LosslessCut --settings-json '{captureFormat:"jpeg", "keyframeCut":true}'
--locales-path
Customise path to locales (useful for translators).--disable-networking
Turn off all network requests.--http-api
Start the HTTP server with an API to control LosslessCut, optionally specifying a port (default8080
).--keyboard-action
Run a keyboard action (see below.)--config-dir
Path to a directory where theconfig.json
file will be stored and loaded from. Note: don't includeconfig.json
in the path (only the directory containing it).
If you have the "Allow multiple instances" setting enabled, you can control a running instance of LosslessCut from the outside, using for example a command line. You do this by issuing messages to it through the LosslessCut
command. Currently only keyboard actions are supported, and you can open files. Note that this is considered experimental and the API may change at any time.
Simulate a keyboard press action in an already running instance of LosslessCut. Note that the command will return immediately, so if you want to run multiple actions in a sequence, you have to sleep
for a few seconds between the commands. Alternatively if you want to wait until an action has finished processing, you can use the HTTP API instead. Note that the HTTP API does not support opening files, and it is currently not possible to wait for a file to have finished opening.
A list of the available action names can be found in the "Keyboard shortcuts" dialog in the app. Note that you don't have to bind them to any key before using them.
Example:
# Open a file in an already running instance
LosslessCut file.mp4
sleep 3 # hopefully the file has loaded by now
# Export the currently opened file
LosslessCut --keyboard-action export
LosslessCut file1.mp4 file2.mkv