樹莓派 3A+ 好好玩︰樂直播 《二》

現今風行的『手機直播』,或可說是移動式『網路攝影機』耶?

Webcam

Typical low-cost webcam used with many personal computers

A webcam is a video camera that feeds or streams its image in real time to or through a computer to a computer network. When “captured” by the computer, the video stream may be saved, viewed or sent on to other networks travelling through systems such as the internet, and e-mailed as an attachment. When sent to a remote location, the video stream may be saved, viewed or on sent there. Unlike an IP camera (which connects using Ethernet orWi-Fi), a webcam is generally connected by a USB cable, or similar cable, or built into computer hardware, such as laptops.

The term “webcam” (a clipped compound) may also be used in its original sense of a video camera connected to the Web continuously for an indefinite time, rather than for a particular session, generally supplying a view for anyone who visits its web page over the Internet. Some of them, for example, those used as online traffic cameras, are expensive, rugged professional video cameras.

 

隨著科技快速發展之腳步, RTSP 

Network Working Group H. Schulzrinne
Request for Comments: 2326 Columbia U.
Category: Standards Track A. Rao
Netscape
R. Lanphier
RealNetworks
April 1998

Real Time Streaming Protocol (RTSP)

Status of this Memo

This document specifies an Internet standards track protocol for the
Internet community, and requests discussion and suggestions for
improvements. Please refer to the current edition of the “Internet
Official Protocol Standards” (STD 1) for the standardization state
and status of this protocol. Distribution of this memo is unlimited.

Copyright Notice

Copyright (C) The Internet Society (1998). All Rights Reserved.

Abstract

The Real Time Streaming Protocol, or RTSP, is an application-level
protocol for control over the delivery of data with real-time
properties. RTSP provides an extensible framework to enable
controlled, on-demand delivery of real-time data, such as audio and
video. Sources of data can include both live data feeds and stored
clips. This protocol is intended to control multiple data delivery
sessions, provide a means for choosing delivery channels such as UDP,
multicast UDP and TCP, and provide a means for choosing delivery
mechanisms based upon RTP (RFC 1889).

 

V4L2 Full HD h264 串流,已然在樹莓派上實現也☆

/v4l2rtspserver

Setup on Pi

 wicadmin edited this page Sep 8, 2018 · 1 revision
setup
======
Ref: http://c.wensheng.org/2017/05/18/stream-from-raspberrypi/

sudo apt-get install cmake liblog4cpp5-dev libv4l-dev
wget www.live555.com/liveMedia/public/live555-latest.tar.gz
tar xfz live555-latest.tar.gz
cd live/
./genMakefiles linux
make CPPFLAGS=-DALLOW_RTSP_SERVER_PORT_REUSE=1
sudo make install

cd
git clone https://github.com/mpromonet/v4l2rtspserver.git
cd v4l2rtspserver/
cmake .
make
sudo make install

 

Usage:
=======
v4l2rtspserver -F15 -H 972 -W1296 -P 8555 /dev/video0

※ 註︰

此處直接引用 v4l2rtspserver 作者 Michel Promonet 先生文本。

且看

pi@raspberrypi:~ v4l2rtspserver -h v4l2rtspserver [-v[v]] [-Q queueSize] [-O file] 	          [-I interface] [-P RTSP port] [-p RTSP/HTTP port] [-m multicast url] [-u unicast url] [-M multicast addr] [-c] [-t timeout] [-T] [-S[duration]] 	          [-r] [-w] [-s] [-f[format] [-W width] [-H height] [-F fps] [device] [device] 	 -v               : verbose 	 -vv              : very verbose 	 -Q <length>      : Number of frame queue  (default 10) 	 -O <output>      : Copy captured frame to a file or a V4L2 device 	 RTSP/RTP options 	 -I <addr>        : RTSP interface (default autodetect) 	 -P <port>        : RTSP port (default 8554) 	 -p <port>        : RTSP over HTTP port (default 0) 	 -U <user>:<pass> : RTSP user and password 	 -R <realm>       : use md5 password 'md5(<username>:<realm>:<password>') 	 -u <url>         : unicast url (default unicast) 	 -m <url>         : multicast url (default multicast) 	 -M <addr>        : multicast group:port (default is random_address:20000) 	 -c               : don't repeat config (default repeat config before IDR frame) 	 -t <timeout>     : RTCP expiration timeout in seconds (default 65) 	 -T               : send Transport Stream instead of elementary Stream 	 -S[<duration>]   : enable HLS & MPEG-DASH with segment duration  in seconds (default 5) 	 V4L2 options 	 -r               : V4L2 capture using read interface (default use memory mapped buffers) 	 -w               : V4L2 capture using write interface (default use memory mapped buffers) 	 -s               : V4L2 capture using live555 mainloop (default use a reader thread) 	 -f               : V4L2 capture using current capture format (-W,-H,-F are ignored) 	 -f<format>       : V4L2 capture using format (-W,-H,-F are used) 	 -W <width>       : V4L2 capture width (default 0) 	 -H <height>      : V4L2 capture height (default 0) 	 -F <fps>         : V4L2 capture framerate (default 25) 	 -G <w>x<h>[x<f>] : V4L2 capture format (default 0x0x25) 	 Devices : 	 [V4L2 device][,ALSA device] : V4L2 capture device or/and ALSA capture device (default /dev/video0,/dev/video0) </pre>    <span style="color: #666699;">實境秀呦!</span> <pre class="lang:default decode:true ">pi@raspberrypi:~ sudo modprobe bcm2835-v4l2
pi@raspberrypi:~ $ v4l2rtspserver -F30 -H 1080 -W 1920 -P 8555 /dev/video0
2018-12-08 15:45:46,873 [NOTICE] - /home/pi/v4l2rtspserver/src/main.cpp:623
	Create V4L2 Source.../dev/video0

