Stream to Shoutcast + Flash Player + Video + VLC = Working!

About encoding, codec settings, muxers and filter usage
kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby kdh » 16 Jun 2009 23:14

I have things working, but I thought I would change this first post in the thread to be more of a How-To instead of making people read my entire thread as that is not fair. I thought it would be a good idea to just start at the top. =)

Before I start.. I got all my information from the following locations:

The VLC Forums: http://forum.videolan.org/ *Remember, the search function is your friend!*
The VLC Wiki Page: http://wiki.videolan.org/Main_Page
The VLC Wiki Command line Page: http://wiki.videolan.org/VLC_command-line_help

Here is some back ground.

I co-run a website that uses Shoutcast for streaming our user uploaded content, and to allow our DJs to do live audio only shows.

We wanted to expand the idea, and allow our live DJs to use Web Cams to stream an audio and video feed to our servers, then restream the audio back out to our shoutcast server, and stream the audio and video to a flash based player. The idea of using a simple webcam and a cheap internet connection to continue to connect with our listener bases sounded really exciting.

When our DJs were not live, we'd like to stream our prerecorded content playing via our shoutcast server back over to our flash based player. The idea behind it was; lots of people don't like shout cast, but everyone can use flash. So why not?

Before I go any further.. You need to know something about Windows, Linux, ShoutCast and VLC. I'm giving you all the information you need in this post. All the commands except for the Windows side of things are all handle with scripts run via cron or perl on my server side.

Here is my setup:

Server side im running Cenos5, VLC.0.9.9a Grishenko

Phase One: Allow my Flash based Video player to connect to my shoutcast server and stream my prerecorded audio only content.

vlc http://mywebsite.com:8666 --sout-mux-caching 1000 --sout "#transcode{vcodec=FLV1,acodec=mp3,vb=32
,ab=64,width=328,height=200}:std{access=http,dst=mywebsite.com:8081/stream.flv}" --daemon

I use JW player embeded in my webpage to view my stream.. you can find JW player here: http://www.longtailvideo.com/ <-- just mod the example it comes with to make it work with the above information.Please note, I plan on switching to the VLC webplug in in the very near future. =)

The only issue with this is my video player just displays a black screen, but you atleast hear the audio. I'm working on slaving in a video input, but I can't get it to work right. When I do, i'll up date this post.

Phase Two: Allow my Live DJs to stream Audio and Video using VLC client on the windows based machine. My live DJs mostly use Windows, and they could be located in a club, a house, apartment.. where ever. These steps would work for MAC vlc, but I haven't tested it.

Here are the steps I have them use:
Install VLC 1.0.1 For Windows.

1. Get into VLC
2. Click On Media
3. Click on Streaming
4. Click on Capture Device
5. Select your webcam from the Video Device
6. Select you Line-In Input for your audio device.
7. Click Stream
8. Click Next
9. Click Next
10. In the Large Box that says "Generated Stream output string" Paste the command below into it.

:sout=#transcode{vcodec=h264,vb=160,fps=24,height=250,width=300,acodec=mp3,ab=96,channels=2,samplerate=44100,audio-sync,venc=x264{keyint=15,vbv-maxrate=80k,vbv-bufsize=128k,qcomp=0.8,qpmin=10,qpmax=41}}:std{access=udp,mux=ts,dst=mywebsite.com:8777} --daemon

11. Click stream
12. The VLC window will go small and will become a small box.
13. In the left corner, it should say "Streaming", and over to the right it should be counting up.

At this point, linux server side, I start VLC into listen mode.

This command listens for my Windows Based DJs live incoming stream, and then turns it around so my other VLC services can manipulate it.

cvlc udp://@:8777 --sout-mux-caching 45000 --sout '#standard{access=http,mux=ts,dst=127.0.0.1:9070}' --daemon

This command connects back to port 127.0.0.1:9070 and turns that stream into something a Shout Cast Server will understand:

cvlc http://127.0.0.1:9070 --no-sout-video --sout '#transcode{acodec=mp3, ab=96, channels=2, samplerate=44100, aenc=ffmpeg}:std{access=shout{mp3=1,bitrate=96, samplerate=44100, channels=2,name='Mywebsite.com',genre='dnb'}, mux=raw, dst=admin:mypasswordhere@mywebsite.com:8666//}' --daemon "

*Note* Port 8666 is the listening port of my shoutcast server.

You *need* that --no-sout-video.. other wise vlc will send the video part of the stream over to the Shoutcast server. if you do that, the out going stream from shoutcast will be all garbled.

In this command, I connect back to 127.0.0.1:9070 and turn it into something that a Flash Based Video player can understand and stream to my website.

vlc --freetype-font=/usr/share/vlc/skins2/fonts/FreeSans.ttf --sub-filter=marq --marq-size=20 --marq-position=9 --marq-marquee="Live: $showname" http://localhost:9070 --sout-mux-caching 45000 --sout-ffmpeg-qmin=10 --sout-ffmpeg-rc-buffer-size=20000 --sout-ffmpeg-qmax=30 --sout-ffmpeg-qscale=1 --sout-ffmpeg-luma-elim-threshold=-4 --sout-ffmpeg-chroma-elim-threshold=7 --sout "#transcode{vcodec=FLV1,acodec=mp3,vb=100,ab=64,sfilter=marq}:std{access=http,mux=ffmpeg{mux=flv},dst=everydayjunglist.org:8081/stream.flv}" --daemon

If you noticed the DJ's incoming VB rate is 160, and the mp3 rate is 96k. In the above example, I resample the VB rate down to 100, and the Audio to 64k. I do this to save bandwidth. The output still looks and sounds really good.

My Live DJs wanted a way to do server side recordings, again I use VLC.

In this command, I connect back to 127.0.0.1:9070 and turn it into something that a Flash Based Video player can understand and save the in coming audio and video to file.

vlc --freetype-font=/usr/share/vlc/skins2/fonts/FreeSans.ttf --sub-filter=marq --marq-size=20 --marq-position=9 --marq-marquee="Prerecorded: $showname" http://localhost:9070 --sout-mux-caching 45000 --sout-ffmpeg-qmin=10 --sout-ffmpeg-rc-buffer-size=20000 --sout-ffmpeg-qmax=30 --sout-ffmpeg-qscale=1 --sout-ffmpeg-luma-elim-threshold=-4 --sout-ffmpeg-chroma-elim-threshold=7 --sout "#transcode{vcodec=FLV1,acodec=mp3,vb=160,ab=96,sfilter=marq}:std{access=file,mux=ffmpeg{mux=flv},dst=./myrecording.flv --daemon

If you noticed in this command, I don't do anything special with the incoming rates, I save them at the incoming VB and audio size.

Here is an example from this morning of the end results. Not bad huh? http://radio.everydayjunglist.org/recor ... 9.2009.flv <-- do a right click and save as to get it to your desktop.

In this command, I connect back to my shoutcast server and turn it into something that an MP3 based media player can understand.

vlc http://mywebsite.com:8666 --no-sout-video --sout-mux-caching 1000 --sout "#transcode{acodec=mp3,ab=96,channels=2,samplerate=44100}:std{access=file,mux=raw,dst=./myrecording.mp3 --daemon "

If you'd like to see all of this in action, please see my website. http://www.everydayjunglist.org

You can see the video stuff in action here: http://www.everydayjunglist.org/edjtv.v2.html

If there is no video in the video link, then it is an audio only stream. =)

my profile can be found here: http://www.everydayjunglist.org/kdh

Last Update: 9/9/2009
Last edited by kdh on 18 Nov 2009 02:12, edited 4 times in total.

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Streaming to Shoutcast server from a UDP connection + Flash

Postby kdh » 17 Jun 2009 23:05

old out dated information. no need to add confustion.
Last edited by kdh on 09 Sep 2009 19:58, edited 1 time in total.

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Streaming to Shoutcast server from a UDP connection + Flash

Postby kdh » 18 Jun 2009 01:37

old out dated information. no need to add confustion.
Last edited by kdh on 09 Sep 2009 19:58, edited 1 time in total.

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Streaming to Shoutcast server from a UDP connection + Flash

Postby kdh » 18 Jun 2009 03:00

old out dated information. no need to add confustion.
Last edited by kdh on 10 Sep 2009 20:48, edited 1 time in total.

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Streaming to Shoutcast server from a UDP connection + Flash

Postby kdh » 18 Jun 2009 03:23

old out dated information. no need to add confustion.
Last edited by kdh on 09 Sep 2009 19:58, edited 1 time in total.

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby kdh » 18 Jun 2009 07:23

old out dated information. no need to add confustion.
Last edited by kdh on 09 Sep 2009 19:58, edited 1 time in total.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby Jean-Baptiste Kempf » 18 Jun 2009 08:53

Congratz!
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby kdh » 18 Jun 2009 19:42

thanks!

How can I tell how many people are currently connected to my Flash Capable output by IP address?

The only way I could tell someone was using the player was by doing a netstat -a and seeing people connected to my port?

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby kdh » 21 Jun 2009 00:04

Bump,

Whats the easiest way to see how many clients I have connected to a single VLC output?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby Jean-Baptiste Kempf » 21 Jun 2009 14:58

netstat?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby kdh » 21 Jun 2009 22:37

thats kinda what of i'm thinking.

the reason why i ask, is I do geocoding on our website and plot out all my listeners via google maps. lets us know who and what countries are tuning into us!

thanks!

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby kdh » 30 Jun 2009 06:22

We are doing a LIVE DEMO..

Check it out!!

http://www.everydayjunglist.org/edjtv.v2.html

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby kdh » 18 Jul 2009 07:58

netstat?

I am using a tool called "ss"

just doing an

ss -a | grep -c 8081

