Биографии Характеристики Анализ

Протокол rtmp порт 1935. Онлайн вещание через Nginx-RTMP: несколько готовых рецептов

Live video streaming is a really big thing. What can be easier than instantly running a live streaming app on your smartphone? It will directly broadcast you or an event taking place around you… And while you’re streaming a video, your friends are watching it from their mobile devices. And all you need to make it happen is the camera and a built-in microphone on your smartphone… Isn’t this fun?

Live streaming has introduced a different manner for users to connect with their friends and for brands to engage and reach out to their customers.

But how can your business or startup easily implement live streaming for Androidwithout dedicating lots of resources and hours of developers’ work to do it? What technology stands behind live broadcast and makes it real?

Let’s dig into the topic to find comprehensive answers to these questions and also learn more about ready-to-use solutions that facilitate and speed up the process of adding a live video streaming feature into your app.

What are characteristics of live streaming

Unlike the format of video on demand which presumes that a user can select and watch videos at any time, live broadcast videos are tied to a specific moment in time and are displayed while being recorded.

And here’s how live streaming process looks like. Video and audio are both transferred through messages that the video player and the media server exchange. The video player connects to the media server first. The server transfers a portion of the video to the player. This video fragment corresponds to the current playing time. A buffer of several seconds ensures video playback without delays or interruptions. This process is constantly repeated the whole time the web broadcast lasts.

But live streaming never transfers media files as a whole (thus saving bandwidth). Instead, it’s enabled through media servers responsible for transferring and streaming digital video, audio and data. Live streaming provides protection to source video files because they can’t get copied to a viewer’s computer. With the help of additional software, live streaming also supports live chatting and Q&A.

There is no just one single format that exists to transmit media data. Instead, you can choose the one that suits your technical needs best.

What video streaming technologies exist?

There are multiple ways of enabling live broadcast in your app. We’ll briefly overview the existing technologies below. This way you’ll be able to differentiate their key features and type of content they’re best made to deliver:

  • RTMP Protocol

Real-Time Messaging Protocol (or just RTMP) was developed for high-performance transfer of the video and audio streams and real-time data messages over the web. Real-time streaming is enabled by establishing a two-way connection between the Flash server and Flash player.

Adobe Flash Player is the most common RTMP client that supports video and audio playback. It is currently available as an open-source specification for development of products and technology that delivers video streams in the formats of AMF, SWF, FLV and F4V (compatible with Adobe Flash Player formats) and audio in AAC and MP3.

  • HTTP-based streaming protocols (HLS and HDS)

HLS format is based on MPEG2-TS and pertains to streaming to iOS devices. It isn’t part of HTML5. HLS combines multiple streams with the metadata information and easily switches between different media data.

HDS uses Adobe’s format for videos and delivers fragments of MPEG-4 files. MPEG format allows storing metadata and audio and video streams in different locations. HTTP Dynamic Streaming is a convenient technology for large media libraries. It helps reduce bandwidth, saves battery life and provides a better user experience compared to HLS.

  • Silverlight streaming protocol

This video streaming format is used for rich Internet apps such as Adobe Flash and for running movies. Despite Microsoft Silverlight no longer works in Chrome browser, it is available in Internet Explorer and Mozilla Firefox.

  • MPEG-DASH

MPEG-DASH provides high-quality live and on-demand video streaming for media coming from HTTP servers. The format allows adding ads in between video segments for both types of streaming. Media content is encrypted once and delivered to a client computer with the help of different DRM (Digital Rights Management) schemes.

  • Progressive download streaming

With progressive download, media content is transferred from a server to a client computer through HTTP protocol. It doesn’t require any streaming server for file hosting or downloading a media file to watch it. Progressive download enables video playback before a complete video download.

The rise of 4K video, high user expectations of quality standards and smooth experience, development of new effective platforms and faster Internet connection make demands to video streaming formats stricter. Irrespective of variety of technologies available, we’ll focus on RTMP as one of the most widespread and favorite streaming protocols among developers.

So, what is RTMP protocol and why it’s so good

Created by Macromedia (currently Adobe), Real-Time Messaging Protocol ensures adaptive bitrate streaming (ABS). When the bandwidth changes, the video quality automatically tunes up to it. RTMP is based on Transmission Control Protocol (TCP) which prioritizes maintenance of stable connection and low latency. Regarding the type of content, RTMP allows transmitting both prerecorded and live media data and text information.

Moreover, RTMP can be used not only for mobile streaming. RTMP server can send media data both to web applications as well as to mobile devices.

It is most often praised for the following advantages it provides:

  • It is specifically optimized for live streaming

The greatest benefit that RTMP provides is optimization of video and audio data transmission. For streaming, it uses the exclusive 1935 port that is suitable for low-latency content transmission which is vital for live streaming and requires no buffering.

  • It is a mature technology

RTMP has been used for live streaming for more than 10 years. For a developer, setting up RTMP Server is an easy task. For a user, video streaming is enabled in different formats at the same time. Security features such as Player verification are applied too.

  • You can watch any part of the video being broadcasted

All RTMP servers allow recording incoming media streams and provide the ability to display videos from the beginning. A user can skip parts of the video till the current moment in the broadcast. This feature is particularly useful for long videos (more than 10 minutes), allowing to easily switch to any part of it.

  • It is the most popular real-time streaming protocol

RTMP is a platform-independent protocol that requires no hardware dependencies and is compatible with Windows, Mac, Linux, Android, iOS and Windows mobile. It is also widely utilized in gaming devices, such as PlayStation, Xbox One, and PS Vita.

How RTMP works

In simple words, RTMP streaming consists of the following three entities:

  • A client that creates a media stream and broadcasts by RTMP protocol to a server. As client “publishers”, you can use a lot of apps on different platforms, such as FFMPEG based players, VLC Player, YouTube clients, and AVLib based solution.
  • A server that handles an incoming stream and performs processing and recording as necessary. The server also provides broadcasts to other clients. Among servers, the best options would be Wowza Media Server, Flussonic Media Server, and Simple RTMP Server.
  • Viewers represent any client that can watch published streams. For displaying such media streams, you could use any player that supports RTMP protocol. The good news is that almost all currently used players for all existing platforms support RTMP streams. You can select Flash Player, VLC, or Media Player Classic.

The most complex and resource-intensive are broadcaster apps. ‘Broadcasting flow’ includes media processing, mixing, encoding and further streaming over RTMP protocol to a server. It depends significantly on a platform and hardware and requires a lot of supporting resources.

To transmit as much data as possible with RTMP protocol, video and audio are split into fragments of different sizes. The default sizes are 64 bytes for audio and 128 bytes for video. Video chunk sizes are determined by the interaction format between a user and a server.

Fragments of media are then interleaved and multiplexed over a single connection while correlating with a channel’s bandwidth and latency. The stream coming from the broadcaster to the server consists of small data blocks that include different types of data (i.e., video, audio service, etc.). RTMP streaming can concurrently transfer several different data blocks, thus encapsulating both video and audio and enabling remote procedure calls.

When the client opens the stream in RTMP player, a request is sent to RTMP Server. A session is initialized and service data exchange occurs. Once the client RTMP player receives the necessary portion of the service data packages about the ongoing stream, it starts decoding, buffering and displaying RTMP media stream.

With RTMP, media is not required to be stored in any temporary storage. It continues to stream directly between clients and servers. If the bandwidth capacity allows, the same stream is directed to numerous clients that send requests. The streaming capacity improves if several media servers are put into a network. The streaming process continues until either the server or the player finishes the session.

How can you use RTMP to stream video in your Android app?

You can watch RTMP stream on any platform with the help of any player that supports RTMP protocol. For Android, the most popular third-party players are MX, VLC, and BS Players as well as any other player that supports FFMPEG. For watching RTMP from inside the application, a developer needs to integrate any player library that can read RTMP streams. These are ijkPlayer and VLC SDK.

Onix team have made their technological contribution to finding an easy and beautiful solution for video streaming and have created AVLib , Onix own external library for Android RTMP streaming.

Let’s see how it works with the live broadcast for Android apps and how the idea originated.

How AVLib solves the basic problem for Android RTMP streaming

https://rtmplib-android.com/

Our Android team of developers have come to the idea of AVLib almost accidentally, but with a great outcome and effect. While working on the task of adding a feature to broadcast video and audio for Android devices to RTMP servers, they encountered a serious problem. The customer’s requirements stated that the app should be able to stream video and audio data at its maximum capacity through an Android camera. It was also necessary to enable support of Android 4.0 as the minimum version, for users with older mobile devices could use it, and possess a number of convenient usability settings for a user.

