roberto dircio palacios-macedo's notepad

solaris/linux/java notes open to all since 2004

 
reset -d 0 xir


I got a TV card, it appears like this in lspci:


01:08.0 Multimedia controller: Philips Semiconductors SAA7131/SAA7133/SAA7135 Video Broadcast Decoder (rev d1)


In order to stream 2 simultaneous streams, one low quality (suitable for remote viewing) and another high quality (for local LAN viewing), you can do this:


cvlc v4l2:// :v4l2-dev=/dev/video0 :v4l2-fps=24 :input-slave=alsa://hw:1,0 --alsa-samplerate=32000 --sout '#duplicate{dst="transcode{vcodec=h264,acodec=mp4a,width=320,height=240,fps=12,vb=128,ab=4,venc=ffmpeg{keyint=80,hurry-up,vt=800000},deinterlace,audio-sync}:standard{access=http,mux=asf,dst=www.yourhost.com:9098}",dst="transcode{vcodec=h264,acodec=mp4a,scale=1,fps=24,venc=ffmpeg{keyint=80,hurry-up,vt=800000},deinterlace,audio-sync}:standard{access=http,mux=asf,dst=www.kyourhost.com:9099}"}'


I use the "hurry-up" parameter so my cpu doesn't saturate, in order for vlc to decrease frame quality automatically if the cpu is pegged.


"#duplicate" is used in order to have 2 streams working simultaneously from the same input device, for each output srteam we use a "dst="



I wanted to watch my movies remotely, so i used h264 for video and aac for audio, and built a vlc config to startup a daemonized RTSP server.I built a script to create the config file by scanning all my videos, and then start the vlc daemon :). Here it is:


#!/bin/ksh
ps -ef | grep -i vlc | grep -v grep |awk '{ print $2 }' |while read p;do
        kill $p
done
(
x=0
find /disk2/VIDEO -type f | egrep -i 'avi|mpg' |while read v;do
#---- if not using x264
# echo "new $x vod enabled"
# echo -n "setup $x input \"file://$v\" output"
#---- if using x264
echo "new $x vod"
echo -n "setup $x input \"file://$v\" enabled output"
#---- low quality
#echo " #transcode{vcodec=mp4v,acodec=mp4a,width=640,height=480,fps=12,vb=128,ab=8}"
echo " #transcode{vcodec=h264,acodec=mp4a,width=640,height=480,vb=100,ab=4}"
#---- mid quality
#echo " #transcode{vcodec=mp4v,acodec=mp4a,scale=.5,fps=10,vb=256,ab=64}"
#echo " #transcode{vcodec=h264,acodec=mp4a,scale=.5,fps=12,vb=256,ab=64}"
#---- high quality
#echo " #transcode{vcodec=mp4v,acodec=mp4a,scale=.5,fps=10,vb=512,ab=64}"
#echo " #transcode{vcodec=h264,acodec=mp4a,scale=.5,fps=12,vb=512,ab=128}"
echo " "
x=$(($x+1))
done
) > /etc/v.config
nohup cvlc --vlm-conf /etc/v.config -I telnet --telnet-password vl --rtsp-host 0.0.0.0:564 &


Try it, and enjoy :)



(Page 1 of 105, totaling 313 entries)   next page »
View as PDF: This month | Full blog