• How to use VLC as a live stream encoder with Wowza Media Server (MPEG-TS)

    Step by step instructions for using the VLC media player as a live video/audio encoder with Wowza Media Server 2.

    Updated for Wowza Media Server 2.2.0 (22 November 2010)

    Updated for VLC version 1.1.5 (22 November 2010)

    Note: Wowza Media Systems provides these instructions on as "AS-IS" basis. VLC is not a Wowza Media Systems product. If you have problems getting VLC to work properly it is best to contact the VLC through their forums or wiki.

    To get started, install the VideoLAN VLC media player for your platform on the same machine running Wowza Media Server 2. We will be re-streaming the sample file sample.mp4.

    VLC Setup (Windows)

    1. Open a command prompt and change directory to the VLC installation folder. It should be at path similar to:
      Code:
      C:\Program Files\VideoLAN\VLC
    2. Enter the following VLC command which will re-streaming the file sample.mp4 from the [install-dir]/content folder of the Wowza Media Server 2 installation:
      Code:
      vlc -vvv "%WMSAPP_HOME%/content/sample.mp4" --sout "#transcode{venc=x264{keyint=60,profile=baseline,level=3.0,nocabac},vcodec=x264,vb=150,scale=0.5,acodec=mp4a,ab=96,channels=2,samplerate=48000}:rtp{dst=127.0.0.1,port=10000,mux=ts}"


    VLC Setup (OSX)

    1. Open a terminal window
    2. Enter the following VLC command which will re-streaming the file sample.mp4 from the [install-dir]/content folder of the Wowza Media Server 2 installation:
      Code:
      /Applications/VLC.app/Contents/MacOS/VLC "/Library/WowzaMediaServer/content/sample.mp4" --sout="#transcode{venc=x264{keyint=60,profile=baseline,level=3.0,nocabac},vcodec=x264,vb=150,scale=0.5,acodec=mp4a,ab=96,channels=2,samplerate=48000}:rtp{dst=127.0.0.1,port=10000,mux=ts}"


    Next, follow the instructions in the following tutorial article:

    How to publish and play a live stream (MPEG-TS based encoder)




    See Also:
    VideoLan VLC media player
    VideoLan User support
    MeWiki: X264 Settings

    Note: The sample.mp4 file is about 6 minutes long. VLC will stop when it hits the end of this file. So you may have to re-start VLC several times during configuration and testing.

    Note: The above VLC command lines will produce a low bitrate, low complexity, low quality stream that should be playable on most playback devices and systems. The following is a higher quality version just to provide a glimpse of what VLC can do:

    Code:
    Windows:
    vlc -vvv "%WMSAPP_HOME%/content/sample.mp4" --sout "#transcode{venc=x264{keyint=60,profile=main},vcodec=x264,vb=500,scale=1,acodec=mp4a,ab=128,channels=2,samplerate=48000}:rtp{dst=127.0.0.1,port=10000,mux=ts}"
    
    OSX:
    /Applications/VLC.app/Contents/MacOS/VLC "/Library/WowzaMediaServer/content/sample.mp4" --sout="#transcode{venc=x264{keyint=60,profile=main},vcodec=x264,vb=150,scale=0.5,acodec=mp4a,ab=96,channels=2,samplerate=48000}:rtp{dst=127.0.0.1,port=10000,mux=ts}"
    Note: VLC can also be used to transcode a RTSP, native RTP or MPEG-TS stream. Simply change the first argument of each of the command lines (the path to the sample.mp4 file) to the desired source to be transcoded. Here are a few examples:

    Code:
    RTSP/RTP camera:
    vlc -vvv rtsp://192.168.1.22/mycamera --sout "#transcode{venc=x264{keyint=60,profile=baseline,level=3.0,nocabac},vcodec=x264,vb=150,scale=0.5,acodec=mp4a,ab=96,channels=2,samplerate=48000}:rtp{dst=127.0.0.1,port=10000,mux=ts}"
    
    MPEG-TS stream:
    vlc -vvv udp://localhost:1234 --sout "#transcode{venc=x264{keyint=60,profile=baseline,level=3.0,nocabac},vcodec=x264,vb=150,scale=0.5,acodec=mp4a,ab=96,channels=2,samplerate=48000}:rtp{dst=127.0.0.1,port=10000,mux=ts}"
    
    MPEG-TS stream wrapped in RTP:
    vlc -vvv rtp://localhost:1234 --sout "#transcode{venc=x264{keyint=60,profile=baseline,level=3.0,nocabac},vcodec=x264,vb=150,scale=0.5,acodec=mp4a,ab=96,channels=2,samplerate=48000}:rtp{dst=127.0.0.1,port=10000,mux=ts}"
    
    Native RTP stream:
    vlc -vvv unicast.sdp --sout "#transcode{venc=x264{keyint=60,profile=baseline,level=3.0,nocabac},vcodec=x264,vb=150,scale=0.5,acodec=mp4a,ab=96,channels=2,samplerate=48000}:rtp{dst=127.0.0.1,port=10000,mux=ts}"
    Note: If you would like to host VLC on a different machine as the server hosting Wowza Media Server, you can modify any of the command lines above by changing dst=127.0.0.1,port=10000 to the IP address of the server running Wowza Media Server 2 and any destination UDP port. Be sure the specified UDP port is open on any routers or firewalls between the server running VLC and the server running Wowza Server.


    Comments 42 Comments
    1. wrexhamthe11th -
      Is Application name not needed in dst IP? how does it know how to deal with the incoming stream
    1. rrlanham -
      This is the IP of the VLC stream which you start in StreamManager, which is where you specify a Wowza application.

      Richard
    1. techgeek -
      VLC Command line: vlc.exe -vvv -I rc dshow:// :dshow-vdev="Webcam" :dshow-adev="Microphone" :no-dshow-config --sout #transcode{vcodec=h264,vb=800,scale=1,acodec=mp4a, ab=128,channels=2,samplerate=44100}:rtp{dst=[remote_wowza_server_ip_address],port=10000,ttl=10}}}

      Wowza server:
      /conf/appname/Application.xml - snippets of the xml below
      <Streams>
      <StreamType>live</StreamType>
      ...
      <RTP>
      <!-- RTP/Authentication/[type]Methods defined in Authentication.xml. Default setup includes; none, basic, digest -->
      <Authentication>
      <PublishMethod>digest</PublishMethod>
      <PlayMethod>none</PlayMethod>
      </Authentication>
      <AVSyncMethod>senderreport</AVSyncMethod>
      <MaxRTCPWaitTime>12000</MaxRTCPWaitTime>
      <IdleFrequency>75</IdleFrequency>
      <RTSPSessionTimeout>90000</RTSPSessionTimeout>
      <RTSPMaximumPendingWriteBytes>0</RTSPMaximumPendingWriteBytes>
      <RTSPBindIpAddress/>
      <RTSPConnectionIpAddress>0.0.0.0</RTSPConnectionIpAddress>
      <RTSPOriginIpAddress>[IP Address of the RTP source's router]</RTSPOriginIpAddress>

      Where exactly am I supplying the digest authentication for the incoming RTP stream? Can I change the /content/appname.stream file to specify a specific source IP address? [IP Address of the RTP source's router] = the IP address the VLC source would get if logged into whatismyipaddress.com
    1. rrlanham -
      It is not necessary. See this article:
      http://www.wowzamedia.com/forums/con...erver-(MPEG-TS)

      Richard
    1. techgeek -
      I replied to this thread from the article you specified. I'm sorry that this remains unclear and I'm unable to get this working as of yet, it is certainly not for lack of trying.

      When I run the client/live.html test page, I no longer receive errors, but I don't have a video stream either.

      1) Do I need the RTSP specifics in the application.xml? I'd like to make sure that only a specific VLC webcam can stream to the Wowza server. The IP I can test from is different from the source we'll use in production, if I edit the Application.xml do I need to restart the Wowza application or is the change immediate?
      2) Should I change the VLC output to H.264 + AAC (TS) instead of H.264 + AAC (MP4)?
      3) How can I tell from the Wowza server if the stream is even reaching the server? I've been assured TCP 554 and UDP 6970-9999 are open, I'll happily try different UDP ports to make sure firewalls aren't causing trouble.
      4) On Stream Manager, the start receiving stream has a bit of unexpected information. It defaults to appname/_definst_ in the first dialog. Am I simply not pointing to the correct instance of the application? I can't find anything that explains the _definst_ instance, or if it needs to be referenced at all.
    1. rrlanham -
      Yes, configure for rtsp, e.g. Application.xml /RTP /Authentication /PlayMethod = "none"

      Use the StreamNameAlias addon to limit re-streaming in your application:
      http://www.wowzamedia.com/forums/con...e-alias-module

      VLC does not push a stream to Wowza. You have to use StreamManager. When testing, start Wowza in stand alone mode (/bin/startup.bat) and you will see log output in real-time. This is like turning the light on in a dark-room at this stage. Don't worry if you do not understand everything you see, just seeing whether something happens at all is very enlightening, and you can dig in more from there.

      You need to reference an application instance in StreamManager, and it is usually best to leave it as default (_definst_ ). If you change it, that is the application instance that you must use in the client. Whenever you see a connection to Wowza application in rtmp, http or rtsp stream that does not explicitly reference an application instance, it is using "_definst_" implicitly.

      Richard
    1. ajimenez -
      This is so unstable, it's unusable.

      We've had this working for a while now, but VLC has always behaved terribly. In the beginning, it simply crashed after a while transcoding (it'd run for between a few hrs to a few days). I scripted a quick CRON job that would check if VLC was still running, if not restart it, and ran this every minute.
      Now, however, VLC is not crashing anymore (almost), but some streams are randomly stopping, or their sound is disappearing, requiring a VLC restart. I cannot think of any viable way of checking for these errors, and I can therefore not make any CRON script to mend this situation.
      I have been monitoring the resource consumption of VLC - maybe when one or two of the streams stop, the CPU usage would drop? But it doesn't always, so this cannot be used as an indicator either.. This is really getting hairy...

      Any ideas / solutions would be greatly appreciated!

      We were transcoding with Envivio hardware for a while, which was okay-ish, but it's expensive stuff, their support was far from great, and they have some funky license restrictions if you won't pay full price.
      Does anyone know what other transcoding solutions are available?? A list of such solutions would be very useful to us, and probably to many other Wowza users?
    1. rrlanham -
      Just to clarify, you are talking about VLC being unstable. Here are two commercial transcoder options:

      • MComms TV, a commercial stream-to-stream transcoding solution
      http://www.mcommstv.com/products/mcomms-transcode
      • Ripcode, a commercial hardware sol ution with DSPs powering the transcoding
      http://www.ripcode.com/solutions/rtst.php

      Richard
    1. cloudsurfin -
      Thanks for posting these instructions. They work great for video but I'm getting no sound (or anything at all in the wowza silverlight example). I'm using VLC 1.1.7 and wowza 2.2.3.

      Any assistance is humbly requested for my situation. Based on other posts, I'm assuming the sound and silverlight issues are related so I'm addressing sound first.

      Using the exact instructions above I'm transcoding both RTSP from an IP camera and using the Bucky sample.mp4. Obviously there's audio from the original sample.mp4. Viewing codec details in VLC directly from the IP camera stream, it's there too.

      RTSP directly from the camera, VLC shows two streams, one video, one audio: stream 0: H264/MPEG-4 AVC(part10)(h264) / stream 1: audio/MPEG AAC (mp4a), stereo, 32000Hz.

      After either source goes through VLC to wowza and back to my VLC player, there's only one stream listed. Codec Details shows Video/H264=MPEG-4 AVC.... No audio stream. There's no audio using the wowza example flash player nor using an iphone. Video works fine on both and VLC. Nothing works in the silverlight viewer.

      Any idea where audio went? I tried adding the audioIsAligned RTP property per http://www.wowzamedia.com/forums/content.php?37. BTW, if I create a wowza content file with the RTSP address direct to the IP camera, all forms of streaming work and there's audio...so i'm inclined to think wowza's working fine.

      Any quick ideas? Or should I just give up trying with VLC. Thanks in advance!
    1. rrlanham -
      Do you have a link to a stream we can try? Post it here or send to support@wowzamedia.com and include a link to this forum post.

      Richard
    1. -=Djc28=- -
      Hi, I was able to get 1 live stream going using VLC (Windows) and the above instructions. I was wondering how to get multiple streams working using VLC. For my implementation, I would like to have multiple users out in the internet cloud send my Wowza Server VLC streams and be able to grab them and restream them. Is this possible with VLC? What would be the changing variable in the VLC command line that each user would make unique?

      Command I am working off-
      vlc -vvv dshow:// :dshow-vdev="TANDBERG Video" :dshow-adev="Microphone (TANDBERG Audio)" --sout "#transcode{venc=x264{keyint=60,profile=main},vcod ec=x264,vb=500,scale=1,acodec=mp4a,ab=128,channels =2,samplerate=48000}:rtp{dst=[ServerIP],port=10000,mux=ts}"
    1. rrlanham -
      It is port: "port=10000"

      Richarde
    1. dyb-fm -
      How do I send the song name or title of my streaming to vlc?

      I'm say meta data information.
    1. kuldeepiitk -
      Hi All,

      Has anyone tried MComms TV for transcoding the Live stream and publishing to Wowza Media Server? We have tried using vlc, ffmpeg and xuggle version of ffmpeg. None of these solutions is stable. Everytime the stream disconnects after 5 hours or 10 hours or 30 minutes. The error log also doesn't say anything.

      We are looking for a professional solution to ingest Bitgravity HTTP Flv Live stream to Wowza Media Server. Any help would be greatly appreciated.

      Thanks,
      Kuldeep


      Quote Originally Posted by rrlanham View Post
      Just to clarify, you are talking about VLC being unstable. Here are two commercial transcoder options:

      • MComms TV, a commercial stream-to-stream transcoding solution
      http://www.mcommstv.com/products/mcomms-transcode
      • Ripcode, a commercial hardware sol ution with DSPs powering the transcoding
      http://www.ripcode.com/solutions/rtst.php

      Richard
    1. cnfcnf -
      Quote Originally Posted by rrlanham View Post
      Just to clarify, you are talking about VLC being unstable. Here are two commercial transcoder options:

      • MComms TV, a commercial stream-to-stream transcoding solution
      http://www.mcommstv.com/products/mcomms-transcode
      • Ripcode, a commercial hardware sol ution with DSPs powering the transcoding
      http://www.ripcode.com/solutions/rtst.php

      Richard
      Hi Richard,

      I want to capture a live stream, send it to Wowza on the server end where it is recorded with the nDVR.

      1. Will either of these technologies do that? (Can you advise the specific product - Mcomms did not have anything for download)
      2. Also, would Mcomms be doing the transcoding to H264 and would this eliminate the need of using Wowza's transcoding plugin (I'm a bit reluctant to transcode on the server)

      What do you think of Enviveo for the same thing?

      Thank you!
    1. rrlanham -
      They should both work. More here:

      http://www.wowza.com/forums/content.php?27

      Richard
    1. cnfcnf -
      Quote Originally Posted by rrlanham View Post
      They should both work. More here:

      http://www.wowza.com/forums/content.php?27

      Richard
      I was wondering why MainConcept is strangely left out of transcoding options. Don't they provide something that can transcode and transmit to Wowza?
    1. rrlanham -
      MainConcept might be powering either or both of those, I'm not sure.

      Richard
    1. cnfcnf -
      Hi,

      I am trying to consider various encoding options, but I am struggling.

      1. FFMPEG and VLC seem to not be stable.
      2. Wirecast is interesting, but it is not keyframe aligned, so I am not sure how one can do bitrate switching.
      3. Quicktime encoder runs only on the Mac.
      4. Some of the hardware solutions are excruciatingly expensive - we are talking $20K+ per box or more.
      5. Using Viewcast Osprey cards is interesting, but one still needs to buy the encoding software.

      This leaves me with what seems to be the best solution - Vitec MGW Micro Premium. This is not "rack mounted", but it enables encoding of 5 SD channels, generates H264 and costs about $7000. Is this a good option?

      If someone hasn't looked into all this - is what I have observed (points 1 through 7) correct or am I missing something?

      Thanks!
    1. rrlanham -
      FMLE works for key frame aligned multi-bitrate, but there are EULA restrictions. The Wowza 3 Transcoder is ideal because key frame alignment is practically guaranteed, and you only have to send on stream to Wowza.

      Richard