Stream with vlc linux

Documentation:Streaming HowTo New

This documentation explains how to stream, transcode and save streams using VLC media player.

NOTE: This is work in progress. For a more complete, yet outdated, documentation on Streaming with VLC please see the old Streaming HowTo.

Contents

Introduction

VLC media player is able to stream, transcode and save different media streams. For more information about the formats and codecs supported please see the VideoLAN Streaming Features list.

Transcoding

Transcoding is the process of taking a media file or stream and converting it to a different format or bitrate.
There are two methods for transcoding in VLC: via the GUI (VLC’s default interface) or via the commandline. The term transcode by itself normally refers to converting one media format to another and saving the output to a file (i.e. no streaming involved).

Transcoding using the GUI

One of the methods of transcoding is via the GUI. To access this:

  1. In VLC, go to «Media >> Convert / Save. » (Ctrl+R).
  2. Add the input file(s) or stream(s) you want to transcode. Press «Convert / Save».
  3. In the «Convert» windows specify the destination file name (including file extension — e.g. on Windows «C:\out.mp3»).
  4. Select the desired codec from the profile list. To check/edit the settings of a given profile press the «Edit selected profile» button. Profiles can also be added/deleted.
  5. Press «Start».

If the profile settings were compatible and transcoding was successful, a playable destination file should be created.

Using the commandline

Another method of transcoding is via the commandline. This is more flexible than via the GUI as it enables full usage of the modules and options available in VLC.

To use the VLC’s commandline you need to have access to the commandline interface, for example via a shell.

Windows-based systems

On Windows-based systems the Command Prompt can be used. This can be found in the «Accessories» folder of the Start menu. Alternatively by going to «Start >> Run. » or pressing «Windows key + R», entering «cmd» into the text field and press «OK» or Enter.

Once the Command Prompt window is opened navigating to the folder/directory where VLC is located is easiest for using the commandline as only «vlc.exe» or «vlc» (as the .exe part is assumed) needs to entered to run VLC. If VLC is installed in the default location (on a 32-bit system) running:

Should change to the directory where vlc.exe is located.

Unix systems

On Unix-based system (such as Linux and macOS) a terminal window can be opened. Running «vlc» should be all that is needed to open VLC:

Transcoding commandline string structure

A typical commandline string for converting a file to another format is:

Where INPUT is the input stream, [TRANSCODE_OPTIONS] are the options set for the desired output format, codecs, bitrate etc. and [OUTPUT_OPTIONS] are the option set for the output type. —sout is the stream output commandline option.

Example commandline: Converting an audio file to a MP3 file

An example usage might be converting an audio file to a MP3 file:

Where INPUT is the input file and OUTPUT is the destination file (for example «C:\out.mp3» on Windows or «/home/username/out.mp3» on a *nix system). The above sout string is the default «Audio — MP3» profile setting accessible via the GUI. It will convert an audio input to a 128kbps CBR MP3 file (sample rate 44100Hz, 2 channels).

Other examples commandline strings

Convert an audio input to an uncompressed WAVE (*.wav) file:

Convert an audio input to an AAC file (MP4 container):

Streaming

Streaming using the GUI

Streaming using the GUI is only available on the Qt interface. To stream using the GUI, open VLC, then Media [menu] -> Stream:

Читайте также:  Не могу разбить жесткий диск при установке windows 10

Select a stream (such as a file, a network stream, a disk, a capture device . ) from the «Open Media» dialogs that pops up.

The following streaming methods are available for use with VLC:

  • Display locally: display the stream on your screen. This allows you to display the stream you are actually streaming. Effects of transcoding, rescaling, etc. can be monitored locally using this function.
  • File: Save the stream to a file.
  • HTTP: Use the HTTP streaming method. Specify the TCP port number on which to listen.
  • MS-WMSP (MMSH): This access method allows you to stream to Microsoft Windows Media Player. Specify the IP address and TCP port number on which to listen. Note: This will only work with the ASF encapsulation method.
  • UDP: Stream in unicast by providing an address in the 0.0.0.0 — 223.255.255.255 range or in multicast by providing an address in the 224.0.0.0 — 239.255.255.255 range. It is also possible to stream to IPv6 addresses. Note: This will only work with the TS encapsulation method.
  • RTP: Use the Real-Time Transfer Protocol. Like UDP, it can use both unicast and multicast addresses.
  • IceCast: Stream to an IceCast server. Specify the address, port, mount point and authentication of the IceCast server to stream to.

