Skip to content

Instantly share code, notes, and snippets.

@albert-zhang
albert-zhang / curl.md
Last active February 8, 2017 03:43
curl
@albert-zhang
albert-zhang / adjust-font-size-based-on-screen-size.js
Created December 6, 2016 03:57
adjust font size based on screen size
// http://mp.weixin.qq.com/s?__biz=MzAxODE2MjM1MA==&mid=2651551510&idx=1&sn=ad6f87385c39c90c2501ca94b5f5c8dc
var designWidth = 640, rem2px = 100;
var d = window.document.createElement('div');
d.style.width = '1rem';
d.style.display = "none";
var head = window.document.getElementsByTagName('head')[0];
head.appendChild(d);
var defaultFontSize = parseFloat(window.getComputedStyle(d, null).getPropertyValue('width'));
d.remove();
document.documentElement.style.fontSize = window.innerWidth / designWidth * rem2px / defaultFontSize * 100 + '%';
@albert-zhang
albert-zhang / ffmpeg.md
Last active June 20, 2019 11:15
ffmpeg

Convert to specific resolution:

ffmpeg -i input.mov -vcodec h264 -acodec aac -s 1280x720 output.mp4

ffmpeg -i {input}.mov -vcodec h264 -acodec aac -strict -2 output.mp4

Stream camera to rtmp on Mac:

ffmpeg -f avfoundation -framerate 30 -i "0" -c:v libx264 -an -f flv rtmp://localhost:1935/live/mystream

Stream file to rtmp:

ffmpeg -re -i ~/Desktop/input.mp4 -c copy -f flv rtmp://localhost:1935/live/mystream