VLC stream output function

Source: Internet
Author: User

The stream output function can output the streams read by the VLC to a file or send them over the network. The client can use HTTP, RTP, RTSP, and other protocols for access, transcoding, and other operations.

Reference http://wiki.videolan.org/Documentation:Streaming_HowTo

Stream output syntax

% vlc input_stream --sout "#module1{option1=parameter1{parameter-option1},option2=parameter2}:module2{option1=...,option2=...}:..."

You can also use the following syntax

% vlc input_stream --sout-module1-option1=... --sout-module1-option2=... --sout-module2-option1=... --sout-module2-option2=... ...
1. standard module (STD)

Example:
VLC test.mp4-vvv -- loop -- sout "# standard {access = http, MUX = ts, DST = 192.168.9.80: 10086/stream }"
Send files to the network using HTTP protocol, Use TS encapsulation, and Use http: // 192.168.9.80: 10086/stream to access the client

Required for standard
Access, the output protocol. File (save to file), UDP, HTTP, https, and mmsh (using Microsoft's MMS protocol, only HTTP-based MMS protocol is supported)
MUX: Output multipleer. Supports ts, PS, mpeg1, Ogg, ASF, asfh, Avi, and mpjpeg.
DST: Output destination address. If access = file, it is the path and file name of the saved file.

When the command parameters in the preceding example are used for some videos, the VLC receiver can only hear the audio. The error log displayed in the message is as follows:

ts error: MPEG-4 descriptor not foundpacketizer_mpeg4audio info: AAC channels: 2 samplerate: 44100avcodec info: obtained IDirect3DDeviceManager9avcodec info: DXVA2CreateVideoService Success!avcodec error: DxFindVideoServiceConversion failed

However, after MUX = ASF is used, it can be played normally.
VLC test.mp4-vvv -- loop -- sout "# standard {access = http, MUX = ASF, DST = 192.168.9.80: 10086/stream }"
This issue is related to the MP4 file format and is to be resolved.
2. RTP module

Use the RTP protocol to send data. RTSP is also supported.
Example:
1) generate an SDP File

vlc.exe test.mp4 -vvv  --loop --sout "#rtp{dst=192.168.9.80,sdp=file:///E:/stream.sdp}"

Start RTP transmission. This command generates an SDP description file stream. SDP and copies it to the client. You can use VLC to play the video. dst specifies the Client IP address.

2) use RTSP for Transmission

vlc.exe test.mp4 -vvv  --loop --sout "#rtp{sdp=rtsp://192.168.9.80:10086/stream}"

Use rtsp: // 192.168.9.80: 10086/stream to access the client directly.
3. Es Module

The es module can separate different elementary streams from stream and save them as different files or send them to different destination addresses.
Example:

vlc.exe test.mp4 -vvv --no-loop  --sout "#es{access=file, dst-video=e:/video_%d.%c, dst-audio=e:/audio_%d.%c}"

Extract audio and video from the file and save it to the file. -- No-loop indicates no loop, % d indicates the track number of the stream, and % C indicates the encoded fourcc.
4. transcode Module

The transcode module is used for transcoding. It can also complete some additional features such as re-scaling, deinterlacing, resampling, and crop. In addition to audio and video, it can also process subtitles and overlay images to videos.
Supported encoding formats see: http://www.videolan.org/streaming-features.html
Example:
Transcodes audio and video files according to specified parameters and save them as AVI files. The following cascade standard module saves the files.

vlc.exe test.mp4 -vvv --sout "#transcode{vcodec=h264, vb=300, venc=x264, fps=15, width=352, height=288, acodec=mp3, aenc=ffmpeg, samplerate=44100, threads=2}:standard{access=file,mux=avi,dst=e:/test.avi}

Venc: Specifies the video encoder and supports FFMPEG, x264, and theora. You can further specify the detailed Encoding parameters.
Aenc: Specifies the Audio Encoder and supports FFMPEG, Vorbis, and speex.
Threads: Specifies the thread data during encoding and improves the efficiency when multiple cores are used.
5. Duplicate Module

The duplicate module can copy streams for different chains.
Example:

vlc.exe test.mp4 -vvv --sout "#duplicate{dst=standard{access=file,mux=avi,dst=e:/test.avi}, dst=rtp{dst=192.168.9.80,name=stream,sdp=rtsp://192.168.9.80:10086/stream}, dst=display}"

The dumplicate module is used to obtain three outputs, which are saved as *. Avi, sent to RTSP server, and locally displayed.
Dumplicate also has a select option to select the stream to be processed

Other Instructions:
1. By default, VLC only processes the first audio and video stream. You can use the -- sout-all option to process all streams.
2. The options -- no-sout-audio and -- no-sout-video can disable the output of audio or video.
3. For more examples, see http://wiki.videolan.org/Documentation:Streaming_HowTo/Command_Line_Examples

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.