Encode H.264 with VLC

Version 3.3.2
Oct 9, 2011

1. Introduction

This guide will explain the basic steps to stream live TV over the internet or your local network using Video Lan Client(VLC).


Back to Top

2. Hardware Required

Capture card with TV-in/Video-in.

Back to Top

3. Software Required

VLC, We recommend use VLC 1.1.4 to encode live H.264 streams.

You can download a copy of VLC from http://download.videolan.org/pub/videolan/vlc/1.1.4/

Back to Top

4. VLC Encoding Guide

4.1 Check TV Card

First, you should check whether your TV Card is correctly installed and work with VLC properly.

Encode H.264 with VLC

Open VLC and select "Open Capture Device..." in the "Media" menu. 

Encode H.264 with VLC

Select proper video and audio device in the "Capture device" tab, and click "Play" button. Now if VLC show picture and audio properly, that means your TV card is OK and you can go ahead to publish live stream.

4.2 H.264 Streaming

Encode H.264 with VLC

Open a VLC and select "Streaming" in the "Media" menu.

Encode H.264 with VLC

Select proper video and audio devices. In the "Advanced options...", you can set up some advanced configurations. Now click "Stream" button.

Encode H.264 with VLC

Click "Next" the in popped up window.

Encode H.264 with VLC

In the "Destinations" group, select "HTTP" and click "Add".

Encode H.264 with VLC

Select a available port like "8080".

Encode H.264 with VLC

In the "Transcoding options" group, click the "New Profile" button.

Encode H.264 with VLC

Input a meaningful name in the "Profile Name". In the "Encapsulation" tab, you can choose "MPEG-TS", "MPEG-PS" or "FLV" depends on you favorite. We recommend "MPEG-TS" to publish your live stream. "FLV" is supported by SopCast 3.4.5 and later.

Encode H.264 with VLC
In the "Video code" tab, check the "Video" checkbox and select H-264 codec. Select a proper "Bitrate". Bitrate can be from 400kbps to 2000kbps. It depends on how much is your upload bandwidth. If your upload bandwidth less than 1Mbps, we recommend the bitrate can be 400~500kbps. If your upload bandwidth is more than 10Mbps, you can select a higher bitrate such as 1500kbps.

Encode H.264 with VLC

In the "Audio codec" tab, check the "Audio" checkbox and use MP3 as audio codec. Click "Save" after all parameters are proper configured.

Encode H.264 with VLC

Now in the "Transcoding options" group, you can select the profile you created just now. After clicking "Stream", your stream is published. Now you can watch the stream by VLC or broadcast it over P2P by SopCast client.

4.3 Checking Live Stream

Before broadcasting the stream by SopCast client, we recommend you check the stream whether it is working properly.

Encode H.264 with VLC
Open another instance of VLC, and select "Open Network Stream...".

Encode H.264 with VLC

In the "Network protocol" group, input the stream url address and click "Play" button. If the stream can be played by VLC properly, then you can broadcast it by SopCast client.

5. VLC Encoding in command mode (Advanced)

For advanced user, you also can run VLC encoding in commad mode.

5.1 VLC command line

You can run VLC encoding as following script:


cd C:\Program Files\VideoLAN\VLC\
start vlc.exe -vvv dshow:// :dshow-vdev="Osprey-210 Video Device 1" 
:dshow-adev="Osprey-210 Audio Device 1" :dshow-caching=200 :dshow-size="640x480" :dshow-chroma=YUY2  
:sout=#transcode{venc=x264{keyint=25},vcodec=h264,vb=600,scale=1,fps=25, width=640,height=480
acodec=mp3,ab=128,channels=2,samplerate=48000,audio-sync}:std{access=http,mux=ts,dst=} :sout-keep &

5.2 VLC Input Options

:dshow-vdev, video device name.

:dshow-adev, audio device name.

:dshow-size="640x480", the size of input video.

In "Capture device" interface, when you check "Show more options", the video device name, audio device name and size of the input video will be shown in "Edit Options" textedit area.

5.3 VLC Output Options

keyint=25, keyint is the maximum interval between two "Key" frame in number of frames. for example if keyint=25 and fps=25, encoding will generate one "Key" frame per seconds.

vcodec=h264, the video encapsulation format you want to encode in.

acodec=mp3, the audio encapsulation format you want to encode in.

vb=700, the video bitrate in Kbit/s.

fps=25, frame rate.

ab=128, the audio bitrate in Kbit/s.

dst=, the IP address and port of the machine you are encoding.

width=640, the width of output video.

height=480, the height of output video.

In "Steam Output" interface, you can got most output options in "Generated steam output string" textedit area in "Option Setup" step.

Back to Top

6. Publish the stream with SopServer

1. Open SopPlayer, and log in with the user you registered in SopCast.

2. Click "MyServer" tab.

3. Select "Stream" as the Source, and fill your stream URL in the text box right.

4. Select proper encapsulation in according to your encoding.

5. Fill out other necessary fields, such as channel ID, Program name (optional), usename and password.

6. Click "Start", your channel will be listed on SopCast after 5 minutes.


Back to Top