web analytics

Streaming Movies to Justin.TV via VLC

Recently I tested streaming a movie to Justin.TV via wirecast and this worked very well indeed, the quality was as good as watching it local and it played without breaking up, lagging or anything like that. There is a few issues with using Wirecast though, the first is the fact it can only play certain file types (mostly MP4) and second, you have to babysit the process to swap movies. After some searching, I came across JTVLC - this can stream content from VLC which in turn can use a playlist.

Setting up VLC

The first task is rather simple, you open VLC, goto View on the menu and select Playlist. Another Window will open up with a blank playlist. It is now a simple case of dragging and dropping the required movie’s to form a playlist. Now back on the main VLC Window – Media, Save Playlist to a File. At this stage (on Windows) maybe make a folder called JTV to store all the files. You can now close VLC.

JTVLC

If you head off to the main JTVLC web page, there is download for Linux, Windows and OSX. Save the zip file and expand the contents into the JTV folder from earlier. We need to get the streaming key for this to work, so head off to justin.tv, click GO LIVE and now half way down is more streaming options click on other on the top left.

The Section under Flash Media Encoder has Config file, save this for now and we can open it to find the right streaming key. Edit the jtv.500k.4.3.xml file (with say notepad) in somewhere in there you should see <Stream>live_xxxx</stream), the part between the words <stream> is your streaming key, do not share this at any cost with the general public.

You now need to make a BAT file (Windows) which will start jtvlc, inside this you need to write:

@echo off
“C:\JustinTV\jtvlc\jtvlc.exe” username streamkey C:\jtv\vlc.sdp

The user name of course is the name of your channel and the stream key as we discussed earlier.

BAT file to start VLC

I am using VLC / JTVLC as packaged by ixnay74 http://www.computer-house.net/ix

This is by far the best way to do it in that it works for the most part at least. Create a BAT file and put one of the following lines in:

rem this works if your video files are of different sizes
“C:\Program Files (x86)\VideoLAN\VLC\vlc.exe” –extraintf http “C:\JustinTV\Playlist.xspf” –sout-keep –loop –sout=”#gather:transcode{venc=x264{keyint=24,idrint=2,cabac=0,bframes=0},vcodec=h264,vb=800,acodec=mp3,ab=128,channels=2,samplerate=48000,audio-sync,deinterlace{deinterlace=linear},threads=2,sfilter=’marq{marquee=$N,color=11319054,position=9,size=16}:marq{marquee=$L/$D,color=11319054,position=10,size=16}’,vfilter=canvas{width=640,height=360,aspect=16:9}}:duplicate{dst=rtp{dst=127.0.0.1,port=1234,sdp=file:///C:/jtv/vlc.sdp}}

or

rem this works if all your video files are identical in size but requires MP4a Audio
“C:\Program Files (x86)\VideoLAN\VLC\vlc.exe” –extraintf http “C:\JustinTV\Playlist.xspf” –sout-keep –loop –sout=”#gather:transcode{venc=x264{keyint=128,idrint=2,cabac=0,bframes=0},vcodec=h264,vb=800,acodec=mp4a,ab=128,channels=2,samplerate=48000,audio-sync,deinterlace{deinterlace=linear},threads=2,sfilter=’marq{marquee=$N,color=11319054,position=9,size=16}:marq{marquee=$L/$D,color=11319054,position=10,size=16}’,vfilter=canvas{width=640,height=360,aspect=16:9}}:duplicate{dst=rtp{dst=127.0.0.1,port=1234,mux=ts,sdp=file:///C:/jtv/vlc.sdp}}

I used the top one myself and it seemed to work.

What is it doing?

The process works like this, VLC Streams the movie to a file on your drive, jtvlc takes that content and streams it to JustinTV. You can open up the SADP file in VLC and yoou can see what it looks like before streaming. A few key facts about the BAT file above though, the size (width=640,height=360,aspect=16:9) and the bitrate (vb=800) are the key to quality.

Problems Encountered

I have tested this across various machines, the end result varies from No Audio, blockly video, lagging and so forth. The number one issue though was when it jumps to the next movie, all that is shown on Justin.TV is a black screen. If you restart JTVLC batch file – it streams again, so this to me is not a fully workable solution.

If anyone has managed to conquer this – feel free to message me in one shape or fashion or just leave a comment below.

Update From  ixnay74

The Author of the Batch files was kind enough to email me with some suggestions:

Two things should be altered in the VLC command line, the first being remove the –sout-keep  second add mux=tx towards the end.  See this example:

“C:\JustinTV\VLC\vlc.exe” “C:\JustinTV\playlistname.xspf” –loop –sout=”#gather:transcode{venc=x264{keyint=24,idrint=2,cabac=0,bframes=0},vcodec=h264,vb=800,acodec=mp3,ab=128,channels=2,samplerate=48000,audio-sync,threads=2,sfilter=’marq{marquee=$N,color=11319054,position=9,size=16}:marq{marquee=$L/$D,color=11319054,position=10,size=16}’,vfilter=canvas{width=640,height=360,aspect=16:9}}:duplicate{dst=rtp{dst=127.0.0.1,port=1234,mux=ts,sdp=file:///C:/JustinTV/vlc.sdp}}

With those changes I was able to stream files of different resolutions & filetypes while maintaining the stream, no need to reload jtvlc…

Also A Suggestion to use the VLC in the package not the latest as this may cause issues.

Share

Comments are closed.

Download mp3