Onix team have conducted a deep research and comparison of existing both commercial and open-source streaming libraries. But with no satisfying result. It turned out there was no similar solution in the market that could meet our technical needs in a complete manner. The team members quickly came to a decision of creating their own external library that could support RTMP streaming for Android. And because there is a vast number of Android devices and OS versions being currently in use, this library was built to support streaming needs of all current Android users.

But it never makes sense to spend time on creating a one-time tool that solves one particular task strictly to the required extent. What if a similar situation is repeated? Why not use the best of what technology has to offer and build a well-tested software product?

We intended to develop an elegant, flexible and simple solution, so any other third-party Android team or a developer who was looking for an RTMP library could easily integrate it into an app without having to reinvent the wheel. And we did it! AVLib combines all features we expected and comprehensively solves the basic task of the video broadcast.

How AVLib was developed and why it’s a reliable RTMP library

AVLib is an RTMP library that we’re truly proud of. It is a software product that solves a customer’s requirements for live streaming of any complexity level. It is a ready-to-use tool for Android Studio that is integrated into a mobile app straight away.

AVLib represents a convenient and stable solution that is based on the following principles:

  • An easy integration with the app

For an Android developer, it would take about an hour to complete the process of integration of AVLib and add a live streaming feature into an app.

  • Maximum capacity

To implement the RTMP library and empower it with a high capacity potential, our team chose the C programming language. Every single function included into AVLib, starting from the conveyor logic, coding, work with RTMP and up to processing, were built using pure C.

  • UI custom-built library

AVLib is flexible and can be easily adjusted to customer needs in UI design (i.e., buttons, text) and video settings (i.e., frame resolution, audio, codec quality, bitrates).

  • Support of all existing types of Android devices

This RTMP library comes as one .aar file with no dependencies. AVLib was tested to make sure it is compatible with various Android devices and supports Android OS version 4.0 and higher.

You can find more details about AVLib’s features .

The development process of AVLib was really full of challenges and required thought and effort from our Android team.

  • Streaming from action cameras? Yes!

One of the peculiar features of AVLib is its ability to stream video and audio from action cameras on the fly. To enable this feature, you need to work simultaneously with two network interfaces on the side of the module in C. The task was completed successfully but demanded thorough research of the source code of Android OS and continuous debugging.

  • Building the broadcast life cycle

Another significant challenge that we encountered during the development phase was enabling smooth work with the camera and processing of the life cycle on different devices. That was rather time-consuming and required lots of scrutinizing work.

Initially, RTMP (Real Time Messaging Protocol) was created by Adobe Systems for transmitting audio and video streams, text messages, and other data across the web. The main principle of its work lies in initiating interaction between a server and user’s Flash Player. RTMP is based on TCP, which means that its high priority lies in sustaining stable connection and providing low-latency interaction. In order to broadcast smooth streams and to transmit as much data as possible RTMP server divides information into fragments. Then, fragments’ size is defined due to the format of interaction between a user and a server.

What is more interesting about RTMP is that it involves different virtual channels, which transmit data packets during one media session. These channels may include: a channel for RPC requests and their results, one for control messages, channels for audio and video streaming. Moreover, they can operate simultaneously without causing any technical issues for one another.

RTMP vs RTSP

In terms of data transmitting, there is another well-known protocol called RTSP. So, let’s take a look at the differences between RTMP and RTSP protocols.

The main purpose of RTSP (Real Time Streaming Protocol) is to maintain the activities of streaming servers. Furthermore, this protocol sets up an interaction between a client and a server. RTSP enables end users to control media session by means of simple commands such as play, pause, and stop. Moreover, it allows clients to watch video from any fragment without waiting for complete download.

RTMP, in its turn, also sustains abovementioned features. However, RTMP server, by means of RTMP protocol, can monitor every action taken by a client starting from the time he or she initiates session until the session is closed. In such a way, it makes reports within RTMP more precise and provides a full picture of user’s activity during particular media session. Likewise RTMP, RTSP is capable of live streaming as well. However, streaming data transmission is not a main task for RTSP, that is why, for this purpose it needs some additional protocols.

How it works

The principle of RTMP work is simple. In order to start RTMP stream, it’s enough to establish interaction between RTMP server and client RTMP player. Once this communication is set up, the server starts transmitting the media as a constant flow of bytes. This process continues until either the server or the player finishes the session.

