Thanks to www.bensound.com for the great generic music. Couldn't have done this without you Benjamin.
- Clone this repository
git clone https://github.com/ksteensig/confettispaghetti
- Install pip3, ImageMagick and FFmpeg
sudo apt-get install python3-pip imagemagick ffmpeg
- Install following Python3 packages
sudo pip3 install praw imgurpython gTTS moviepy
- Make a change to the file
/etc/ImageMagick-6/policy.xml
from this
<policymap>
<policy domain="cache" name="shared-secret" value="passphrase"/>
<policy domain="coder" rights="none" pattern="EPHEMERAL" />
<policy domain="coder" rights="none" pattern="URL" />
<policy domain="coder" rights="none" pattern="HTTPS" />
<policy domain="coder" rights="none" pattern="MVG" />
<policy domain="coder" rights="none" pattern="MSL" />
<policy domain="coder" rights="none" pattern="TEXT" />
<policy domain="coder" rights="none" pattern="SHOW" />
<policy domain="coder" rights="none" pattern="WIN" />
<policy domain="coder" rights="none" pattern="PLT" />
<policy domain="path" rights="none" pattern="@*" />
</policymap>
To this
<policymap>
<policy domain="cache" name="shared-secret" value="passphrase"/>
<policy domain="coder" rights="none" pattern="EPHEMERAL" />
<policy domain="coder" rights="none" pattern="URL" />
<policy domain="coder" rights="none" pattern="HTTPS" />
<policy domain="coder" rights="none" pattern="MVG" />
<policy domain="coder" rights="none" pattern="MSL" />
<policy domain="coder" rights="none" pattern="TEXT" />
<policy domain="coder" rights="none" pattern="SHOW" />
<policy domain="coder" rights="none" pattern="WIN" />
<policy domain="coder" rights="none" pattern="PLT" />
<!--policy domain="path" rights="none" pattern="@*" /-->
</policymap>
- Now copy
keys.py.template
tokeys.py
cp keys.py.template keys.py
-
Insert your reddit and imgur developer API credentials in the
keys.py
-
Run the program and enter the name of a subreddit which contains videos hosted by reddit or imgur
python3 main.py
- Be patient and wait for the video to finish, the video will be named output.mp4 and put into a folder named
$(subreddit)/$(timestamp)
In convert.py
there is a function called convert
. This function has two parameters for adjusting time limits, tduration
is the maximum overall video length and mduration
is the minimum length of the individual clips.
You shouldn't change the defaults in convert
itself, but you can set the parameters from where it's called in main.py
. This should ideally be set in a config file which might be added at some point.