Skip to content

Instantly share code, notes, and snippets.

@seliger
seliger / ffmpeg_mosaic_5x.txt
Created March 15, 2019 22:06
Example of using ffmpeg to get multiple inputs streamed into one and delivered to twitch.tv.
# Videos sourced from here: https://gist.github.com/jsturgis/3b19447b304616f18657
ffmpeg \
-stream_loop -1 -i BigBuckBunny.mp4 \
-stream_loop -1 -i ElephantsDream.mp4 \
-stream_loop -1 -i ForBiggerBlazes.mp4 \
-stream_loop -1 -i Sintel.mp4 \
-stream_loop -1 -i TearsOfSteel.mp4 \
-filter_complex '[0:a][1:a][2:a][3:a][4:a]amix=5[a];color=s=1920x1080:c=black [base]; [0:v] setpts=PTS-STARTPTS, scale=960x360,loop=-1 [r1c1];[1:v] setpts=PTS-STARTPTS, scale=960x360,loop=-1 [r1c2];[2:v] setpts=PTS-STARTPTS, scale=960x360,loop=-1 [r2c1];[3:v] setpts=PTS-STARTPTS, scale=960x360,loop=-1 [r2c2];[4:v] setpts=PTS-STARTPTS, scale=960x360,loop=-1 [r3c1];[base][r1c1] overlay=x=0 [tmp1];[tmp1][r1c2] overlay=x=960 [tmp2];[tmp2][r2c1] overlay=y=360 [tmp3];[tmp3][r2c2] overlay=x=960:y=360 [tmp4];[tmp4][r3c1] overlay=y=720' \
-map '[a]' -ac 2 \
@seliger
seliger / todoist_redis_cache.py
Last active December 2, 2017 23:35
Using Redis to cache the Todoist Python API
import todoist
import json
import redis
import sys
def _monkey_read_cache(self):
if not self.redis:
return
try: