dfaker / WebmGenerator

UI and Automation to cut, filter and join high quality webms, mp4s or gifs.
Mozilla Public License 2.0
517 stars 33 forks source link
transition-effects video video-clip video-cliper video-editing video-editor video-processing webm

WebmGenerator

UI Preview

Windows Downloads here: https://github.com/dfaker/WebmGenerator/releases

A tool for cutting, filtering and joining video clips, supports webm (VP8, VP9), mp4 (x264, H.265, SVT AV1) and high quality gif outputs, includes realtime effect filtering and transition effects between scenes.

Some examples of the possible outputs are in the wiki

External dependencies:

All of these should be placed into the same folder as the script or on the PATH.

Python dependencies:

To run with python 3 directly these packages are used:

pip can install them all for you with a single command:

pip3 install -r requirements.txt

For Linux users tkinter may not be installed, to install it in ubuntu for example run: sudo apt-get install python3-tk

Alternatively windows users may use one of the recent bundled releases: https://github.com/dfaker/WebmGenerator/releases.

Usage

to start run webmGenerator.py or drop video files directly onto webmGenerator.py.

Starting up - Initial Interface

Initial Interface

Initially the application opens in the Cuts tab, in the left-hand panel you have a Slice settings frame:

Below that are:

Below that is your source videos frame, you can click Load Videos to load one or more source videos for cutting, or quickly clear all of your sub clip selections to start your cut process again.

Cutting the Clips - Subclip Selection

Sub clip Selection

Once a clip is loaded the bottom dark gray panel changes into a video timeline, you can left click anywhere in it or click and drag to scrub though the video.

Right clicking brings up a context menu that allows you to:

Once a clip has been added you can drag the blue and red start and end markers to change the start and end points of the subclip, the player will seek to whatever position your drag the start or end point to.

When a start and end marker has been clicked it will remain selected with a white border, the left and right arrow keys can be used to move the selected marker a single frame forwards and backwards for precise start and end point selection.

The green central bar between the markers may also be dragged to move the whole time window back and forth while keeping the same subclip duration.

Scrolling the mouse wheel on the timeline will zoom in and out, the gray bar at the top of the timeline window may then be used to scrub your zoomed view through the clip to view earlier or later sections.

Scrolling the mouse wheel on the green selection bar at the bottom of a subclip will shift that sublcip (both start and end) forwards and backwards while retaining total duration.

Cutting More - Markers and Size Targeting

Markers and Length Targeting

The above image shows both the presence of the timeline markers added with Add interest mark and multiple sub clips that have already been added and resized, Not that with these three sections selected the final output duration is at 1:56 seconds, because this is over the selected Target Length the progress bar is red.

Add Effects - Filtering

Filtering

Once all subclips have been defined you may want to use the Filters tab to add visual filters, denoising or cropping, but this tab can be skipped if you don't need any filters applied.

The right-hand pane shows you a real-time video preview of what your output will look like with the selected filters applied.

The left-hand pane shows:

Below that is the stack of filters applied to the current subclip, this clip has had a hue adjustment added and a pre-configired libpostproc filter for denoising and deblocking poorly encoded video.

Each of the filters may be Removed, Enabled, or moved up and down the filtering order with the buttons that appear below its title, if the filter has any input options they will be displayed as input fields below these buttons, the hue filter in the image for example has been configured to shift the 'h' hue value by 0.42 and increase the 's' saturation value by 3.4.

Adjust effects in time - Timeline Filtering

Timeline Filtering

Certain filter values have two buttons to their left T and S, clicking T will stop using the supplied filter value and switch the parameter to use timeline keyframed values, pressing S selects the parameter and displays that parameter's currently keyframe values on the lower timeline.

The example shows an overlay filer in use, both the x and y cordindate parameters are both enabed as timeline keyframed values, te y parameter is selected and has 4 keyframed values set causing the overlaid batman mask to drif up slowly to follow the actor's face during the scene.

