Open mifi opened 2 years ago
this was closed by accident
there's now a new http api
Feature request: Immediate execution of detectSilentScenes with parameters via API
Similar to the recently implemented goToTimecodeDirect action (ref: #2087), I'd like to propose adding the ability to execute detectSilentScenes with specified parameters via the HTTP API.
Current implementation:
curl -X POST http://localhost:8080/api/action/detectSilentScenes
This opens the silent detection dialog in the GUI, requiring manual input.
Proposed implementation:
curl -X POST http://localhost:8080/api/action/detectSilentScenes --json "{\"noise\": \"-50\", \"duration\": \"1.0\"}"
This would allow:
Benefits:
I believe this enhancement would significantly improve the programmatic control of LosslessCut, especially for automated workflows and batch processing scenarios.
- Specifying parameters (noise threshold and duration) directly in the API call.
not sure how much of a benefit this gives compared to just creating a custom ffmpeg command (outside losslesscut)
- Immediate execution of the silent detection without manual intervention.
I can see that, but maybe that should be implemented in the UI instead so that it remembers people's parameters: https://github.com/mifi/lossless-cut/issues/371#issuecomment-1435702741
But in general I think yea it would be nice to have more non-interactive operations exposed through the API
Thanks for your reply.
not sure how much of a benefit this gives compared to just creating a custom ffmpeg command (outside lossle.
I thought it was a good method and tried it,
ffmpeg.exe -i input.m4a -af silenceremove=start_periods=1:start_silence=2.0:start_threshold=-60dB -c:a copy output.m4a
etc., I get an error saying that cutting the silence requires re-encoding.
Filtergraph 'silenceremove=start_periods=1:start_silence=2.0:start_threshold=-60dB' was specified, but codec copy was selected. Filtering and streamcopy cannot be used together.
I would be happy if the lossless cut CLI alone could handle this without re-encoding. Please don't ask for a reply. I hear it is not a high priority, so I will wait patiently.
okay, it sounds like a use case like that could probably also be solved using an AI like chatpgt by prompting it carefully to write a script to do what you want to do. see also FAQ in https://github.com/mifi/lossless-cut/blob/master/issues.md
Suggested ways to programmatically control LosslessCut. Feel free to add suggestions in comments below.
command line arguments
API / actions / macros
I could imagine some API that allows automating actions in LosslessCut, internally and externally. This could be tied to custom keyboard mappings #254
Run a custom external command from segments
Manual external post processing / dry run export
https://github.com/mifi/lossless-cut/issues/691#issuecomment-2506171320
See also #974
Automated external post processing
Ability to press a button in losslesscut and have it run a custom command line (or more commands, e.g. one cmd per segment) and with ability to inject information about the current segments into this command. I think this requires some coding in one way or another by the user.
I think such a «hack» can currently be achieved by creating a custom bash script. Losslesscut will auto save a project
.llc
file with json5 containing information about each segment. You could create a bash script that you trigger by a keyboard shortcut (outside losslesscut). Then this script will then read the.llc
file and run the desired commands. The workflow would be:See also #1347 and
afterExport
event #974Scripting / automation of app actions
from https://github.com/mifi/lossless-cut/discussions/2135#discussioncomment-10492948:
Maybe add scripting feature for existing commands, so we can make our own automation scripts in javascript. Then we could assign them to keys or add them to menus, right click commands, icons. This could massively expand capabilities and add a ton of flexibility to UI.
This it could also ease your development of hard coding everything.
For example, this is the best feature of BLENDER with its console and scripting feature or REAPER DAW, they are basically a giant command library with a UI where everything can be scripted and automated. The users then created an entire ecosystem with thousands of scripts and add-ons.