[NOTICE] src/V4l2Device.cpp:117
	driver:bm2835 mmal capabilities:85200005 mandatory:4000001
[NOTICE] src/V4l2Device.cpp:120
	/dev/video0 support capture
[NOTICE] src/V4l2Device.cpp:122
	/dev/video0 support read/write
[NOTICE] src/V4l2Device.cpp:123
	/dev/video0 support streaming
[NOTICE] src/V4l2Device.cpp:147
	/dev/video0:JPEG size:1024x768
[NOTICE] src/V4l2Device.cpp:208
	/dev/video0:H264 size:1920x1080 bufferSize:2088960
[NOTICE] src/V4l2Device.cpp:229
	fps:1/30
[NOTICE] src/V4l2Device.cpp:230
	nbBuffer:1
[NOTICE] src/V4l2MmapDevice.cpp:71
2018-12-08 15:45:47,507 [NOTICE] - /home/pi/v4l2rtspserver/src/main.cpp:646
	Create Source .../dev/video0
2018-12-08 15:45:47,507 [NOTICE] - /home/pi/v4l2rtspserver/src/main.cpp:165
	Play this stream using the URL "rtsp://192.168.11.12:8555/unicast"
2018-12-08 15:45:47,507 [NOTICE] - /home/pi/v4l2rtspserver/src/DeviceSource.cpp:93
	begin thread

 

3A+ 彷彿不費吹灰之力哩☺

 

影像清晰可期矣!?

 

難到不想更上一層樓乎?!

LIVE555 Streaming Media

This code forms a set of C++ libraries for multimedia streaming, using open standard protocols (RTP/RTCP, RTSP, SIP). These libraries – which can be compiled for Unix (including Linux and Mac OS X), Windows, and QNX (and other POSIX-compliant systems) – can be used to build streaming applications. The libraries are already being used to implement applications such as the “LIVE555 Media Server” and “LIVE555 Proxy Server” (RTSP server applications), and “vobStreamer” (for streaming DVD content using RTP/RTCP/RTSP). The libraries can also be used to stream, receive, and process MPEG, H.265, H.264, H.263+, DV or JPEG video, and several audio codecs. They can easily be extended to support additional (audio and/or video) codecs, and can also be used to build basic RTSP or SIP clients and servers, and have been used to add streaming support to existing media player applications, such as “VLC” and “MPlayer“. (For some specific examples of how these libraries can be used, see the test programs below.)

Source code

The project source code is available – as a “.tar.gz” file – here. See below for instructions on how to build it.
(Note: To use this software, you must be aware of how it is licensed, and your obligations under this license.)

Mailing list

There is a developers’ mailing list: “live-devel@lists.live555.com”. Users (or prospective users) of the libraries are encouraged to join this (low-volume) mailing list, and/or to review the mailing list’s archives. (You can also search these archives using Google, by adding “site:lists.live555.com” to your search query.)Before posting to the mailing list for the first time, please read the FAQ, to check if your question has already been answered.

Support

The primary means of support for these libraries is the “live-devel@lists.live555.com” mailing list described above. (Note that you must first subscribe to the mailing list before you can post to it.)

Are you planning to implement RTP (and/or RTSP)? Instead of writing your own implementation from scratch, consider using these libraries. They have already been used in many real-world RTP-based applications, and are well-suited for use within embedded systems. The code includes an implementation of RTCP, and can easily be extended (via subclassing) to support new RTP payload types.