Skip to content

Instantly share code, notes, and snippets.

View Bioblaze's full-sized avatar

Bioblaze Payne Bioblaze

View GitHub Profile
@supershadoe
supershadoe / ytmp.sh
Created June 25, 2020 11:46
A script to play a youtube video or its audio alone in mpv.
#!/bin/sh
# vim:sw=4:ts=4:et
################################################################################
# #
# A shell script which searches youtube for a video or audio #
# and plays it in mpv. #
# Created by Supershadoe #
# #
################################################################################
@gargolito
gargolito / vid2gif.sh
Last active June 28, 2020 13:15
video to gif with good quality gif and compression
vid2gif() {
file=$(realpath $1)
name=$(basename ${file/.*})
ffmpeg -y -i "${file}" -vf fps=${3:-24},scale=${2:-480}:-1:flags=lanczos,palettegen "${name}.png"
ffmpeg -y -i "${file}" -i "${name}.png" -filter_complex "fps=${3:-24},scale=${2:-480}:-1:flags=lanczos[x];[x][1:v]paletteuse" "${name}".gif
rm "${name}.png"
}
# (tested on Ubuntu 18.04 Desktop)
# Stream your own desktop to RTMP
ffmpeg -f x11grab -s 1920x1200 -framerate 15 -i :0.0 -c:v libx264 -preset fast -pix_fmt yuv420p -s 1280x800 -threads 0 -f flv "rtmp://127.0.0.1/live/mystreamkey"
# Broadcasting Examples
ffmpeg -f dshow -i video="Virtual-Camera" -preset ultrafast -vcodec libx264 -tune zerolatency -b 900k -f mpegts udp://127.0.0.1:1234
ffmpeg -f dshow -i video="screen-capture-recorder":audio="Stereo Mix (IDT High Definition" \
# example of using xargs to find files and sending files to a shell command with complicated file parsing
ls *mp4 | xargs -I{} sh -c 'base=$(basename $1 .mp4) ; ffmpeg -i "$1" -vcodec copy -an "${base}"_noaudio.mp4' -- {}
@sharapeco
sharapeco / imageaudio2mp4
Created June 20, 2020 14:33
画像と音声からMP4動画を作る
#!/bin/sh
### 画像と音声からMP4動画を作る
# なんでかわからんけどこれで順番に引数が入る
image=$1
shift
audio=$*
# shift
# dai_3_no_hikisuu=$*
@wildrun0
wildrun0 / compile-ffmpeg.sh
Last active May 23, 2024 09:36
Compiling ffmpeg for Raspberry Pi 4 (script only works fine on RPi OS 32bit). x64 does not support mmal (see https://github.com/raspberrypi/userland/issues/688)
#!/bin/bash
# Note that there's no libdrm because this lib cause errors
sudo apt update -y && sudo apt upgrade -y
sudo apt-get -y install \
autoconf \
automake \
build-essential \
@m4nh
m4nh / images_to_video.sh
Last active August 5, 2020 14:35
#ffmpeg #video from #images
# Create from folder
ffmpeg -framerate 1 -pattern_type glob -i '/tmp/ciao/*.png' -c:v libx264 -r 30 -pix_fmt yuv420p /tmp/out.mp4
# Repeat video until CTRL+c (is very dense! )
ffmpeg -stream_loop -1 -i /tmp/out.mp4 -c copy /tmp/out_repeat.mp4
# Convert into MP4 yuv420p
@alexjpaz
alexjpaz / gist:de25c83d69e597e311602ffaa7d16f06
Created June 18, 2020 20:08
ffmpeg with audio with visualization on top of an image with text
#!/bin/bash
ffmpeg \
-y \
-i input.wav \
-i paz.png \
-filter_complex "\
[1:v]scale=-1:480:flags=neighbor,loop=size=2:loop=-1[fg];
[0:a]showcqt=s=1280x720:axis_h=0:sono_h=0:basefreq=27.5:endfreq=1000.0[v];
[fg]drawtext=text='Primitive Rule':fontcolor=white:fontsize=72:font=Bebas Neue:x=(w-text_w)/2:y=(h-text_h)/2[fg];
@carylee
carylee / stitch.sh
Created June 10, 2020 00:29
Generate a virtual quartet video
#!/bin/bash
ffmpeg -y \
-ss 5 -i "elisabeth.mp4" \
-ss 0 -i "ryan.MOV" \
-ss 7.5 -i "cary.mp4" \
-ss 2.9 -i "jackie.MOV" \
-ss 9 -i "tess.MOV" \
-ss 9 -i "Water River Spirit Grace.m4a" \
-filter_complex " \
[0:v] setpts=PTS-STARTPTS, crop=608:720:in_w/2-out_w/2+100:100, scale=912:1080 [v0]; \
@codecreate-dev
codecreate-dev / mp4-cover-image-create.sh
Created June 9, 2020 23:10
Create image covers from mp4 vids in a for loop
for vid in *.mp4; do ffmpeg -i $vid -codec mjpeg -ss 4 -vframes 1 -q:v 1 ./covers/$vid.jpg; done