The most common way is via HTTP. To stream via HTTP, click on «Destinations», choose HTTP from the drop down as a «New Destination» and click add. Now if you are streaming video, you will want to stream to something like «/go.mpg.» Now hit stream, and you should be able to use a different instance of VLC as a client, and listen to that stream now (ex: on the same computer it would be «Media» [menu] -> Open Network Stream -> «http://localhost:8080/go.mpg» and it should work.

  • even though you click on «enable transcoding» and specify some other container type, it will give you the flv container type unless you use a suffix, like «.mpg» ref
  • VLC client cannot receive a stream at less than 5 fps, though it can stream it alright for those speeds (and other players can receive it). ref.
  • NB that *many* times when using the GUI to stream it will choose the wrong thing. For example, if you give a path of «/» it will use FLV container type (which you probably didn’t want, and which overrides your transcoding settings’ container type *silently*), and if you give it «/go.mp4» it will *silently* fail (you can look at the log messages to see what the error is—it says «mp4 type is not supported except for files»). It is tricky to get it set up. It’s like the GUI sets it up wrong most times. Here is a laundry list.

Select a transcoding profile that fits the codecs and access method of your stream, such as MPEG-TS, MPEG-PS, MPEG-1, Ogg, Raw, ASF, AVI, MP4 and MOV. You can also create or modify profiles by clicking the «Edit selected profile» button next to the selection combobox.

Select methods to announce your stream. You can use SAP (Service Announce Protocol) or SLP (Service Location Protocol). You must also specify a channel name. The macOS interface also allows you to export the description (SDP) file of a RTP session using the internal HTTP or RTSP server of VLC, or as a file. This can be done using the according checkboxes. The SDP URL text box allows to give the url or destination where the SDP file will be available. There is a text box displays the Stream Output MRL (Media Resource Locator). This is updated as you change options in the Stream output dialog, and can be tweaked by hand if necessary.

Click «Stream» to start streaming.

Streaming using the command line interface

If you want to stream using the command line interface instead of the GUI (more control, for example you can specify your own container), you can «sniff» the options the GUI is using by opening up the logger (Tools menu -> message) and setting verbosity level to «2» then doing a stream. It will output debug messages that basically tell you what it is using for command line parameters, then you will take those same parameters and use them on the command line (you may need to add quotation marks around words that have spaces in them, and you may need to add —‘s).

Источник

Documentation:Streaming HowTo/Command Line Examples

VLC Streaming HowTo
Introduction
Streaming, Muxers and Codecs
Main
Easy Streaming
Advanced Streaming Using the Command Line
Command Line Examples
VLM
VLM — Multiple Streaming and Video on Demand
Tutorials and examples
Receive and Save a Stream
Convert files to other formats
Stream a File
Stream a DVD
Stream a DVB Channel
Stream from Encoding Cards and Other Capture Devices
Stream from a DV Camcorder
Streaming for the iPhone
IPv6
Streaming over IPv6
View this alone

Examples for advanced use of VLC’s stream output (transcoding, multiple streaming, etc. )

Contents

Transcoding

Transcode a stream to Ogg Vorbis with 2 channels at 128kbps and 44100Hz and save it as foobar.ogg:

Transcode the input stream and send it to a multicast IP address with the associated SAP announce:

Display the input stream, transcode it and send it to a multicast IP address with the associated SAP announce:

Transcode the input stream, display the transcoded stream and send it to a multicast IP address with the associated SAP announce:

To receive the input stream that is being multicasted above on a client:

More complex transcoding example

Stream a SDI card to H.264 and AAC in TS on UDP

Multiple streaming

Send a stream to a multicast IP address and a unicast IP address:

Display the stream and send it to two unicast IP addresses:

Send parts of a multiple program input stream:

This command sends the program of the input stream which id is 12345 to 239.255.12.42 and all video programs with id between 1234 and 2345 to 239.255.12.43.

Transcoding and multiple streaming

Transcode the input stream, display the transcoded stream and send it to a multicast IP address with the associated SAP announce and an unicast IP address:

Display the input stream, transcode it and send it to two unicast IP addresses:

Send the input stream to a multicast IP address and the transcoded stream to another multicast IP address with the associated SAP announces:

More complex multi-transcoding example

Take a SDI input, and transcode it twice, once in HD, and one in SD and send both on udp.

Take a SDI input, and restreaming it once in raw and transcoding it for the second

HTTP streaming

Transcode and stream in HTTP:

Recording a live video stream:

For example, if you want to stream an audio CD in Ogg/Vorbis over HTTP:

RTSP live streaming

Stream with RTSP and RTP:

RTSP on-demand streaming

MMS / MMSH streaming to Windows Media Player

VLC media player can connect to this by using the following url: mmsh://server_ip_address:8080. Windows Media Player can connect to this by using the following url: mms://server_ip_address:8080.

Use the es module

Separate audio and video in two PS files:

Extract the audio track of the input stream to a TS file:

Stream in unicast the audio track on a port and the video track on another port (NOTE: This will not only work with VLC 0.8.6 or older — FIXME?): [Please check this]

  • on the server side:
  • on the client side:
    • to receive the audio:
    • to receive the video:

Stream in multicast the video and dump the audio in a file:

Note: You can also combine the es module with the other modules to set-up even more complex solution.

Keeping the stream open

The basic transcoding is an mp3 stream from the file you select (if it is a video file, then the video is ignored). It is streamed via http to localhost:8080/stream.mp3

The combination of :sout-keep and dst=gather:std mean that the stream is kept open and subsequent items are played through the same stream.

Using VLC as a reflector

Taking a UDP input and resending it once raw via IPv6 multicast, and once in HLS

Источник

Documentation:Streaming HowTo/Stream from Encoding Cards and Other Capture Devices

VLC Streaming HowTo
Introduction
Streaming, Muxers and Codecs
Main
Easy Streaming
Advanced Streaming Using the Command Line
Command Line Examples
VLM
VLM — Multiple Streaming and Video on Demand
Tutorials and examples
Receive and Save a Stream
Convert files to other formats
Stream a File
Stream a DVD
Stream a DVB Channel
Stream from Encoding Cards and Other Capture Devices
Stream from a DV Camcorder
Streaming for the iPhone
IPv6
Streaming over IPv6
View this alone

Contents

Hardware encoding cards

Note: This is possible under GNU/Linux only.

VideoLAN supports two kinds of MPEG-2 encoding cards:

  • Hauppauge WinTV-PVR-250 and WinTV-PVR-350,
  • Visiontech Kfir.

The Hauppauge WinTV-PVR-250/350 gives much better results and is cheaper than the Visiontech Kfir.

Stream with the Hauppauge WinTV-PVR-250/350 card

Install the drivers

First, you will have to patch your kernel (version 2.4) to support the v4l2 API (Video 4 Linux version 2). The patch is available on the Video4Linux HQ. If you use a 2.6 kernel, you only need to build I2C support and the BT848 Video For Linux module.

Once your kernel is ready, install the CK version (currently in development) of the Linux drivers for the Hauppauge WinTV-PVR-250/350. They are hosted on ivtv ck. You will need to patch your kernel to use it with a 2.4. You can also use the CVS version available here: ivtv.sourceforge.net (this version is not developped anymore). Then, you will have to create the device and load the modules; for this, please refer to the documentation shipped with the drivers.

Stream with VLC

Note: You must add —enable-pvr to ./configure to use this feature.

  • /dev/video0 is the device corresponding to the encoding card,
  • norm=secam is name of the standard of the analogic signal (possible values are pal, secam, and ntsc),
  • size=720×576 is the size of the video you want to stream,
  • frequency=567250 is the frequency in kHz of the channel you want to stream,
  • bitrate=3000000 is the average bitrate of the stream,
  • maxbitrate=4000000 is the maximum bitrate of the stream,
  • 1000 is a secret value to work around a bug of the card.
  • 192.168.0.42 is either:
    • the IP address of the machine you want to unicast to;
    • or the DNS name the machine you want to unicast to;
    • or a multicast IP address.
  • 12 is the value of the TTL (Time To Live) of your IP packets (which means that the stream will be able to cross 11 routers).

Stream with the Visiontech Kfir card

Install the drivers

If you want to be able to stream from a Visiontech Kfir card, you need to install its Linux drivers. Download the latest release of the drivers from the drivers download page of the [http://www.linuxtv.org/ LinuxTV web site].

Uncompress the tarball and follow the instructions written in the INSTALL file to compile and install the drivers.

Note: If you have a VIA chipset, you need to disable USB in the BIOS.

Stream

  • /dev/video is the device corresponding to the Kfir card,
  • 192.168.0.42 is either :
    • the IP address of the machine you want to unicast to;
    • or the DNS name the machine you want to unicast to;
    • or a multicast IP address.
  • 12 is the value of the TTL (Time To Live) of your IP packets (which means that the stream will be able to cross 11 routers).

Software encoding cards

Under GNU/Linux

Install the Video for Linux drivers

If you want to stream from an acquisition card or a webcam, a video4linux driver must be available for it. You can find more information about video4linux and supported devices here.

Compile the right module for your device, and insert it into your kernel. Some video4linux modules are shipped with the 2.4.x and 2.6.x Linux kernels, the patch is available on the Video4Linux HQ.

You can test your device by using any of the listed programs in the Video: TV and PVR/DVR section of this page.

Note that v4l2 modules will also work with VLC.

Stream with VLC

Note: You must add —enable-v4l to ./configure to use this feature.

Note: You can find all transcode options on this page : Advanced Streaming Using the Command Line.

  • /dev/video is the device corresponding to your acquisition card or your webcam,
  • norm=secam is name of the standard of the analogic signal (possible values are pal, secam, and ntsc),
  • frequency=543250 is the frequency of the channel in kHz (Warning: for VLC Stream with DirectShow (Windows)

Install your peripheral drivers

You need to install your peripherals under Windows with the appropriate drivers. Nothing else is necessary.

Stream unicast/multicast with VLC in command line

Note: You either need to provide the full path to the vlc.exe executable or add its location to the Windows Path variable.

  • -I rc is to activate the remote control interface (MS/DOS console)
  • 12 is the value of the TTL (Time To Live) of your IP packets (which means that the stream will be able to cross 11 routers),
  • vdev=»VGA USB Camera» is the name of the video peripheral that DirectShow will use (this is only an exemple),
  • adev=»USB Camera» is the name of the audio peripheral,
  • size=»640×480″ is the resolution (you can also put the standard size like subqcif (128×96), qsif (160×120), qcif

(176×144), sif (320×240), cif (352×288) or vga (640×480)).

  • 239.255.42.12 is either:
    • the IP address of the machine you want to unicast to;
    • or the DNS name the machine you want to unicast to;
    • or a multicast IP address.

Stream to file(s) with VLC in command line

  • -I rc is to activate the remote control interface (MS/DOS console)
  • dshow://. configures your input capture card / settings
  • #duplicate<> multiple output configurations
  • transcode<> video/audio codec settings
  • std<> output/muxer settings

Mac OSX

Note that VLC does not support streaming from live video or audio sources on Mac OSX.

Источник

Читайте также:  Windows не удается найти системный том который удовлетворяет требованиям для установки
Оцените статью