The good thing is that RTMP protocol is very flexible and delivering audio, video and text information in various formats belongs to its capabilities. For instance, RTMP protocol enables video streaming in MP4 and FLV formats, audio streaming – in MP3 and AAC. Moreover, thanks to this protocol, RTMP server sends media to web applications as well as to mobile devices. For this purpose a user needs to have Flash Player installed in a browser or on a mobile device accordingly. Then, swf file, which contains all media information of the stream, will be played by Flash Player. However, one of the greatest benefits of RTMP protocol is that it can be applied to live and on demand streaming. Let’s take a look at each of these streaming processes.

Live streaming

Live video streaming belongs to key features of RTMP protocol. With its help, you can broadcast your video live during the process of its recording. Mainly, live broadcasting is used for sports events, shows, concerts etc. In this case, RTMP protocol is literally irreplaceable. It has low latency from real time in streaming, in comparison with HTTP protocol and its delay of more than ten seconds, which is not appropriate for professional live streaming.

Let’s review one more vivid example of RTMP exceptional functionality for live streaming. For example, popular IP cameras that support RTMP protocol, have built in loudspeakers, so you can not only see the video live, but also be involved in the process of broadcasting and express your opinion to the streamers.

On demand streaming

On demand streaming allows users to choose when to watch selected media content, which is more convenient for them rather than to observe this content at the time of its broadcast. As a rule, video on demand (VOD) is used for several reasons: because it plays smoothly even with low Internet connection speed, when the number of viewers online is not substantial, for the sake of HD quality. With RTMP protocol even VOD is more efficient. First of all, it provides multicast support. If you want to have one stream inside your working network and provide it to multiple users, with RTMP you won’t need to create separate connections for each user. Other protocols like HTTP or CDN do not have this feature. Also, RTMP enables users to reconnect to the video stream in case of connection issues. During troubles with connection, the video is played from buffer and when a user reconnects the buffer starts filling and in such a way avoids frequent pauses in video stream.

RTMP implementations

Obviously, all this information makes you curious how to implement RTMP. This is a cross-platform protocol and it works on Windows, Mac, Linux, Android, Windows Mobile, iOS. Do you have console and enjoy playing games? You can easily use RTMP services for such devices as Xbox One, PlayStation and PS Vita.

Due to the variety of platforms suitable for RTMP protocol, there are many options for its implementation. They can vary from command-line implementation to full featured open source implementation.

Command-line implementation

RTMPDump tool is used for command-line implementation, as it perfectly copes with recording RTMP streams, live broadcasting and video on demand. Besides, RTMPDump is an open source tool which can be used on Linux, Android, Mac OS X, and Microsoft. This utility is very popular because of its small size and the ability to decrypt RTMPE, which is encrypted RTMP, and RTMPS – secure RTMP.

RTMPDump package has three programs: rtmpdump, rtmpsrv, and rtmpsuck. Each of these programs performs particular functions. For example, rtmpdump is used for establishing connection to RTMP servers and capturing the stream itself; rtmpsuck can capture the stream as well, or it can assist in gathering key parameters for rtmpdump. Main function of rtmpsrv is to keep track of connections and streams.

Full implementation

If you’re more interested in full implementation, you’ll need these three pieces of software: live video encoder, media streaming server and video client application. You don’t know which live video encoder to install? Then, you can choose between Flash Media Live Encoder, FFmpeg, WireCast, Wowza Transcoder, Nimble Streamer Transcoder. However, please take into account that the most popular one is Flash Media Live Encoder, which is available for free download on Adobe website.

As for video client application, Adobe Flash Player is the most advisable variant. It is a free RTMP player and works as a plug-in from a browser or even mobile device. Flash Player is suitable for Windows, OS X, Chrome OS, and Linux. Alternative options are Gnash and VLC media player. Both of them are open source media players. Gnash has all chances to substitute Flash Player in RTMP streaming on Linux. VLC media player, in its turn, is not universal, as it can sustain RTMP streams only partially.

RTMP servers such as Adobe Flash Media Server, Wowza Streaming Engine, Flussonic Media Server are claimed to be very good ones. However, you can install free RTMP server like Nginx with RTMP Module or Red5, which is also an open source RTMP server on Java.

How to tackle the most frequent issues with RTMP protocol

