Skip to content

Instantly share code, notes, and snippets.

@T4cC0re
Last active December 6, 2015 21:54
Show Gist options
  • Save T4cC0re/ed6d6216ad0293e39c43 to your computer and use it in GitHub Desktop.
Save T4cC0re/ed6d6216ad0293e39c43 to your computer and use it in GitHub Desktop.
X-Mas PiTree scripts
#!/bin/bash
# Get middle of video and crop it to 9/16
ffmpeg -i "$1" -threads 0 -c:v libx264 -c:a copy -c:s copy -s:t copy -map 0 -vf "scale=iw*sar:ih, crop=min(iw\,ih*(9/16)):ow/(9/16)" -aspect 9:16 -map_metadata 0 -preset ultrafast -crf 19 "tmp.mp4"
# rotate by 90 degrees counter colckwhise
ffmpeg -i "tmp.mp4" -vf "transpose=2" "tmp2.mp4"
# scale to 1080
ffmpeg -i "tmp2.mp4" -vcodec libx264 -profile:v high -preset fast -crf 18 -b-pyramid none -acodec ac3 -ab 1536k -scodec copy -vf "scale=1920:1080" "$1_final_1080.mp4"
# rm tempfiles
rm tmp.mp4 tmp2.mp4
# you should add this to zour crontab to start upon boot:
omxplayer -r -o hdmi --loop some.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment