Streaming webm + icecast

De MochilaWiki
Ir para navegaçãoIr para pesquisar

Para saber se o seu gstreamer tem suporte a webm para transmissão para icecast use o comando gst-inspect-0.10 shout2send ou gst-inspect-1.0 shout2send e terá algo parecido com isso

Pad Templates:
  SINK template: 'sink'
    Availability: Always
    Capabilities:
      application/ogg
      audio/mpeg
            mpegversion: 1
                  layer: [ 1, 3 ]
      video/webm

se tiver video/webm, beleza, senão é necessário compilar a versão mais recente do libshout e recompilar o gstreamer0.10-plugins-good, abaixo as instruções


instalando libshout 2.3.1 e recompilando gstreamer0.10-plugins-good

em debian 7 - compilando

apt-get install fakeroot dh-buildinfo
cd /usr/src
wget http://downloads.xiph.org/releases/libshout/libshout-2.3.1.tar.gz
tar zxvf libshout-2.3.1.tar.gz 
cd libshout-2.3.1
apt-get build-dep libshout3
dpkg-buildpackage -rfakeroot -b
cd ..
dpkg -i libshout*.deb
apt-get source gstreamer0.10-plugins-good
apt-get build-dep gstreamer0.10-plugins-good
dpkg-source -x gst-plugins-good0.10_0.10.31-3+nmu1.dsc
cd gst-plugins-good0.10-0.10.31/
dpkg-buildpackage -rfakeroot -b
cd ..
dpkg -i gstreamer0.10-plugins-good*.deb

em ubuntu 12.04 - compilando

apt-get install build-essential fakeroot dpkg-dev dh-buildinfo
cd /usr/src
wget http://downloads.xiph.org/releases/libshout/libshout-2.3.1.tar.gz
tar zxvf libshout-2.3.1.tar.gz 
cd libshout-2.3.1
apt-get build-dep libshout3
dpkg-buildpackage -rfakeroot -b
cd ..
dpkg -i libshout*.deb
apt-get source gstreamer0.10-plugins-good
apt-get build-dep gstreamer0.10-plugins-good
dpkg-source -x gst-plugins-good0.10_0.10.31-1ubuntu1.2.dsc
cd gst-plugins-good0.10-0.10.31/
dpkg-buildpackage -rfakeroot -b
cd ..
dpkg -i gstreamer0.10-plugins-good*.deb

em Fedora 20 - compilando

yumdownloader --source libshout
sudo yum-builddep libshout-2.2.2-10.fc20.src.rpm --nogpgcheck
rpm -ivh libshout-2.2.2-10.fc20.src.rpm
sed -i '42d' ~/rpmbuild/SPECS/libshout.spec
sed -i '10d' ~/rpmbuild/SPECS/libshout.spec
sed -i 's/2.2.2/2.3.1/g' ~/rpmbuild/SPECS/libshout.spec
wget http://downloads.us.xiph.org/releases/libshout/libshout-2.3.1.tar.gz
mv libshout-2.3.1.tar.gz ~/rpmbuild/SOURCES/
cd ~/rpmbuild/SPECS
rpmbuild -ba libshout.spec
cd ~/rpmbuild/RPMS/x86_64/
sudo rpm -Uvh libshout-*
yumdownloader --source gstreamer-plugins-good
sudo yum-builddep gstreamer-plugins-good-0.10.31-10.fc20.src.rpm --nogpgcheck
rpmbuild --rebuild gstreamer-plugins-good-0.10.31-10.fc20.src.rpm
cd ~/rpmbuild/RPMS/x86_64/
sudo rpm -Uvh gstreamer-plugins-good-0.10.31-10.fc20.x86_64.rpm --force
yumdownloader --source gstreamer-plugins-bad
sudo yum-builddep gstreamer-plugins-bad-0.10.23-5.fc20.src.rpm --nogpgcheck
rpmbuild --rebuild gstreamer-plugins-bad-0.10.23-5.fc20.src.rpm
cd ~/rpmbuild/RPMS/x86_64/
sudo rpm -Uvh gstreamer-plugins-bad-0.10.23-5.fc20.x86_64.rpm --force
  • página do projeto

http://www.webmproject.org/tools/

código fonte

echo deb http://ftp.br.debian.org/debian wheezy main contrib non-free > /etc/apt/sources.list
echo deb-src http://ftp.br.debian.org/debian wheezy main contrib non-free >> /etc/apt/sources.list
apt-get update
apt-get upgrade
apt-get build-dep gstreamer0.10-plugins-good
apt-get build-dep gstreamer0.10-plugins-base
apt-get install bison flex libvpx-dev libmatroska-dev libebml-dev
cd /usr/src
wget http://downloads.us.xiph.org/releases/libshout/libshout-2.3.1.tar.gz
wget -c http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-1.0.5.tar.xz
wget -c http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-1.0.5.tar.xz
wget -c http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-1.0.5.tar.xz
tar zxvf libshout-2.3.1.tar.gz 
cd libshout-2.3.1/
./configure --prefix=/usr && make && make install
cd ..
tar xvf gstreamer-1.0.5.tar.xz
cd gstreamer-1.0.5
./configure --prefix=/usr && make && make install
cd ..
tar xvf gst-plugins-base-1.0.5.tar.xz
cd gst-plugins-base-1.0.5
./configure --prefix=/usr && make && make install
cd ..
tar xvf gst-plugins-good-1.0.5.tar.xz
cd gst-plugins-good-1.0.5
./configure --prefix=/usr && make && make install

em Debian 7 - com pacotes

apt-get install gstreamer0.10-tools gstreamer-tools
wget -c http://pub.nkosi.org/floema/debian-7/libshout3_2.0-7_amd64.deb
wget -c http://pub.nkosi.org/floema/debian-7/gstreamer0.10-plugins-good_0.10.31-3%2bnmu1_amd64.deb
dpkg -i *.deb
apt-get -f install
dpkg -i *.deb


transmitindo

metódo 1

gst-launch-0.10 -v -e v4l2src norm="NTSC" device=/dev/video0 ! queue ! \
videorate force-fps=15 ! videoscale ! video/x-raw-yuv, width=360, height=240 ! queue ! \
vp8enc mode=1 bitrate=120000 speed=2 ! queue ! webmmux streamable=true name=mux \
alsasrc  device=default ! queue ! audio/x-raw-int,channels=2,rate=48000,depth=16 ! \
audioconvert ! queue ! vorbisenc bitrate=48000 ! mux. mux. ! queue !  \
shout2send ip="servericecast" port="8000" password="hackme" mount="/tv.webm" \
public="true" streamname=" " description=" " genre=" " url=" "

metódo 2

gst-launch-1.0 v4l2src device=/dev/video0 ! vp8enc ! queue ! webmmux streamable=true \
name=muxout ! shout2send ip=icecast.server port=8000 password=secret mount=/test.webm

metódo 3

gst-launch-1.0 v4l2src ! video/x-raw,width=320,height=240 ! vp8enc ! webmmux !  shout2send \
ip=icecast.server port=8000 password=secret mount=/test.webm

metódo 4

gst-launch-1.0 v4l2src ! queue ! video/x-raw,width=320,height=240 ! tee name=tscreen ! queue ! \
autovideosink tscreen. ! queue ! videorate ! video/x-raw,framerate=25/2 ! queue ! vp8enc ! queue ! \
webmmux name=mux pulsesrc ! queue ! audioconvert ! vorbisenc ! queue ! queue ! mux. mux. ! queue ! \
shout2send ip=hobo port=8000 mount=jamie.webm password=secret

Referencias