Skip to content

Instantly share code, notes, and snippets.

View devnano's full-sized avatar

Mariano devnano

View GitHub Profile
@devnano
devnano / gist:3313ac0ca633d5097c0b26e62b361778
Last active April 8, 2019 18:51
Compose two videos into a single – top/bottom – video with a oneliner ffmpeg command
ffmpeg -i 1.mp4 -i 2.mp4 -filter_complex "nullsrc=size=720x1280 [base]; [0:v] setpts=PTS-STARTPTS, scale=720x640 [top]; [1:v] setpts=PTS-STARTPTS, scale=720x640 [bottom]; [base][top] overlay=shortest=1 [tmp]; [tmp][bottom] overlay=shortest=1:y=640" -c:v libx264 output.mkv
# setpts=0.5*PTS -> https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video
# video to gif https://engineering.giphy.com/how-to-make-gifs-with-ffmpeg/
# loop=1
ffmpeg -i how\ to.mov -filter_complex "[0:v] loop=1,setpts=0.25*PTS,fps=2,scale=480:-1,split [a][b];[a] palettegen [p];[b][p] paletteuse" tutorial.gif
@devnano
devnano / ios_device_video_to_app_preview.sh
Last active November 12, 2019 11:11
Speed up video – 2x – at 30fps, remove audio and leave silence two-channel audio
# AppStore requires an apppreview that doesn't exceed X size, no more than Y fps and MUST have two-channel audio.
# This script assumes a device recorded video with QuickTime as input. It's too slow, give size exceeded error and the audio is background noise
# As output we have: Speed up video – 2x – at 30fps, remove original audio and add silence two-channel audio
# Sources:
# https://stackoverflow.com/a/12375018
# https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video
# https://trac.ffmpeg.org/wiki/ChangingFrameRate
# https://ffmpeg.org/ffmpeg-filters.html#Examples-67
# https://superuser.com/a/1354557
#!/bin/bash
@devnano
devnano / TestAddTodayWidget.swift
Last active February 22, 2023 08:01
iOS Today Widget – Smoke Test: verify that it is added and loaded properly from Today View.
//
// WeeklyCalendarUITests.swift
// WorkRosterAppUITests
//
// Created by Mariano Heredia on 06/05/2020.
import XCTest
class TestAddTodayWidget: XCTestCase {
@devnano
devnano / plot.py
Created July 5, 2020 22:19
AppStore Sessions Ad-Hoc Python Plots
import pygal
import datetime
import statistics
apple_filename = "rosta_–_duty_calendar-sessions-20161001-20200629.csv"
def every_n_dates_criteria(n):
return lambda date, data: len(data) == n