Skip to content

Instantly share code, notes, and snippets.

View lyarinet's full-sized avatar

Asif Agaria lyarinet

View GitHub Profile
@prof3ssorSt3v3
prof3ssorSt3v3 / app.js
Created March 26, 2021 22:02
PWA 6 - Handling Install Events
const APP = {
deferredInstall: null,
init() {
if ('serviceWorker' in navigator) {
//register our service worker
navigator.serviceWorker
.register('/sw.js', {
updateViaCache: 'none',
scope: '/',
})
@Rafat97
Rafat97 / A.md
Last active January 20, 2021 16:17
📼 FFMPEG Some Command 📼

📼 FFMPEG Command 📼

@rowe-morehouse
rowe-morehouse / ffmpeg-commands.sh
Last active August 26, 2022 07:40
ffmpeg commands.
# 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:
@jmatthewturner
jmatthewturner / transcode.sh
Last active April 5, 2023 00:03
Bash Script for using FFMPEG to Transcode Video for DaVinci Resolve or Lightworks
#!/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
#!/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 */*
@lakuapik
lakuapik / stats.php
Created August 31, 2019 05:08
Get uptime, memory usage, cpu usage and disk usage on GNU/Linux server using PHP
<?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);
@stoyanovgeorge
stoyanovgeorge / avg_speed.sh
Last active January 4, 2022 06:48
An one line command to get the average RX and TX speed of a particular interface (eth0) over $INT seconds in bytes per second. You need to divide by 128 to get it in Kbps or by 131072 (128*1024) for Mbps.
#!/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"
@tingplenting
tingplenting / ffmpeg_tuts.md
Last active April 18, 2024 17:31
ffmpeg cli for youtube

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
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