Difference between revisions of "Gstreamer"

From Bashlinux
Jump to: navigation, search
(GStreamer)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
= GStreamer =
 
 
== QVidium MPEG2+4 Codec ==
 
== QVidium MPEG2+4 Codec ==
 
The codec is able to encode video to the network and decode video from the network. In order to broadcast video to the LAN, we are going to setup the Encoder.
 
The codec is able to encode video to the network and decode video from the network. In order to broadcast video to the LAN, we are going to setup the Encoder.

Revision as of 07:47, 28 February 2015

QVidium MPEG2+4 Codec

The codec is able to encode video to the network and decode video from the network. In order to broadcast video to the LAN, we are going to setup the Encoder.

Setup

Initial Setup

  • Setup your NIC to 192.168.1.90 with netmask 255.255.255.0
  • Link your NIC with the device using an crossover cable
  • Go on browser to 192.168.1.100
  • Login with user and password `root`
  • Click on "Network" label on left side menu and then click on configure
  • Set IP Address and DNS Server address to be obtained automatically from DHCP
  • Click on "Apply"

Regular Setup

  • Go on browser to the IP assigned by DHCP to the QVidium device
  • Click on "Encoder" label and the "Profile"
  • Ensure the following values:
    • Video Encoding: MPEG2
    • IP Transport: UDP
    • Destination IP or Multicast Address or Hostname:
      • For Unicast: The destination IP or hostname
      • For Multicast: 224.0.0.0
  • UDP Port: 1234
  • Click save button
  • Click "start" on sub-menu under "Encoder" menu label

VLC

VLC can be used as server and/or client in standalone mode running only one instance or simultaneously running multiple instances.

Streaming Server

The command to start VLC as multicast video server is:

 vlc /path/to/playlist.m3u \
 --sout '#transcode{vcodec=mp2v,vb=3000,scale=1,acodec=mpga,ab=128,channels=2}:duplicate{dst=std{access=udp,mux=ts,dst=224.0.0.0:1234}}' \
 --sout-keep
 

It will start to broadcast all videos on list, the changes made on list will be loaded on restart.

Streaming Client

VLC can be started in 2 ways:

  1. Getting stream as unicast host:
 vlc -vvv udp://@:1234 --fullscreen --volume 1024
 
  1. Getting stream as host on a multicast network:
 vlc -vvv udp://@224.0.0.0 --fullscreen --volume 1024
 


GStreamer

Video streaming is done by setting the right pipeline in both sides, server and client.

Streaming Video Only

Server The command to start gstreamer as unicast video server is (no audio):

 gst-launch filesrc location=/path/to/video.ext ! decodebin ! x264enc ! video/x-h264 ! rtph264pay pt=96 ! udpsink host=ip.remote.host port=5000 sync=true
 

Note that:

  • location is the full path of the video we want broadcast_.
  • host is the ip address or fqdn of the destination host_.

Client

The command to start gstreamer to receive video is (no audio):

 gst-launch udpsrc port=5000 ! rtph264depay ! video/x-h264 ! decodebin ! xvimagesink
 


Streaming Video+Audio

The following commands streams the raw audio and video with the h264 encoder

 gst-launch-0.10 -v gstrtpbin name=rtpbin \
     filesrc location=/home/manuel/movies/matrix.mp4 ! \
         decodebin name=decoder \
             decoder. ! x264enc bitrate=4096 byte-stream=true \
                      ! rtph264pay ! rtpbin.send_rtp_sink_0 \
                        rtpbin.send_rtp_src_0 ! udpsink host=227.0.0.10 port=5000 \
                        rtpbin.send_rtcp_src_0 ! udpsink host=227.0.0.10 port=5010 sync=false async=false\
                        udpsrc multicast-group=227.0.0.10 port=5020 ! rtpbin.recv_rtcp_sink_0 \
             decoder. ! audioconvert ! queue \
                      ! rtpL16pay ! rtpbin.send_rtp_sink_1 \
                        rtpbin.send_rtp_src_1 ! udpsink host=227.0.0.10 port=5001 \
                        rtpbin.send_rtcp_src_1 ! udpsink host=227.0.0.10 port=5011 sync=false async=false
                        udpsrc multicast-group=227.0.0.10 port=5021 ! rtpbin.recv_rtcp_sink_1
 


Client

 gst-launch-0.10 -v gstrtpbin name=rtpbin \
     udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, profile-level-id=(string)4d4033, sprop-parameter-sets=(string)\"Z01AM5JUBgHtgIgAAB9IAAdTBHjBlQ\\=\\=\", payload=(int)96" \
         multicast-group=227.0.0.10 port=5000 ! rtpbin.recv_rtp_sink_0 \
             rtpbin. ! rtph264depay ! ffdec_h264 ! xvimagesink sync=false \
                       udpsrc multicast-group=227.0.0.10 port=5010 ! rtpbin.recv_rtcp_sink_0 \
             rtpbin.send_rtcp_src_0 ! udpsink host=227.0.0.10 port=5020 sync=false async=false \
     udpsrc caps="application/x-rtp, media=(string)audio, clock-rate=(int)44000, encoding-name=(string)L16, encoding-params=(string)2, channels=(int)2, payload=(int)96" \
          multicast-group=227.0.0.10 port=5001 ! rtpbin.recv_rtp_sink_1   \
              rtpbin. ! queue ! rtpL16depay ! audioconvert ! autoaudiosink sync=false \
                        udpsrc multicast-group=227.0.0.10 port=5011 ! rtpbin.recv_rtcp_sink_1 \
              rtpbin.send_rtcp_src_0 ! udpsink host=227.0.0.10 port=5021 sync=false async=false
 


links

Examples