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 APP = { | |
deferredInstall: null, | |
init() { | |
if ('serviceWorker' in navigator) { | |
//register our service worker | |
navigator.serviceWorker | |
.register('/sw.js', { | |
updateViaCache: 'none', | |
scope: '/', | |
}) |
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
# To extract the sound from a video and save it as MP3: | |
ffmpeg -i <video.mp4> -vn <sound>.mp3 | |
# To convert frames from a video or GIF into individual numbered images: | |
ffmpeg -i <video.mpg|video.gif> <frame_%d.png> | |
# To combine numbered images (frame_1.jpg, frame_2.jpg, etc) into a video or GIF: | |
ffmpeg -i <frame_%d.jpg> -f image2 <video.mpg|video.gif> | |
# To quickly extract a single frame from a video at time mm:ss and save it as a 128x128 resolution image: |
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
#!/bin/bash | |
# This script uses ffmpeg to transcode video files into one of a few formats suitable for | |
# editing in either DaVinci Resolve or Lightworks on a Linux machine. It's purpose is to | |
# simplify my life and relieve me from having to look up and enter the same very long | |
# command over and over. | |
# | |
# If run with argument "all", the script will prompt for a directory containing video files, and | |
# transcode all video files in the directory into the selected format. If run with a file as an | |
# argument, it will transcode only that file, and will provide the additional option of |
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
#!/bin/bash | |
# check file for AVC encoding and flv, wmv, or mkv wrapper and rewrap in mp4 container | |
# otherwise, if not already am mp4, transcode to AVC mp4 | |
######## | |
# usage: | |
# z264 <file> | |
# z264 * | |
# z264 *.ext | |
# z264 */* |
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
<?php | |
header('Content-Type: application/json'); | |
function get_uptime() | |
{ | |
$str = @file_get_contents('/proc/uptime'); | |
$num = floatval($str); | |
$secs = (int) fmod($num, 60); $num = intdiv($num, 60); | |
$mins = $num % 60; $num = intdiv($num, 60); |
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
#!/bin/bash | |
INT=2; RXDIR=/sys/class/net/eth0/statistics/rx_bytes; TXDIR=/sys/class/net/eth0/statistics/tx_bytes; RXSTART=$(cat $RXDIR); TXSTART=$(cat $TXDIR); sleep $INT; RXEND=$(cat $RXDIR); TXEND=$(cat $TXDIR); RXBPS="$(((RXEND-RXSTART)/INT))"; TXBPS="$(((TXEND-TXSTART)/INT))"; echo "$RXBPS" "$TXBPS" |
Based on https://evilmartians.com/chronicles/better-web-video-with-av1-codec
ffmpeg -i SOURCE.mov -map_metadata -1 -c:a libfdk_aac -c:v libx264 -crf 24 -preset veryslow -profile:v main -pix_fmt yuv420p -movflags +faststart -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video.h264.mp4
Extract audio from a YouTube video file
ffmpeg -i INPUT.mp4 -ab 256k OUTPUT.mp3
Cut 3s length
ffmpeg -y -ss 00:00:03 -i INPUT.mp4 -codec copy OUTPUT.mp4
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
ffmpeg -i $1 -vn -acodec libvorbis -ab 128k -dash 1 $2/audio.webm | |
ffmpeg -i $1 -c:v libvpx-vp9 -keyint_min 150 \ | |
-g 150 -tile-columns 4 -frame-parallel 1 -f webm -dash 1 \ | |
-an -vf scale=160:190 -b:v 250k -dash 1 $2/video_160x90_250k.webm \ | |
-an -vf scale=320:180 -b:v 500k -dash 1 $2/video_320x180_500k.webm \ | |
-an -vf scale=640:360 -b:v 750k -dash 1 $2/video_640x360_750k.webm \ | |
-an -vf scale=640:360 -b:v 1000k -dash 1 $2/video_640x360_1000k.webm \ | |
-an -vf scale=1280:720 -b:v 1500k -dash 1 $2/video_1280x720_1500k.webm \ | |
-an -vf scale=1920:1080 -b:v 5300k -dash 1 $2/video_1920x1080_5300k.webm |
NewerOlder