📜 ⬆️ ⬇️

VLC: Stream and Stream Server # 2

image
In this part, we will look at “Simple Streaming” through the GUI for housewives , and for example, we can use the following situations:
1. When we act as a local translator, for people with limited Internet, with the Internet turned off, or for those who consider your taste and want to watch what you recommend to them.
3. If you want to transfer video from your webcam, just a digital camera and any other similar devices, via DirectShow.


If anyone has questions that have already been covered, see the answers in the topics:
Serious talk about VLC
Serious talk about VLC # 2
VLC: Stream and Stream Server # 1
and
Stable IPTV broadcasting via VLC


Comments:
1. For convenience, in case you will be shoving a multitude of files, I advise you to prepare a playlist in M3U format in advance.
2. In the latest versions of VLC, stream can be safely configured to broadcast on almost all protocols at once, if of course this is required.
3. For debugging and learning, I recommend starting with VLC using the logger module.
image
vlc -extraintf logger
4. For the imposition of the logo on the stream, use the filter logo , preferably in PNG format.
image
5. As alternative players for playing streams from VLC, they took Windows and Winamp Media Player.

Stream output methods



Configure incoming data


For all types of broadcasting, the initial GUI dialog looks the same:
image
File: Just select a playlist or any file (Audio / Video), and depending on what you are going to broadcast to the network.
Disk: DVD. AudioCD. VCD, here you can turn off the menu output, select the drive, and the chapter.
Network: here we can choose any protocol and address of the incoming stream that we will relay / convert / save (for example, from Youtube). Also yesterday, it was verified that VLC copes with RTMP streams so that you can broadcast video from your webcam, the flow of which goes to any red5 managed service.
image
Capture Device: Here you can choose, if any, any device that works through Direct Show, Camera, Webcam, Digital or Satellite TV, as well as your Desktop (Everything that happens on your monitor screen will be broadcast).
image
Once you have decided on the choice of the incoming stream, just press the “Stream” button. After that, a new dialog box opens, which simultaneously works as a streaming and / or conversion setting, and the final result depends on the settings made here. Click the Next button, or the Destination tab .
As shown in the figure, and as I mentioned, we can conduct broadcasts on all supported protocols simultaneously, in this example I am showing an example of HTTP / MMS broadcast.
Choose:
New Destination - HTTP, click Add, type in the address (0.0.0.0, or look at ipconfig), specify the port. If we need more protocols, then just press "+".
image
Transcoding Options: Choose a transcoding method from ready-made profiles, or create your own (and you can also start up a stream without processing for client VLC).
')
Having run it over with codecs, I came to the conclusion, and then after reading online, I realized that I’m not the only one - streaming video using the mms and http protocols with technical data:
Encapsulation - ASF
Codec - DivX3
Width - 320 (to reduce the load)
Height - 200 (to reduce the load)
Audio - mp3
Bitrate - 96
The most optimal for transfer to most players.
image
  : sout = # transcode {vcodec = DIV3, vb = 800, scale = 1, width = 320, height = 200, acodec = mp3, ab = 96, channels = 2, samplerate = 44100}: std {access = mmsh, mux = asfh, dst = 0.0.0.0: 1234} 
In these cases, testing on 10 clients, the processor load was ~ 5-12%

The same method can be used for people who do not have a media player at all, to view / listen to the stream from your web site (local, or if you have External IP, this method will also work on the site on the Internet).

To do this, create a document with the extension * .asx, for example stream.asx and place the code there:
  <ASX version = "3.0">
   <TITLE> Home Stream </ TITLE>
   <ENTRY>
     <REF HREF = "http://127.0.0.1:1234" />
   </ ENTRY>
 </ Asx> 

Where HREF is your IP and port. Put this file on the server, for example in the folder / stream /, and in the html file, where you would like to display the stream, write the following:
  <embed src = "stream.asx” height = ”320” width = ”200”> 


If customers have Mplayer or VLC, then you can play with other types of encapsulations and codecs, such as TS and h264, respectively.
image
  : sout = # std {access = http, mux = ts, dst = 0.0.0.0: 8080} 

In this case, we will get a smaller load on the system, which is larger per channel, but at the same time, customers receive the original video.

The next / last tab Options is not required, it is worth looking into it only for those who will customize Announcements, or want to see the generated script that can be further used from the command line, is also useful if you run the broadcast on "Kron". I already wrote about how to use it.
Click the last time " Stream " and invite friends.

Conclusions: The quality of the stream and its reception can be achieved only with VLC or Mplayer on both sides, as in the case of VLC it does not require problems with plug-ins and codecs. Everything that it streams using any protocol, it quickly and painlessly picks up client side, regardless of codecs and encapsulations and other annoying factors. This conclusion is based only on the fact that the method in question is good for housewives, and people who do not know how to use consoles and command lines. In the next part, we will try to uncover the topic and the possibilities of broadcasting on the basis of the “Command Line”, which increase the range of opportunities for stringing.

PS: If there are problems with accessibility from the network,
1. Check Firewall, Proxy, File C: \ **** \ VideoLAN \ VLC \ http \ .hosts for uncommented lines
  :: / 0
 0.0.0.0/0

UPD: To stream over UDP unicast
server-side, you must specify the IP and port of destination. For example:
Server (192.168.0.1), Client (192.168.0.2)
On the server in the streaming settings specify
Media - Stream - UDP, 192.168.0.2:1234
At the client to view the stream:
Media - Open Network Stream - UDP, @: 1234

UDP Multicast
In multicast, the stream is broadcast to multicast IP addresses ( IP addresses reserved for this purpose, the range is from 224.0.0.0 to 239.255.255.255 ). Then, any machine on the network can join the multicast group, sending a request to the network will automatically receive the broadcast stream.

Then it sends a request to stop playing the stream and leaves the group. The advantage of multicast stream is that only those machines that want to receive it receive the stream, and the server broadcasts only one stream that all members of the group receive.

Activation of multicast, occurs as in the case of unicast, only in the Options tab you need to specify the number of TTL * (for example, 50) IP packets, This means that the multicast stream will be able to cross 50 routers.
* - Time To Live
And from the client’s side, it’s enough just to open the stream in any player that supports multiast and specify in the stream name line
udp: // @ _ IP_: port

Related Links
Multicast on Wikipedia
IP Multicast on Cisco

We will discuss multicast in more detail in the topic of advanced streaming using the command line and telnet.

Source: https://habr.com/ru/post/74471/


All Articles