This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// first: `npm init -- yes && npm i chalk puppeteer-core` | |
// then: `node . --help` | |
const puppeteer = require('puppeteer-core'); | |
const chalk = require('chalk'); | |
// --- | |
const ifHasParam = (s = '') => process.argv.includes(s); | |
const paramValueOf = (s = '') => (process.argv.find(x => x.startsWith(`${s}=`)) || '').split('=')[1]; | |
const DEFAULT_VIDEO_ID = '5qap5aO4i9A'; // ChillCow; his other channel is "DWcJFNfaw9c" | |
const DEBUG = ifHasParam('--debug'); | |
const SHOW_HEAD = ifHasParam('--head'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require('puppeteer'); | |
const uuid = require('uuid'); | |
const sleep = ms => new Promise(r => setTimeout(r, ms)); | |
(async () => { | |
const browser = await puppeteer.launch({ headless: false }); | |
const page = await browser.newPage(); | |
const id = uuid.v4(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Interpolate video frames for a higher frame rate | |
ffmpeg -i source.mp4 -filter:v minterpolate -r 25 result.mp4 | |
ffmpeg -i source.mp4 -vf minterpolate=50,tblend=all_mode=average,framestep=2 result.mp4 | |
# Crop a video to the bottom right quarter | |
ffmpeg -i in.mp4 -filter:v "crop=in_w/2:in_h/2:in_w/2:in_h/2" -c:a copy out.mp4 | |
# Resize a video to half size | |
ffmpeg -i input.mkv -filter_complex "scale=in_w/2:in_h/2" output.mkv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require('puppeteer') | |
const screenshot = 'youtube_fm_dreams_video.png' | |
try { | |
const browser = await puppeteer.launch() | |
const page = await browser.newPage() | |
await page.goto('https://youtube.com') | |
await page.type('#search', 'Fleetwood Mac Dreams') | |
await page.click('button#search-icon-legacy') | |
await page.waitForSelector('ytd-thumbnail.ytd-video-renderer') |