8081 is the port of my flash player and the grep -c gives me a count of current connections with ip address. hope that helps.

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby kdh » 18 Jul 2009 07:58

old out dated information. no need to add confustion.
Last edited by kdh on 09 Sep 2009 19:59, edited 1 time in total.

goodmax
New Cone
New Cone
Posts: 2
Joined: 25 Jul 2009 14:57

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby goodmax » 25 Jul 2009 15:01

by kdh on Tue Jun 30, 2009 7:22 am
We are doing a LIVE DEMO..

Check it out!!

http://www.everydayjunglist.org/edjtv.v2.html
Hello kdh,

I'm trying to accomplish same thing as you. Could you get it working ?

Btw i can't watch video on the link you supplied, there is only audio.

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby kdh » 29 Jul 2009 03:31

old out dated information. no need to add confustion.
Last edited by kdh on 09 Sep 2009 19:59, edited 1 time in total.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby Jean-Baptiste Kempf » 30 Jul 2009 13:46

Nice howto. Can you post it on the wiki?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby kdh » 31 Jul 2009 04:47

We are doing a live show with video! Check it out!

http://www.everydayjunglist.org/edjtv.v2.html

video looks crappy cause its a crappy webcam..

As for the how-to? Sure how do I go about doing it?

goodmax
New Cone
New Cone
Posts: 2
Joined: 25 Jul 2009 14:57

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby goodmax » 01 Aug 2009 16:50

I get very crappy video output with you settings even with vb=400.
I'm using my TV card as source and default resolution is 352x288. kdh Did you do any tweaking over vlc or ffmpeg/ffshow configuration to get it work properly ? There seems to be tons of options on both vlc and ffmpeg. If use vb=800 it eats too much bandwidth.

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby kdh » 06 Aug 2009 05:14

I get very crappy video output with you settings even with vb=400.
I'm using my TV card as source and default resolution is 352x288. kdh Did you do any tweaking over vlc or ffmpeg/ffshow configuration to get it work properly ? There seems to be tons of options on both vlc and ffmpeg. If use vb=800 it eats too much bandwidth.
Really it all depends on what you are doing and what you are willing to settle for. For us, it works well. I posted my info as a basic guide and as I update stuff, I post it here to make it better. I haven't mucked with the ffmeg/ffshow settings other then whats posted above. I seem to hit a level, with it for a few weeks, then muck with it again down the road. I noticed if I change my FPS rate to 30, and bump up my vb to something like 300 it looks much better, but then I start smashing my bandwidth limit.

You gotta understand, I'm trying to stream my video source and my shoutcast source to atleast 30+ something concurrent connections. Being djs, we'd rather have the audio sound better over the video. At the settings I'm currently running 20 something video users rolls in at around 2meg per second constant speeds. thank god im hosted out of a read data center. :lol:

feel free to use what i've posted as a framework, tweak it around and if you can get better results, please post them here. it'd really help the over all community.

best of luck.

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby kdh » 11 Aug 2009 03:03

old out dated information. no need to add confustion.
Last edited by kdh on 09 Sep 2009 19:59, edited 1 time in total.

ILEoo
Developer
Developer
Posts: 91
Joined: 05 Nov 2008 16:29

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby ILEoo » 11 Aug 2009 13:55

when streaming, you should try adding lower keyint value to x264, eg

Code: Select all

venc=x264{keyint=30}
that should help on that flash syncing issue on wait also.

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby kdh » 11 Aug 2009 22:07

That should go on the client side right?

Where would the venc=x264{keyinit=30} in my string? Something like this?

:sout=#transcode{vcodec=h264,vb=100,fps=30,scale=0.5,acodec=mp3,ab=96,channels=2,samplerate=44100,venc=x264{keyint=30}}:std{access=udp,mux=ts,dst=mywebsite.com:8777}

ILEoo
Developer
Developer
Posts: 91
Joined: 05 Nov 2008 16:29

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby ILEoo » 12 Aug 2009 13:36

That should go on the client side right?

Where would the venc=x264{keyinit=30} in my string? Something like this?

:sout=#transcode{vcodec=h264,vb=100,fps=30,scale=0.5,acodec=mp3,ab=96,channels=2,samplerate=44100,venc=x264{keyint=30}}:std{access=udp,mux=ts,dst=mywebsite.com:8777}
yes, like that. Also I think it's better to use width/height instead of scale (but thats pretty small issue).

kdh
Cone that earned his stripes
Cone that earned his stripes
Posts: 224
Joined: 16 Jun 2009 22:38

Re: Stream to Shoutcast + Flash Player + Video + VLC = Working!

Postby kdh » 12 Aug 2009 22:30

OK, I will test this tonight.

I noticed I've had to really bump up my --sout-mux-caching levels on the server side. If I do a vlc -vvv with my command, the output tells me something about waiting for SPS or something and takes a really long time for it to sync up, but it does.

I'm not sure if that makes sense. But I'll post the output to what I'm talking about later.

thanks for the help!


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 20 guests