RTMP protocol, despite all its obvious advantages, has also some disadvantages. Due to the fact that it differs a lot from HTTP protocol, it is not sustained by HTML5. Furthermore, RTMP protocol works poorly on iDevices and it affects the quality of video streaming. In such case, it’s better to use HLS protocol on Apple gadgets. The principles of HLS and RTMP work are quite similar, but, in cases with HLS, the stream is divided into series of tiny HTTP-based files. Initially, this protocol was developed for Quicktime, iOS and Safari browser. However, now HLS protocol can be used on many other platforms as well. The protocol copes very well with bandwidth limitations and adapts video quality accordingly. Considering the speed of video delivery, HLS won’t be the best variant, as its latency is twenty seconds.

Another drawback of RTMP protocol is that it’s vulnerable to bandwidth issues. Sometimes, low bandwidth may cause interruptions in media streaming or even stream may not start if Internet connection speed is not enough. An alternative way for broadcasting with limited bandwidth is to use Dash. Dash is an adaptive bitrate streaming technology which provides high quality media broadcasting. This technique is able to diagnose the bandwidth of a particular user and adapt video quality accordingly to connection speed. In addition, it cannot do without an encoder that encodes the video at many bit rates. Then, different encodings are switched by the player due to suitable resources. As a result, little buffering is achieved and great video experience is gained. It is hard to estimate all benefits of this technique for streaming major events at national level, for example.

One more downside of RTMP protocol lies in the necessity to have installed Flash Player plug-in, without which RTMP media transmitting will be impossible. Also, there are some troubles while applying RTMP for CDN streaming services.

Do you still have questions regarding RTMP protocol or its implementation? and we’ll help you with it and demonstrate all its benefits in practice.

Недавно я наткнулся на топик "Сервер онлайн-вещаний на базе nginx " о замечательном модуле Романа Арутюняна (@rarutyunyan) для nginx: nginx-rtmp-module . Модуль очень прост в настройке и позволяет на основе nginx создать сервер публикации видеозаписей и живого вещания.

Про сам модуль можно прочитать на его странице на GitHub , я же хочу привести несколько простых примеров использования. Надеюсь, топик поможет новичкам в видеоделах (таким как я).

Коротко об RTMP

RTMP (Real Time Messaging Protocol) - проприетарный протокол вещания от Adobe. В качестве транспорта по умолчанию используется TCP (порт 1935). Также можно инкапсулировать RTMP в HTTP (RTMPT). Клиент RTMP - это в первую очередь Adobe Flash Player.
Кодек видео - H.264, кодек аудио AAC, nellymoser или MP3, контейнеры MP4 или FLV.

Публикация видеозаписи

Иначе говоря, видео по запросу (VOD). Просто добавьте в nginx.conf в секцию rtmp { server {… }}.
application vod { play /var/videos; }

(Прим.: конечно, секцию не обязательно называть vod)
Теперь можно положить в папку /var/videos видеофайл в правильном формате и «скормить» плееру источник, например rtmp://server/vod/file.flv. Насколько я понял, MP4 нативно поддерживает перемотку видео, а FLV придется индексировать отдельно.

Онлайн-трансляция

Мы можем отправить поток видео и аудио на сервер используя все тот же протокол RTMP для публикации. А наши клиенты смогут трансляцию смотреть. Для этого на сервере надо добавить секцию:

Application live { allow publish 1.2.3.4; allow publish 192.168.0.0/24; deny publish all; allow play all; live on; }

На машине, с которой мы будем вещать, для начала надо получить список устройств DirectShow. Пуск - Выполнить - cmd, переходим в папку ffmpeg/bin и запускаем:
ffmpeg -list_devices true -f dshow -i dummy

Если в названии вашего источника есть русские буквы, то они могут отобразиться кракозябрами. ТруЪ админы заюзают iconv, а простые парни вроде меня раскодируют бяку на сайте Лебедева . FFmpeg"у нужно скормить читабельную надпись.

Теперь, зная имя видео и аудио источника, можно захватить его при помощи ffmpeg и отправить на сервер.

Веб-камера

Как минимум нужно указать источник видео, кодек и сервер:
ffmpeg -f dshow -i video="Webcam C170" -c:v libx264 -an -f flv "rtmp://1.2.3.4/live/test.flv live=1"

