A simple trivial C++ program to generate ffmpeg filter strings to save time. As of this moment it is only limited to trimming. It is done parsing a condig file containting the time stamps of your requirement for the trimming
It has a fmtlib dependency, so either clone it recursively
git clone --recursive https://github.com/worthless443/filtergen_ffmpeg or
git clone https://github.com/worthless443/filtergen_ffmpeg && cd filtergen_ffmpeg
git submodule update --inityou are done with downloading.
The trim script does just about everything (however as of recent changes, still picture extraction has not been tested, we will get to it later)
Compiling fmtlib
[run it with source, as succesfull build of fmt would set a envvar to mark it as done]
source ./trim -compile-fmtCompiling the small file
./trim -compileThe resulting binary, namely filtergen will generate string that can be passed to -filter_complex. It parses a config file, converts input format to the format that which is suitable for ffmpeg and alwats spits out outstream labels as [cv] for video and [ca] for audio.
gf:[<imagine_idx>]:<filter_name>
<options>
gf:end
You would only need to pass stream index when you are using filters that operate on inputs other than the original video (which always should be the first input followed by peripheral inputs), i.e. the overlay filter. An example of which:
gf:1:overlay
1.2
1.4
gf:end
The options here are formatted as <hour>.<min>.<sec>. Overlay only takes two arguments and two only, the first line should corrospond tobegining and second end.
Lastly, run the program with the config file
./filtergen -in <config-file>You can plug the output to the -filter_complex directly or use the ./trim script for more convinience. However as of now, it's better not to until the script is modified to facilitate the new changes as of now.
[Use old binary to use ./trim]
As said earlier, the ./trim script does about everything, it can also be directly used to generate trimmed videos and extract frames all with a simple config file
./trim <infile> <outfile> <conf_file> [<colomn from config to extract frame|->][if is required to generate pictures for each column from the config file,add - at the end of argument list.
- add
overlaykeyword with regular timestamp list to overlay images or text - add position options in the
overlaykeyword - add fade in and out options to overlay
- add external audio options