Skip to content

Instantly share code, notes, and snippets.

View fernyb's full-sized avatar

Fernando Barajas fernyb

View GitHub Profile
@fernyb
fernyb / vlc_stream.sh
Created May 6, 2012 00:09
vlc streaming
# Stream to UDP 127.0.0.1, Port 2222
vlc qtcapture:// -vvv input_stream --sout='#duplicate{dst=display, dst="transcode{venc=x264{keyint=60,idrint=2},vcodec=h264,vb=300,acodec=mp4a,ab=32,channels=2, samplerate=22050}:standard{access=udp,mux=ts,dst=127.0.0.1:2222}"}'
# Stream to local file:
vlc --ttl 12 qtcapture:// -vvv input_stream --sout="#transcode{venc=x264{keyint=60,idrint=2},vcodec=h264,vb=300,acodec=mp4a,ab=32,channels=2, samplerate=22050}:\
duplicate{dst=file{mux=ts,dst=/Users/fernyb/live/vlclive.ts},dst=display}"
# Stream to local and pipe to media stream segmenter, which creates index file and can be streamed to iOS
vlc --ttl 12 qtcapture:// -vvv input_stream --sout="#transcode{venc=x264{keyint=60,idrint=2},vcodec=h264,vb=300,acodec=mp4a,ab=32,channels=2, samplerate=22050}:\
duplicate{dst=file{mux=ts,dst='-'},dst=display}" | mediastreamsegmenter -s 10 -D -f /Users/fernyb/hls/live
@fernyb
fernyb / project_template.rb
Last active October 2, 2015 23:28
Rails Template
gem 'haml-rails'
gem 'dynamic_form'
gem 'rspec-rails', :group => [:development, :test]
gem 'machinist', :group => [:development, :test]
generate 'rspec:install'
generate 'db:migrate'
generate 'machinist:install'
remove_file 'public/index.html'
@fernyb
fernyb / gist:1549025
Created January 2, 2012 02:21
transcode
ffmpeg -i input.flv -acodec copy -vcodec copy -copyts output.mp4
Download and extract the latest RTMPDump source tarball, open a Terminal window and cd to the directory you just extracted the sources, i.e. ./rtmpdump-2.3
We need to make a small change in the Makefile in the ./librtmp directory, so you need to cd into that directory
Edit Makefile in ./librtmp and replace -soname with -dylib_install_name
cd ..
sudo make install SYS=posix
@fernyb
fernyb / gist:1468509
Created December 12, 2011 18:40
ssh mysql tunnel
ssh -L 3307:domain.name.of.mysqlserver:3306 [email protected]
@fernyb
fernyb / gist:1242863
Created September 26, 2011 17:55
Tar gzip a directory
tar -zcvf filename.tar.gz ./directory_name
@fernyb
fernyb / gist:1241631
Created September 26, 2011 04:50
ffmpeg commands
ffmpeg -i SCENIC_DRIVE.m4v -qscale 5 -s 480x360 -r 15 -ar 22050 scenic_drive2.flv
@fernyb
fernyb / Gemfile
Created September 14, 2011 04:19
Adding rails_mail_preview gem
group :development do
gem "rails_mail_preview", "0.0.2"
end
@fernyb
fernyb / friendly_id_ext.rb
Created August 29, 2011 23:23
extend friendly_id to have more than 1 friendly_id for each model
module FriendlyId
module ActiveRecordAdapter
def has_another_friendly_id method, options={}
if FriendlyId::on_ar3?
class_attribute :friendly_ids if !self.respond_to?(:friendly_ids)
self.friendly_ids ||= []
config = Configuration.new(self, method, options)
self.friendly_ids << config
end
@fernyb
fernyb / port-format.sh
Last active September 25, 2015 18:18
Port forward request from port 3000 to port 80
# View rules
sudo ipfw show
# Add rule
sudo ipfw add 100 fwd 127.0.0.1,3000 tcp from any to me dst-port 80
# Remove rules
sudo ipfw flush