Skip to content

Commit

Permalink
initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
the8472 committed Jun 29, 2017
0 parents commit 10d391f
Show file tree
Hide file tree
Showing 7 changed files with 598 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "ffmpeg-sys"]
path = ffmpeg-sys
url = https://github.com/the8472/rust-ffmpeg-sys.git
branch = motion-fix
69 changes: 69 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "stitch-animation"
version = "0.1.0"
authors = ["The8472 <[email protected]>"]

[dependencies]
ffmpeg = {version = "0.2.0-alpha.2", git = "https://github.com/meh/rust-ffmpeg.git" }

[replace]
"ffmpeg-sys:3.2.1" = {path = "../rust-ffmpeg-sys"}
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# stitch-animation

Linear panning detection and scene extraction using motion vectors already present in video codecs.

For the moment the tool only extracts image sequences and does not align or blend them.
Microsoft ICE, Gimp, Photoshop or similar are recommended to merge them.

![video to frame sequence to composite](doc/video,%20frames,%20composite.png)

## Dependencies

* ffmpeg 1.3.x
* rustc + cargo (build)

## Build

```sh
git clone --recursive
cd stitch-animation
cargo build --release
cp target/release/stitch-animation ~/bin
## alternative, depending on your $PATH
# cargo install
```

## run

`stitch-animation path/video name.mkv`

creates image sequences in the current working directory matching the pattern `./video name.seq/*.png`



## Current limitations

* requires libavcodec support for exporting motion vectors (e.g. the mpeg family)
* I-frames in the middle of a scene currently
* any kind of non-linear motion is not actively supported. they just may happen to work anyway. this includes
zoom, rotations, stops during the pan, sharp turns in the path taken by the camera.
* can not be considered fully automated until it spits out decent composites with minimal artifacts


## Future work

* fast planar stitching (opencv? hugin?)
* remove foreground objects and logos (trimmed mean over multiple layers, gradient blending, smarter frame selection)
* multi-threaded PNG encoding
* estimate affine transforms for global motion instead of dominant vector
* detect still frames by diffing random samples
* use ffmpeg's `mestimate` filter to construct vectors if none are present (would help with I-frames too)

Binary file added doc/video, frames, composite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ffmpeg-sys
Submodule ffmpeg-sys added at 90bc01
Loading

0 comments on commit 10d391f

Please sign in to comment.