= rtsp * https://github.com/turboladen/rtsp == DESCRIPTION: This library intends to follow the RTSP RFC document (2326) to allow for working with RTSP servers. At this point, it's up to you to parse the data from a play call, but we'll get there. ...eventually. For more information RTSP: http://www.ietf.org/rfc/rfc2326.txt SDP: http://tools.ietf.org/html/rfc4566 == FEATURES/PROBLEMS: * All standard RTSP methods supported except REDIRECT. * Captures RTP data to a file, but doesn't ensure RTP sequencing before putting to file. * One client object can only handle 1 stream; use a client per stream until this functionality gets implemented. * Only handles unicast, UDP streams. * RTSP exceptions are all +RTSP::Error+s; this will change. == SYNOPSIS: === Basic Usage RTSP::Client.log? # => true RTSP::Client.log = false client = RTSP::Client.new "rtsp://64.202.98.91/sa.sdp" do |connection, capturer| connection.timeout = 5 capturer.rtp_port = 8554 capturer.rtp_file = File.open("captured_stuff.rtp", "wb") end client.server_uri # => # client.session_state # => :init client.cseq # => 1 client.connection.do_capture # => true client.connection.interleave # => false client.connection.timeout # => 5 client.capturer.broadcast_type # => :unicast client.capturer.rtp_port # => 8554 client.capturer.rtp_file # => # client.capturer.transport_protocol # => :UDP response = client.options response.class # => RTSP::Response response.code # => 200 response.message # => "OK" client.cseq # => 2 response = client.describe response.body.class # => SDP::Description response.content_type # => "application/sdp" response.server # => "DSS/5.5 (Build/489.7; Platform/Linux; Release/Darwin; )" client.aggregate_control_track # => "rtsp://64.202.98.91:554/sa.sdp/" client.media_control_tracks # => ["rtsp://64.202.98.91:554/sa.sdp/trackID=1"] client.cseq # => 3 response = client.setup(client.media_control_tracks.first) response.session # => 7098486223178290313 client.session # => 7098486223178290313 client.cseq # => 4 client.session_state # => :ready response = client.play(client.aggregate_control_track) response.range # => "npt=now=" resposne.rtp_info # => "url=rtsp://64.202.98.91:554/sa.sdp/trackID=1" client.session_state # => :playing # Wait while the video streams sleep 5 client.pause(client.aggregate_control_track) client.session_state # => :ready # Wait while the video is paused sleep 2 client.teardown(client.aggregate_control_track) client.session # => 0 client.session_state # => :init # Check the streamed file's contents puts client.capturer.rtp_file # => (Lots of data) === CLI App RTSP also provides a +rtsp_client+ executable that allows a little talking to an RTSP server. Knowing which tracks are available on the server can help you determine which tracks to use in your programmatic use of an RTSP::Client object to try to play. Show the available aggregate control track and media control tracks: $ rtsp_client --show-tracks rtsp://64.202.98.91/sa.sdp Or if you want the entire SDP description from the server: $ rtsp_client --describe rtsp://64.202.98.91/sa.sdp And then, of course, pull a stream (this assumes you SETUP the first media track and call play on the aggregate track): $ rtsp_client --stream rtsp://64.202.98.91/sa.sdp As usual, get help by: $ rtsp_client --help == REQUIREMENTS: * (Tested) Rubies * 1.9.2-p180 * RubyGems * sdp, '~> 0.2.2' * RubyGems (development) * bundler, '~> 1.0.0' * code_statistics, '~> 0.2.13' * metric_fu, '>= 2.0.0' * ore, '~> 0.7.2' * ore-core, '~> 0.1.0' * ore-tasks, '~> 0.3.0' * rake, '~> 0.8.7' * rspec, '~> 2.5.0' * simplecov, '>= 0.4.0' * yard, '~> 0.6.0' == INSTALL: * (sudo) gem install rtsp == DEVELOPERS: After checking out the source, run: $ bundle install This task will install any missing dependencies. == LICENSE: (The MIT License) Copyright (c) 2011 Steve Loveless, Mike Kirby See LICENSE.rdoc for details.