Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/angrycarrot789/framepfx

A non-linear video editor written in C# using Avalonia
https://github.com/angrycarrot789/framepfx

avalonia csharp ffmpeg non-linear-editing portaudio skiasharp video-editor

Last synced: 6 days ago
JSON representation

A non-linear video editor written in C# using Avalonia

Awesome Lists containing this project

README

        

# FramePFX

FramePFX is an open source, non-linear video editor, written in C# using Avalonia for the UI.

# Docs

Here are some links to the documentation files, if you want to learn more about the frontend and backend

[Plugin system + FramePFX API](docs/Plugins.md)

[Automation/Animation System](docs/Automation.md)

[Command system, Context Menu System, Shortcuts](docs/Command%20System%20and%20Shortcuts.md)

[Rendering System](docs/Rendering.md)

[Shortcut System Overview](docs/Shortcuts.md)

[UI Overview](docs/TheUI.md)

# Previews

This is the latest version using Avalonia:
![](FramePFX-DesktopUI_2024-12-06_17.33.20.png)

Here is a preview of the export process. Export button is in File>Export, you specify a path and then click Export.
To cancel the render you just click Cancel on the dialog behind the export progress window

The grey panel below "Exporter: FFmpeg" is encoder-specific details
![](FramePFX-DesktopUI_2024-12-07_00.13.06.png)

## Customisable GUI!
Themes can be customised to your linking. They can be saved to disk and modified in-app. The built-in
themes (Dark and Light) should not be modified because changes aren't saved. You should create a copy and modify that copy instead
![](FramePFX-DesktopUI_2024-12-29_08.30.49.png)

# Building
FramePFX assumes everything is 64 bit --- x86/32-bit/AnyCPU won't work properly!

The native projects are automatically downloaded and compiled when you first build the C# projects,
however, if you want media clips and exporting to work, FFmpeg needs to be downloaded separately.
Here is the specific version that works currently (windows only):
https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2024-09-30-15-36/ffmpeg-N-117275-g04182b5549-win64-gpl-shared.zip

## Downloading
Clone the project recursively:

`git clone --recursive https://github.com/AngryCarrot789/FramePFX`

If you want to install FFmpeg to use video media clips and FFmpeg export:
- Create ffmpeg folder in solution: `cd FramePFX && mkdir ffmpeg`
- From the downloaded ffmpeg archive, copy the 4 dirs and the LICENCE.txt into that new ffmpeg folder

>There should be 8 DLL files in `\FramePFX\ffmpeg\bin`, and one of them should be avcodec-61.dll. If it's not 61 you have the wrong version of FFmpeg.
You can delete the EXE files if you want, since they aren't used

## Build project
- Open FramePFX.sln. You will get an error about the `portaudio` project not being loaded; Ignore it, and build the solution by going to the `Build` menu and clicking `Build Solution`

