Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#! /usr/bin/env bash
# Requirements:
# - `primitive` @,
# - `imagemagick` @,
# - `ffmpeg` @
# Make sure your input photo is named `input.jpg` (variable support later!)
# keep yo folder neat
mkdir profilevideo
# Facebook's Profile Video restricts video length @ max = 7s
# We want to have a 60fps, looping (boomerang style) video.
# 3.5 * 60 = 210 frames for the looped video.
primitive -i input.jpg -o profilevideo/input.gif -n 1050 -vv # n=1050 gives 210 frames
convert profilevideo/input.gif profilevideo/pv_%05d.png
ffmpeg -framerate 60 -i profilevideo/pv_%05d.png -c:v libx264 -r 60 -pix_fmt yuv420p profilevideo/input1.mp4
ffmpeg -i profilevideo/input1.mp4 -vf reverse profilevideo/input2.mp4
ffmpeg -i profilevideo/input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts profilevideo/intermediate1.ts
ffmpeg -i profilevideo/input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts profilevideo/intermediate2.ts
ffmpeg -i "concat:profilevideo/intermediate1.ts|profilevideo/intermediate2.ts" -c copy -bsf:a aac_adtstoasc output.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.