Right clicking on the lower timeline displays a menu allowing addition or removal of Keyframed valyes, scrolling the mousewheel will increment or decrement an existing keyframed value and seek to the keyframed time in the clip - it's recomended to reduce the Preview speed during this operation for more accurate adjustments.

Advanced controls for rotation and alignment- Timeline Filtering

Some pretty experimental controls for the timeline at the moment, we'll no doubt refine them:

On lower timeline bar:

When an angle property is slected on the video player:

When an X or Y property is slected on the video player:

Join - Sequencing and Transitions

Sequencing and Transitions

Finally, is the Merge tab, If you've not visited it during the current clipping session it'll automatically add all current clips into the sequence on first visit.

The top Available Cuts frame shows all of your currently selected sub clips along with a preview of what they'll look like with their applied filters, the button below each is used to add them in to the lower Sequence frame.

The Merge style drop down allows you to switch between joining all the selected clips together, or outputting them as individual isolated clips.

The Sequence panel is the order in which your selected sub clips will appear in the output, the left and right arrow buttons move the sub clips back and forwards in the final video order, the Remove button removes the clip from the planned sequence entirely while keeping it available in the top Avlaible Cuts for re-adding later.

As we're in Sequence mode we have two options to control the fade effect between clips, if any:

On thw loer frame we have the configuration for the output clips:

Make that Video - Encoding

Encoding

When you have a sequence you're happy with, you can click 'Encode' to start the encoding process, the progress of the encoding run will be displayed at the bottom as a progress bar, submitted encoding jobs are processed sequentially.

The tool will first make the cuts and apply filters to the subclips and save them in a temporary folder called tempVideoFiles this is cleared down after every exit. After all the clips are cut and filtered they will be joined and if they pass the Maximum File Size limit, if any they, will be saved to a folder in the same directory as the script called finalVideos, if there is a size limit in place the final encoding step will be repeated using the same tempVideoFiles at a lower quality.

Menu and Options

Menus

A number of options and utilities are placed within the three menus at the top of the window:

configuration.json

statsWorkers - The number of threads that are allowed to run, have responsibility for background analysis of video such as scene changes and audio loudness isolation.

encodeWorkers - The number of ffmpeg instances that will run to perform the final encodes in parallel.

imageWorkers - The number of threads dedicated to providding the filter preview images and timeline thumbnails.

encoderStageThreads - The number of threads used by the final encoder if it supports multi-threaded encoding.

maxSizeOptimizationRetries - The maximim number of times the system will attempt to get under the file size target before giving up.

tempFolder- The folder where in-progress video files are stored.

tempDownloadFolder - The folder where downloads from youtube-dlp are placed.

downloadNameFormat - A naming mask that controls how youtube-dlp formats the final filename output.

defaultProfile - The default profile that is initially selected and set in the encode tab.

defaultPostProcessingFilter - The default post filter that's applied in the encode tab.

defaultSliceLength - The default length of a subclip added with the 'b' key or add new subclip menu option.

defaultTargetLength - The target duration the length counter and warning bar is set to on the cuts tab.

defaultTrimLength - The default amount of time assumed to be taken up in fades between scenes.

defaultDragOffset - The amount of time the seek position will skip back into the video when dragging the wntire subclip.

defaultVideoFolder - Default folder to open when opeining a new video file.

defaultImageFolder - Default folder to open when opeining a new image file.

defaultAudioFolder - Default folder to open when opeining a new audio file.

defaultFontFolder - Default folder to open when opeining a new font file.

defaultSubtitleFolder - Default folder to open when opeining a new subtitle *.srt file.

loopNudgeLimit1,loopNudgeLimit2,loopSearchLower1,loopSearchUpper1,loopSearchLower2,loopSearchUpper2 - The maximum and minimum ranges that the 'loop tools' menu will use during scans.

seekSpeedNormal - Standard seek speed.

seekSpeedFast - Seek speed when holding down shift.

seekSpeedSlow - Seek speed when holding down ctrl-shift.