/python-moshion

Datamoshing Motion - a command line wrapper to ffmpeg used to datamosh two image sequences

Primary LanguagePythonMIT LicenseMIT

python-moshion - Datamoshing Motion

moshion is a command line interface to ffmpeg used to datamosh two video sequences to purposely create encoding artifacts.

This software is in alpha state and no where near production ready.

Try it out but all the usual caveats apply. Use at your own risk etc.

Status and License

Copyright (c) 2014 Robert Moggach, Fabio Piparo & contributors.

Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

About

Traditional 'datamoshing' involves removing I-frames from encoded videos to create encoding artifacts that appear to make frames melt into one another by inheriting the motion of the incoming footage.

This is cool but the result is a moving still frame - we want a moving outgoing picture. By progressively deleting frames from the outgoing clip along with the I-frame of the incoming clip, we hope to create a series of frames that represent the outgoing clip moshed by the motion of the incoming clip. Give it a try.

This has all been done before but usually only produces another video and without alot of flexibility for what we need. We work with discrete frames so moshion accordingly takes two image sequences, splices them together, encodes them, deletes the I-frames to create a moshed video and then extracts the moshed frames as a new image sequence.

Contributing

All kinds of contributions are welcome - code, tests, documentation, bug reports, ideas, etc.

Currently we need to implement the following:

  • testing
  • optimization
  • more encoding options, codecs, tricks to make it better
  • enhanced portability
  • better code all around instead of the rushed hack this is now
  • other mosh techniques

Check out the issues to see what we're focused on.

Forking through GitHub

First of all, you need to fork from the official repository...

Fork python-moshion

Now you can change whatever you want, commit, push to your fork and when your contribution is done, follow the pull request link and explain what you did and why.

Running the tests

Patience. Tests are important and will be implemented.

Documentation

This is admittedly sparse but will get better. For now:

Installation

We don't have any installer at the moment so you kinda need to know what you're doing.

Prerequisites

Without question you need ffmpeg but there are a ton of other libraries you may need as well depending on what images, videos you want to use.

Here are some links:

Mac OSX

Everyone loves homebrew. Getting it to install ffmpeg is not always easy.

brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r \
--with-libass --with-libass --with-libbluray --with-libcaca --with-libquvi \
--with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr \
--with-openjpeg --with-openssl --with-opus --with-rtmpdump --with-schroedinger \
--with-speex --with-theora --with-tools --with-libmp3lame

This is easier...

static FFmpeg binaries for Mac OS X Intel 64bit

Clone the repo

Start by cloning the repo:

git clone https://github.com/mogga/python-moshion.git

Command Line Tool

From within the repo run the included command line script to get a feel for it.

cd python-moshion
./gomoshion.py -s 1 -e 20 -f 5 --input `pwd`/tests/footage/input/input_ftg.%04d.jpg --mosh `pwd`/tests/footage/input/input_ftg.%04d.jpg -o `pwd`/tests/footage/output

or use the interactive mode...

./gomoshion.py -q

Acknowledgements

We use a couple great packages to get this working:

First and foremost is pymosh so a big thank you for that headstart.

Being VFX/CG artists we also rely on cgkit which we use for it's sequence parsing bits.

The really great Ruby AviGlitch is great too although this is python so it was more of an inspiration than anything else.

For our tests we use a few bits from the internet archive specifically this clip:

InternetArchive35mmStockFootageSampleReel

Links

Here are some great places to learn about datamoshing, glitch art, pixel sorting. It's not comprehensive by any stretch... just the links we found as we did our research.