Jump to content

WMEncoder + AutoIt = Live streaming


x42x4b
 Share

Recommended Posts

Hi,

I'm in the middle of creating some simple app to chat over net. Due to I didn't found solution on the forum I posting some code, maybe someone would be looking for it.

0. Webcam

1. Install Windows Media Encoder 9 Series and SDK.

2. Make sure that WMEncEng.dll is registered (if no just run: RegSvr32 "C:\Program Files\Windows Media Components\Encoder\WMEncEng.dll")

3. ^C, ^V the code

4. Run it

5. Open WMPlayer with URL: http://localhost:8010

Dim $WMENC_VIDEO = 2
Dim $WMENC_AUDIO = 1
Dim $WMENC_PROTOCOL_HTTP = 1

$object = ObjCreate("WMEncEng.WMEncoder")
if @error then  
    msgbox(0, "Error", "Couldn't create object! Exiting...")
else
    $SrcGrpColl = $object.SourceGroupCollection
    $SrcGrp = $SrcGrpColl.Add("SG_1")
    $SrcVid = $SrcGrp.AddSource($WMENC_VIDEO)
    $SrcAud = $SrcGrp.AddSource($WMENC_AUDIO)

    $SrcVid.SetInput("DEVICE://Default_Video_Device")
    $SrcAud.SetInput("DEVICE://Default_Audio_Device")


    $ProColl = $object.ProfileCollection
    $lLength = $ProColl.Count
    For $i = 0 To $lLength - 1
        $Pro = $ProColl.Item($i)
        If $Pro.Name = "Windows Media Video 8 for Local Area Network (384 Kbps)" Then
            $SrcGrp.Profile = $Pro
            Exitloop
        EndIf
    Next

    $Broadcast = $object.Broadcast
    $Broadcast.PortNumber($WMENC_PROTOCOL_HTTP) = 8010
    $object.Start
    while 1
        sleep(100)
    WEnd

    $object.Stop
wEnd

TIP: There is a lot of samples in VB, try google some. Now it is just to write local proxy and push traffic across some server to bypass firewalls.

BTW: delay of displaying stream is caused by WMPlayer settings.

BTW2: looks really nice on WM6 :)

cheers!

1. RTFM | /dev/LOL2. RTFS | /dev/OMG3. FGI | /dev/WTF4. /dev/BBQ :)

Link to comment
Share on other sites

interesting, we use WME to stream mofo fm, i just have a script that opens it and loads the stream settings file and starts the encoding, but will have to look at this, looks cool. could be a possible way for me to add streaming to the radio automation software. thx 4 sharing.

Edited by cyanidemonkey

My AutoIt Scripts.- AutoHost and Password Enabler for Delta Force 2 Demo.| Caffine for Winamp 2.9x and WRS 2.0 | mp3 directory cleaner | CRAP DJ | A:B:J Radio Automation Software | FFMPEG batch conversion automator

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...