kisonecat / autocut

Automatically cut off the parts of the video where I'm not speaking
GNU General Public License v3.0
18 stars 2 forks source link

Autocut

I needed a way to make videos for my Calculus MOOC very quickly, and so I build the autocutter.

This tool takes a list of video files, listens to the audio to determine where I start and stop speaking, and builds an edit list suitable for MLT.

If you want help using it, please feel free to contact me.

Requirements

This is a python script packaged using setuptools. The numpy and librosa libraries are used. The python code also depends on MLT being installed.

Instructions

Here is a sample input file. Let's call it sample.xml

<?xml version="1.0" encoding="UTF-8"?>
<movie author="Jim Fowler">
  <video src="https://github.com/kisonecat/autocut/raw/master/title.mp4" audio="intro.wav" in="0" out="3"/>
  <video src="https://github.com/kisonecat/autocut/raw/master/welcome-to-the-course.mts"/>
  <video src="https://github.com/kisonecat/autocut/raw/master/doing-work-on-paper.mts" flip="true"/>
  <video src="https://github.com/kisonecat/autocut/raw/master/farewell-everybody.mts"/>
  <video src="https://github.com/kisonecat/autocut/raw/master/end-title.mp4" audio="outro.wav" in="0" out="5"/>
</movie>

If you run autocut sample.xml you will get editlist.xml which you can then run through melt to produce a complete video.

The in and out timestamps are in seconds, relative to the given video file. If you don't include one of them, then the missing cutpoints are determined by listening for a human voice.

If you include a flip attribute, the video gets flipped.

If you include an audio tag, then the given audio file will play at the same time as the given video; the script creates the appropriate tractors and transitions to mix the audio in MLT.