Skip to content

Instantly share code, notes, and snippets.

View babyking's full-sized avatar

Baby King babyking

View GitHub Profile
#!/bin/bash
find . -type f -not -name ".*" -print0 | while read -d $'\0' file; do
echo $file
level=$(ffmpeg -y -nostdin -i $file -af "volumedetect" -vn -sn -dn -f null /dev/null 2>&1 | grep max_volume | sed -n 's/.*max_volume: \([^ ]*\) .*/\1/p')
gain=$(bc -l <<< "-($level)")
echo "${gain}dB"
ffmpeg -y -nostdin -loglevel panic -i $file -af "volume=${gain}dB" temp.mp3
rm $file
mv temp.mp3 $file
done
File formats:
D. = Demuxing supported
.E = Muxing supported
--
E 3g2 3GP2 format
E 3gp 3GP format
D 4xm 4X Technologies format
D IFF IFF format
D ISS Funcom ISS format
D MTV MTV format
@babyking
babyking / command.txt
Created April 24, 2022 08:24 — forked from nrk/command.txt
Using ffprobe to get info from a file in a nice JSON format
ffprobe -v quiet -print_format json -show_format -show_streams "lolwut.mp4" > "lolwut.mp4.json"
@babyking
babyking / WindowPosition.swift
Created June 8, 2022 07:11 — forked from ABridoux/WindowPosition.swift
Logic to easily set a NSWindow's origin horizontally and vertically in a screen (AppKit and SwiftUI)
// Free to use
// Written by Alexis Bridoux - https://github.com/ABridoux
import AppKit
#if canImport(SwiftUI)
import SwiftUI
#endif
// MARK: Model
require 'net/http'
require 'net/https'
require 'uri'
uri = URI('https://example.com/rest/api/2/1')
Net::HTTP.start(uri.host, uri.port,
:use_ssl => uri.scheme == 'https',
:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
@babyking
babyking / thin.yml
Created September 23, 2022 03:01 — forked from Kapenaar/thin.yml
Default config file for thin web server with comments
### SERVER OPTIONS ###
## Bind Address
#address: HOST # Default: 0.0.0.0
## Bind port. If using multiple thin servers,
## they will bind to (PORT + n) where n is the server number
#port: PORT # Default: 3000