Playing with Video on FOSS
So, you want to play with video inputs/outputs/files without cardboard boxed software? Great!
fix b0rked v4l
You can 'fix' weird pixel formats, programs that dont properly work with your v4l device with these funky preloads;
LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so
_or_
LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l2convert.so
Both have their purpose, but I can't keep them apart, just try each ;)
convert, encode stuff
Just some handy copypastes.
Replace the INPUT and OUTPUT, also some codecs support multiple passes, so, pass=1, pass=2, pass=3 etc ... lame presets are just the default commandline lame presets
mencoder INPUT -o OUTPUT -ovc xvid -xvidencopts bitrate=1200:pass=1:turbo:threads=2 -oac mp3lame -lameopts preset=medium mencoder INPUT -aspect 16:9 -o OUTPUT -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1200:vpass=1:turbo:threads=2 -oac mp3lame -lameopts preset=medium mencoder INPUT -o OUTPUT -ovc lavc -lavcopts vbitrate=1800:vcodec=mjpeg -nosound ffmpeg -i INPUT(.avi) -vcodec copy OUTPUT(.mov) mencoder INPUT -o OUTPUT -ovc lavc -lavcopts vbitrate=1800:vcodec=mjpeg -nosound -vf scale=640:480,pp7 -fps 25
ultratux cvlc http stream
21:33:16 <@ultratux> cvlc v4l2:///dev/video0 :v4l2-standard= :i:live-caching=300 :sout="#transcode{vcodec=WMV2,vb=2800,scale=1,acodec=wma2,ab=128,channels=2,samplerate=100}:http{dst=:5757/delta.wmv}"
omg! stream video to icecast :D
cvlc -vvv v4l2:///dev/video0:width=640:height=480:fps=20 :i:live-caching=300 :sout="#transcode{vcodec=theo,vb=500,scale=1,acodec=vorb,ab=64}:std{access=shout,mux=ogg,dst=user:pass@HOSTNAME:8000/mountpoint.ogg}"
stream to youtube
ffmpeg -re -i /dev/video0 -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -acodec aac -ab 128k -strict experimental -vcodec nvenc_h264 -pix_fmt yuv420p -g 10 -vb 700k -framerate 5 -f flv rtmp://x.rtmp.youtube.com/live2/YOURYOUTUBESTREAMKEY