From b682eb0f9c18ee1eb5fb23218c1869c6cbecb225 Mon Sep 17 00:00:00 2001 From: mattmcw Date: Sun, 9 May 2021 11:45:32 -0400 Subject: [PATCH] Add an ffmpeg-python example --- python/example.py | 26 ++++++++++++++++++++++++++ python/install_ffmpeg_python.sh | 3 +++ 2 files changed, 29 insertions(+) create mode 100644 python/example.py create mode 100644 python/install_ffmpeg_python.sh diff --git a/python/example.py b/python/example.py new file mode 100644 index 0000000..2793ffe --- /dev/null +++ b/python/example.py @@ -0,0 +1,26 @@ +#!/bin/python3 + +import sys +import ffmpeg + +if len(sys.argv) < 3 : + print("Please provide input and output arguments") + exit() + +INPUT = sys.argv[1] +OUTPUT = sys.argv[2] + +# API documentation +# https://kkroening.github.io/ffmpeg-python/ + +# create a stream from your input video +# equivalent of: ffmpeg -i "${INPUT}" +stream = ffmpeg.input(INPUT) + +# shift all hue values by 180 degrees +# equivalent of: -vf "hue=h=180" +stream = ffmpeg.hue(stream, h=180) + +stream = ffmpeg.output(stream, OUTPUT) + +ffmpeg.run(stream) \ No newline at end of file diff --git a/python/install_ffmpeg_python.sh b/python/install_ffmpeg_python.sh new file mode 100644 index 0000000..2c3e65d --- /dev/null +++ b/python/install_ffmpeg_python.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +python3 -m pip install ffmpeg-python \ No newline at end of file