/process-home-videos

Helper scripts for processing home videos and uploading them to MediaGoblin

Primary LanguagePython

process-home-videos

CircleCI

Overview

Python scripts for chopping up raw video files into clips and then publishing those clips to MediaGoblin.

Requirements

  • Python 3.7
  • Docker
  • ffmpeg
  • virtualenv

Installation

To run this project in a virtualenv, run the following

mkdir -p ./venv
virtualenv --python python3 ./venv
. venv/bin/activate
pip install --requirement requirements.txt

csv_to_yaml

The csv_to_yaml.py script takes a CSV spreadsheet and converts it to a YAML file.

It exists because it's easier for the user to enter raw information into a spreadsheet, but it's easier for the applications to process rich data from a YAML that includes some postprocessing on the raw data.

Example

app/csv_to_yaml.py \
  --config config.yaml \
  ~/metadata/scene-metadata.csv \
  > ~/metadata/scenes.yaml

render_scenes

Given raw video files, renders scenes by chopping out clips according to a scenes metadata file.

Example

app/render_scenes.py \
  --metadata ~/metadata/scenes.yaml \
  --raw_videos_dir /mnt/videos-raw \
  --output_clips_dir /mnt/videos-processed/

publish_to_mediagoblin

The publish_to_mediagoblin script uploads scenes to a MediaGoblin instance running in the specified Docker container.

  • --publish_history is a flat text file of files that have previously been uploaded to this container (in case the publish process is interrupted and resumed)
  • --conatiner_name is the name of the target Docker container running MediaGoblin.

Example

app/publish_to_mediagoblin.py \
  /mnt/videos-processed   \
  --metadata ~/metadata/scenes.yaml \
  --publish_history ~/metadata/publish-history.txt \
  --container_name mediagoblin

Contributing

A lot of this code is very quick 'n dirty, as I never intended it to be a long-term project. If you'd like to iterate on it, I'm happy to accept contributions, but I apologize for the quality of the code.

To install with dev tools:

mkdir -p ./venv
virtualenv --python python3 ./venv
. venv/bin/activate
pip install --requirement requirements.txt
pip install --requirement dev_requirements.txt
hooks/enable_hooks

To run quick tests:

./build

To run end-to-end tests:

./e2e/run-all-e2e-tests