Вместо «Webcam C170» нужно подставить название вашей камеры из списка.
Ключ -an говорит о том, что мы не передаем аудио поток. Если аудио поток нужен, то строка запуска будет выглядеть примерно так:
ffmpeg -f dshow -i video="Webcam C170" -f dshow -i audio="Микрофон..." -c:v libx264 -c:a libfaac -ar 44100 -ac 2 -f flv "rtmp://1.2.3.4/live/test.flv live=1"
Здесь мы использует кодек libfaac, частота дискретизации 44100, 2 канала (стерео). Можно вместо AAC использовать MP3 (кодек libmp3lame).

Аналоговая камера

Если у вашей камеры аналоговый выход, то ее можно подключить к компьютеру с помощью устройства захвата. Я использую дешевую PAL камеру и USB плату захвата с Dealextreme.

Ffmpeg -r pal -s pal -f dshow -i video="USB2.0 ATV" -c:v libx264 -an -f flv "rtmp://1.2.3.4/live/test.flv live=1"

Захват экрана

Тут есть два варианта: установить FFSplit или использовать screen-capture-recorder с FFmpeg.
FFSplit использовать проще, т.к. у него есть удобный GUI, но он не работает под XP/2003.

Если вы решили выбрать второй способ, то строка запуска FFmpeg будет выглядеть примерно так:
ffmpeg -f dshow -i video="screen-capture-recorder" -c:v libx264 -an -r 2 -f flv "rtmp://1.2.3.4/live/test.flv live=1"
Аудио-поток можно захватить с virtual-audio-capturer.


Пример захвата экрана в приложении

Ретрансляция

Естественно, вы можете ретранслировать видео или аудио файл (или поток) FFmpeg на сервер. В примере ниже мы передаем MJPEG видео с удаленной камеры:
ffmpeg -f mjpeg -i video="http://iiyudana.miemasu.net/nphMotionJpeg?Resolution=320x240&Quality=Standard" -c:v libx264 -f flv "rtmp://1.2.3.4/live/test.flv live=1"
Но для таких целей более разумно использовать опцию push на самом RTMP-сервере, чтобы исключить промежуточное звено и вытягивать поток на самом сервере.


Какая-то веб-камера в Японии

Тюнинг, решение проблем

-preset имя У H.264 есть несколько наборов настроек соотношения компрессия/скорость: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow. Поэтому если вы хотите повысить производительность, стоит использовать:
-preset ultrafast
-crf число непосредственно влияет на битрейт и качество. Принимает значения от 0 до 51 - чем больше, тем ниже качество картинки. По умолчанию 23, 18 - losless качество. Битрейт примерно удваивается при уменьшении CRF на 6.

-r число задает входной и выходной FPS. Для источников, с которых вы захватываете картинку, можно установить вместо -r -re , чтобы использовать «родной» FPS.

-rtbufsize число размер буфера реального времени. Если у вас постоянно появляются сообщения о переполнении буфера и отбрасывании кадров, вы можете поставить большой буфер (например, 100000k), однако это может увеличить задержку передачи.

-pix_fmt задает цветовую модель. Если у вас вместо картинки показывается черный квадрат, а звук работает, попробуйте поставить yuv420p или yuv422p .

-s ширинаxвысота входной и выходной размер картинки.

-g число насколько я понял, это максимальное число кадров между ключевыми. Если у вас FPS очень маленький, то можно поставить это значение поменьше, чтобы уменьшить задержку начала трансляции.

-keyint_min число минимальное число кадров между ключевыми.

-vf «crop=w:h:x:y» обрезать видео

-tune zerolatency «волшебная» опция уменьшения задержки трансляции. Что она конкретно делает я так и не нашел (-:

-analyzeduration 0 отключает анализ длительности, что помогает снизить задержку трансляции

Помимо рассмотренных выше параметров аудио вам может понадобиться -acodec copy в том случае, если ваш аудио поток не требует дополнительной перекодировки в MP3/AAC.

Пример: вещаем с веб-камеры с низкой задержкой без звука, рисуем в верхней части картинки текущее время

Ffmpeg -r 25 -rtbufsize 1000000k -analyzeduration 0 -s vga -copyts -f dshow -i video="Webcam C170" -vf "drawtext=fontfile=verdana.ttf:[email protected]:fontsize=48:box=1:[email protected]:text=%{localtime}" -s 320x240 -c:v libx264 -g 10 -keyint_min 1 -preset UltraFast -tune zerolatency -crf 25 -an -r 3 -f flv "rtmp://1.2.3.4:1935/live/b.flv live=1"

Плеер на сайте

Тут все просто. Поставьте на свой сайт один из популярных плееров, например