Skip to content

Instantly share code, notes, and snippets.

View rriemann's full-sized avatar

Robert Riemann rriemann

View GitHub Profile
@rriemann
rriemann / gist:1385642
Created November 22, 2011 13:16
Convert all audio/video files recursively to another format
# inspired by: http://yogsototh.wordpress.com/2007/10/24/bash-script-loop/
# this probably only works within the zsh. So you might enter it first by execute 'zsh'
# also works with whitespaces in filenames
for file in ./**/*.wma; do
ffmpeg -i $file -f ogg -acodec libvorbis -ab 128k ${file%.*}.ogg
mkdir -p ./old_wma/${file%/*}
mv $file ./old_wma/${file}
@rriemann
rriemann / pastie.rb
Created November 22, 2011 14:38
Paste script to paste to pastie.org from command line. Written in ruby
#!/usr/bin/env ruby
# kate: remove-trailing-space on; replace-trailing-space-save on; indent-width 2; indent-mode ruby; syntax ruby;
require 'net/http'
require 'optparse'
require 'timeout'
require 'cgi'
require 'uri'
class Hash
@rriemann
rriemann / ur1.rb
Created November 22, 2011 14:41
Make usage ur1.ca url shortener within KDE Klipper or from command line
#!/usr/bin/env ruby
# kate: remove-trailing-space on; replace-trailing-space-save on; indent-width 2; indent-mode ruby; syntax ruby;
# ur1.rb
require 'net/http'
require 'cgi'
require 'uri'
URL = URI.parse "http://ur1.ca/"
raise if ARGV.size == 0
@rriemann
rriemann / gist:1406035
Created November 29, 2011 19:17
Use pv and dd to copy an iso-file to an usb stick while showing the progress
dd if=openSUSE-12.1-DVD-x86_64.iso | pv --eta --size 4628414464 --progress --bytes --rate --wait > /dev/sdc
@rriemann
rriemann / gist:1423109
Created December 2, 2011 12:43
Encode Videos for Samsung Galaxy S I9000 with Google Android 2.2 (Froyo) using ffmpeg
ffmpeg -i input.mp4 -y -vcodec libx264 -s 800x480 -acodec aac -strict experimental -ab 96k -ac 2 -b 500K -threads 4 -flags +loop -cmp +chroma -partitions 0 -me_method epzs -subq 1 -trellis 0 -refs 1 -coder 0 -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -maxrate 10M -bufsize 10M -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 output.mp4
# input may be everything supported by ffmpeg (*.flv, *.webm, *.mkv, ...)
# "-b 500k" controls bitrate. Lower/Raise to change the video quality
@rriemann
rriemann / Encode Videos for Nokia n9 using ffmpeg
Last active September 28, 2015 10:18
- Encode Videos for Nokia N900/N9 or Android (Huawei) using ffmpeg - other tricks for ffmpeg
ffmpeg -threads 4 -i input.avi -vcodec libx264 -s 854x480 -vprofile baseline -level 3.1 -acodec copy -f mp4 -t 120 output.mp4
ffmpeg -threads 4 -i input.avi -vcodec libx264 -vprofile baseline -level 3.1 -vf crop=562:248:8:36 -acodec copy -f mp4 -t 120 output.mp4
ffmpeg -threads 4 -i input.avi -vcodec libx264 -vprofile baseline -level 3.1 -vf crop=716:552:2:12:1,scale=854:480 -acodec copy -f mp4 output.mp4
# http://www.developer.nokia.com/Community/Wiki/Recommended_video_encoding_settings
# http://opensource-htpc.blogspot.de/2011/04/remove-black-borders-and-bars-from.html
@rriemann
rriemann / gist:1427509
Created December 3, 2011 16:31
Working with MIDI and ALSA
Usefull tools:
rosegarden
qsynth (fluidsynth)
aconnect (-l -o, -l -i)
aseqdump
@rriemann
rriemann / gist:1435327
Created December 5, 2011 21:01
kdegettext working using ruby 1.8.7
*** LOCAL GEMS ***
gettext (2.1.0)
Author: Masao Mutoh
Rubyforge: http://rubyforge.org/projects/gettext
Homepage: http://gettext.rubyforge.org/
Installed at: /usr/lib64/ruby/gems/1.8
Ruby-GetText-Package is a libary and tools to localize messages.
NOTE: Gem.all_load_paths is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem.all_load_paths called from /home/rriemann/.rvm/gems/ruby-1.9.2-p290/gems/gettext-2.1.0/lib/gettext/runtime/locale_path.rb:56.
NOTE: Gem.all_partials is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem.all_partials called from /home/rriemann/.rvm/rubies/ruby-1.9.2-p290/lib64/ruby/site_ruby/1.9.1/rubygems.rb:258.
/home/rriemann/.rvm/rubies/ruby-1.9.2-p290/lib64/ruby/site_ruby/1.9.1/rubygems.rb:259:in `block (2 levels) in all_load_paths': undefined method `add' for "/home/rriemann/.rvm/gems/ruby-1.9.2-p290":String (NoMethodError)
from /home/rriemann/.rvm/rubies/ruby-1.9.2-p290/lib64/ruby/site_ruby/1.9.1/rubygems.rb:427:in `block (2 levels) in each_load_path'
from /home/rriemann/.rvm/rubies/ruby-1.9.2-p290/lib64/ruby/site_ruby/1.9.1/rubygems.rb:426:in `each'
from /home/rriemann/.rvm/rubies/ruby-1.9.2-p290/lib64/ruby/site_ruby/1.9.1/rubygems.rb:426:in `blo
@rriemann
rriemann / cmd.sh
Created December 21, 2011 13:26
get pulseaudio work with two servers
# make server locallay available
pacmd load-module module-tunnel-sink server=pluto.local
# combine both local servers two one single sink
pacmd load-module module-combine-sink sink_name=combined slaves=tunnel-sink.pluto.local,alsa_output.pci-0000_00_1b.0.analog-stereo
# usefull cmd:
pacmd list-sinks
pacmd set-default-sink 3