Hopefully then you should be able to run and modify FramePFX projects without issue. This project uses Avalonia 11.2.2 and .NET 8 (C# 12).

>Don't modify the portaudio project because it's automatically generated by cmake, so your changes may be overwritten.

### Windows only commands

The projects in the solution use windows commands like mkdir and xcopy, which may not work on other platforms.
Feel free to create a pull request on a more cross-platform solution!

### Possible build problems
Sometimes, the SkiaSharp nuget library doesn't copy the skia library files to the bin folder when you clone this repo and built. There are 2 fixes I found:
- Copy `\packages\SkiaSharp.2.88.7\runtimes\win-x64\native\libSkiaSharp.dll` into the editor's bin folder.
- Or, delete the `packages` folder in the solution dir, then right-click the solution in visual studio and click "Clean Solution", then click Restore Nuget Packages, then rebuild all.
If none of these work, try uninstalling SkiaSharp in the nuget manager and then reinstalling. If that still does not work, then I really don't know what's going on...

# Plugins!
FramePFX now supports plugins! The plugin API is very work in progress, but it can load plugins.
Plugins currently must be compiled using the same dependency versions that FramePFX uses, since we don't use AssemblyLoadContext

You can find more info here: [Plugin system + FramePFX API](docs/Plugins.md)

### Examples
The `AnotherTestPlugin` plugin adds a test configuration page (found in `File > Open Editor Settings`), and also adds a useless test exporter to the export dialog.

Adding the page is very simple, and is doable from the plugin's `OnApplicationLoaded` handler:

```cs
public override async Task OnApplicationLoaded() {
ApplicationConfigurationManager.Instance.RootEntry.AddEntry(new ConfigurationEntry() {
DisplayName = "Test Plugin Settings",
Id = "config.testplugineditorsettings",

// This page is just a PropertyEditor page.
// Completely custom xaml pages are a bit wonky at the moment,
// only user controls will work properly due to resource dictionaries
Page = new TestPluginConfigurationPage()
});
}
```

This results in:
![](FramePFX-DesktopUI_2024-12-27_03.33.53.png)

# TODO
### Avalonia Remake:
- Implement UI for Effects list that can be dropped into a clip/track
### Rendering Engine
- While we have access to port-audio, I think the entire rendering engine needs an overhaul.
Previously, rendering audio by extracting an exact number of bytes from a clip based on the
project frame rate. However, this results in a lot of crackling since the playback FPS isn't pinpoint accurate

Rendering video too needs to be redone, since the view port is typically quite small, but we are rendering full-sized video
frames of each clip and then just scaling down. This isn't so bad for, say, rectangles and basic primitive shapes.
However, rendering a 4K video frame from an MP4 file is a long and nasty task, then scaling down to 1080p (or whatever the MediaScale of the clip is)
and then finally down to the viewport (typically around the 500x300 size) in the end is just hugely wasteful, so we need either RenderFull and
RenderPreview methods, or, a new rendering system. The current technique of async-rendering doesn't seem so bad.
### Automation Engine
- Add support for smooth interpolation (e.g. a curve between 2 key frames). I tried doing this, but had a hard time figuring out the math to do the interpolation, and also doing the hit testing for the UI
### Clips
- AVMediaVideoClip is extremely slow for large resolution videos (e.g. 4K takes around 40ms to decode and render onscreen),
and only a few video codecs even seem to work. Lots of common file formats give an error like "found invalid
data while decoding". I don't know FFmpeg much but I hope to somehow fix this at some point
- Implement fading between 2 clips
### History system
- There's no undo functionality yet. I might try and implement this once I implement a few of the other features like audio and maybe hardware accelerated final-frame assembly in the renderer
### Bugs to fix
- Importing certain video files can cause the render to fail (some sort of "found invalid data while decoding" error)
### Multi-thread synchronisation
- We need to create locks to make accessing and modifying the application state safer, especially now that the activity system works.

Maybe an application-wide lock for writing into the state of the models? This is similar to how IntelliJ IDEA works; a mostly-read, read-write lock.
Write locks are only acquirable on the main thread (we use the dispatcher to get on there), but any thread can take the read lock. Taking the
read lock requires blocking until no write operations are left, and taking the write-lock requires blocking until all readers are done (and
there's also an event fired when trying to acquire the write lock, to let readers cancel their operations to avoid freezing the UI)

## Contributing
Contributions are welcomed with open arms! Just create a pull request, or an issue then PR, whichever you fancy.
You can find information on how to compile and run/debug the app if you scroll up a bit.
The TODO list is above, but you can also just search `// TODO:` in the code base

You can find detailed explanations in the docs folder, which explains the core parts of the editor (such as the
commands, automation, etc.). There's still lots to be documented so it doesn't explain everything

The code base isn't perfect so feel free to help try and standardize things!

# Licence
All source files in FramePFX are under the GNU General Public License version 3.0 or later (GPL v3.0+).
FramePFX uses libraries that have other licences, such as MIT/LGPL licences.

If any source file is missing a copyright notice, it is assumed to be licenced under the same
licence as FramePFX

Currently, the used LGPL parts are:
- FFmpeg.AutoGen, which is licenced under the GNU Lesser General Public License version 3.0 (LGPL v3.0)
- FFmpeg