Automated Streaming Video

Jacob presents an ASP-based web page that publishes streaming video clips to a streaming video server.


May 01, 2001
URL:http://www.drdobbs.com/web-development/automated-streaming-video/184404607

May01: Automated Streaming Video

Jacob is a corporate MIS manager. He can be reached at [email protected].


Encoding Windows Media Video Files
Using ActiveX Controls to Encode RealNetworks Video Files


In the early days of the Web, analog modems were the prevailing method to connect to the Internet. As a result, web sites mostly served textual content with a small number of graphical elements. This picture is changing gradually. With an increasing number of DSL and cable modem installations, web sites are starting to incorporate bandwidth-intensive content such as high-quality graphics and streaming video into their designs.

Microsoft and RealNetworks dominate the streaming video market. Both vendors offer user-friendly tools to create and publish streaming video files. RealNetworks has a large installed base and is still the leading streaming video vendor. Windows MediaPlayer is the playback solution of choice for Windows users. Although Windows MediaPlayer is available for Solaris and the Macintosh, RealNetworks is the preferred streaming video player on these platforms. In addition, RealNetworks has players for many UNIX derivatives, including Linux.

Although these tools are straightforward to use for single users, organizations face several challenges when publishing video content. First of all, they need to agree on video formats and bit rates for the streaming video files they publish. Second, a process needs to be defined to publish and manage streaming video content. Most importantly, organizations need an easy-to-use tool that enforces this process as well as consistent video formats, and that enables a diverse audience to publish streaming video files.

In this article, I'll present an application that addresses these needs. It is an ASP-based web page that runs on the client side, through which users select size, bit rate, and streaming video formats, as well as the AVI and MPEG files to be encoded. Once the selected AVI or MPEG files are uploaded, a server-side Visual Basic application encodes it into Windows Media and/or RealVideo files, and publishes the resulting streaming video clips to a streaming video server.

Application Overview

Figure 1 illustrates the streaming video publishing workflow. The process expects users to have AVI/MPEG files, which they create using video capture hardware and software (such as that from Pinnacle Systems, http://www.pinnaclesys.com/). Figure 2 shows the web page VidUpload.asp, which is used for selecting formats and uploading raw video files.

The selection of the proper format is crucial and depends on the target audience. To offer a good viewing experience for both broadband and modem users, the following streaming video formats should be created:

The server-side encoding application creates multibit rate files whenever possible. While the Windows Media Encoder will create multibit rate files automatically, RealVideo requires you to explicitly specify the SureStream option. SureStream is RealNetworks's term for a multibit rate streaming video file. As you can see in Figure 1, the Video Upload web page lets you select encoding in RealVideo, Windows Media, or both streaming video formats. This selection is crucial because there is a licensing difference between the two streaming video applications. While Microsoft Windows Media is part of Windows 2000 Server and, therefore, free, RealNetworks charges a fee for each simultaneous connection.

Listing One is VidUpload.asp, a simple ASP page that displays the form elements of Figure 1, which lets users define the bit rates and formats of the video file(s) to be uploaded. We use the ASPUpload COM component to perform the HTML upload chore. We take advantage of the XUpload ActiveX control, which works hand-in-hand with the server-side ASPUpload component. XUpload makes the HTML upload a more user-friendly experience by providing features such as an accurate progress bar. Both ASPUpload and XUpload are available at http://www.persits.com/.

On submitting VidUpload.asp, VidUploadSubmit.asp is executed, which triggers multiple events. First, the selected video file is uploaded to the web server. Second, we create an entry for the uploaded AVI/MPEG clip into the database table tblVideo (see Table 1). The new database entry holds all relevant information about the uploaded video clip such as the selected bit rates and formats.

Listing Two, VidUploadSubmit.asp, starts with setting the script timeout to 3000 seconds to make sure that file uploads over a slow modem connection aren't terminated prematurely. After setting the maximum file size to 10 MB, we write the file name, description, and file size to local variables. VidUploadSubmit.asp then determines the streaming video formats that need to be generated. The sample application supports the following streaming video file sizes: 160X120, 240X180, and 320X240, respectively. The required formats for each file size are determined and stored in three local variables: s160x120, s240x180, and s320x240. The value of each of these variables has the format WIDTHxHEIGHT_BITRATE1_BITRATE2_BITRATE3. For instance, if users specify that the uploaded video clip should be available as a 28.8-Kbps and 56-Kbps stream at 160X120, and as a 100 Kbps and 256-Kbps stream at 240X180, the values for the local variables would be:

In addition to size and bit rate, VidUploadSubmit.asp determines if RealVideo and/or Windows Media formats should be generated. sFormat can have the following values:

VidUploadSubmit.asp submits file name, description, file size, a member ID, and the various formats to tblVideo, which is part of a relational Access or SQL server database, as in Table 1.

The EncodingStatus field in tblVideo has a key function, because it handles the handshake between the encoding application, Video Upload page, and playback web page. As long as EncodingStatus is 0, the file will not be available for playback. On the other hand, EncodingStatus 0 informs the server-side encoding application that a new file was uploaded, and needs to be encoded. Once the encoding process is finished, the encoding application sets the EncodingStatus equal to 1, which makes the streaming video file available for viewing.

The Windows Media SDK

Microsoft provides six major components in its Windows Media SDK to develop streaming audio/video applications:

Detailed information as well as the actual SDKs are available at http://www.microsoft.com/windowsmedia/.

The server-side Visual Basic encoding application uses the Windows Media Encoder API to encode AVI/MPEG clips into streaming Windows Media files. To programmatically encode video files, the application needs to perform a series of steps described in the text box "Encoding Windows Media Video Files."

The RealVideo ActiveX Control

Like Microsoft, RealNetworks provides SDKs, which are available at http://www.realnetworks.com/. In addition to the SDK, RealNetworks offers an ActiveX control for encoding that drastically simplifies application development. The RealProducer ActiveX Control lets you automate the functionality provided by the RealNetworks RealProducer application. For our application, I will use the ActiveX control to encode AVI/MPEG files into RealVideo files. See the accompanying text box entitled "Using ActiveX Controls to Encode RealNetworks Video Files."

The Encoding Application

Figure 3 is a flowchart of the server-side encoding application. Figure 4 shows the encoding application in action. The encoding occurs in a Visual Basic Timer function, which is called every two seconds. blnTimer1 ensures that only one file is encoded at one time. We first check if a previous encoding session failed, and try to encode it until we succeed or reach the maximum number of errors allowed. We then look for newly uploaded files by checking if EncodingStatus equals 0.

The actual encoding process starts by copying the uploaded AVI/MPEG file to the encoding server. Depending on the selected formats and bit rates, we create the requested Windows Media and RealVideo files and copy them to a streaming video server. We then activate the clips for viewing by setting the field Active in tblEncodedVideo to 1. Last, we delete files that are no longer needed, including the initially uploaded AVI/MPEG file. Before we exit Timer1, we set blnTimer1 to False, allowing another encoding session to start. The complete application — including source code, database script, and Windows Media Profiles — is available electronically; see "Resource Center," page 5.

Application Deployment

To install the application, you need to perform the following steps:

1. Create a web site to host VidUpload.asp, VidUploadSubmit.asp, and XUpload.ocx. Install ASPUpload on this web server, and create the c:\VidUploads directory. Both ASPUpload.asp and XUpload.ocx are at http://www.persits.com/.

2. Create the SQL server database videoDB by running videoDB.sql in SQL server 7.0 Query Analyzer. Create the database user video and make it the owner of the videoDB database.

3. On the encoding server, install Windows Media Encoder and copy the profiles (available electronically) into the Profile directory of Windows Media Encoder. Also, install the RealNetworks RealProducer application and the RealProducer ActiveX control on the encoding server. Both are available at http:// www.realnetworks.com/.

4. On the encoding server, copy encoder.cfg to c:\, and create the directory c:\Encoding. Copy small.jpg and still.jpg into the c:\Encoding directory.

5. Copy the encoding application to the Encoding server.

6. Setup a video folder on a Windows 2000 streaming video server, which is shared by both Windows Media Server and RealNetworks Server. This folder contains the encoded Windows Media and RealVideo clips. The location of this video folder will need to be configured in the encoding application.

7. Start the encoding application on the encoding server and click on Configure to configure the video upload location, streaming video location, encoding and encoding log directory, the database connection string, as well as the error retry property and time interval between retries.

Conclusion

The SDKs and tools provided by Microsoft and RealNetworks let you develop a fully automated streaming video encoding application so that users can submit AVI/MPEG files. The application publishes the submitted clips and encodes them to the requested streaming video formats.

DDJ

Listing One

<SCRIPT LANGUAGE="VBScript"> 
Sub Select_OnClick 
  UploadCtl.Select 
End Sub 
Sub Remove_OnClick 
  UploadCtl.RemoveHighlighted 
End Sub 
Sub Upload_OnClick
  UploadCtl.Upload 
End Sub 
Sub goUpload
    timerID = setTimeOut("UploadCtl.Upload",100)
    UploadCtl.Select 
End Sub

<
/SCRIPT> 
<HTML>
<HEAD>
<TITLE>Upload and Encode your Video Files</TITLE>
</HEAD>
<BODY bgcolor="White" Language="vbscript" OnLoad="goUpload">
<table width="400" border="1" cellspacing="0" cellpadding="10">
<tr bgcolor="#eeeeee"><td align="center">
<h2><font color="Black">Upload and Encode your Video Files</font></h2>
<FORM NAME="frmInfo">
<table border="1">
<tr bgcolor="Black"><td>
    <table>
    <tr>
    <td width="120"  align="center"><b><font color="White">Size</font></b></td>
    <td width="100" align="right"><b><font color="White">Bitrate</font></b></td>
    </tr>
	</table>
</td></tr>
<tr bgcolor="White"><td>
    <table>
    <tr><td width="120" align="center">160x120</td>
    <td align="right" width="100">
	    28.8 kbps<br>
	    56 kbps<br>
	    100 kbps
    </td>
	<td align="left" width="80">
	    <input type="checkbox" name="160x120x28"><br>
	    <input type="checkbox" name="160x120x56"><br>
	    <input type="checkbox" name="160x120x100"><br>
	</td>
    </tr>
    </table>
</td></tr>

<
tr bgcolor="White"><td>
    <table>
    <tr><td width="120" align="center">240x180</td>
    <td align="right" width="100">
	    56 kbps<br>
		100 kbps<br>
		256 kbps
    </td>
    <td align="left" width="80">
	    <input type="checkbox" name="240x180x56"><br>
	    <input type="checkbox" name="240x180x100"><br>
	    <input type="checkbox" name="240x180x256">
	</td>
    </tr>
    </table>
</td></tr>

<
tr bgcolor="White"><td>
    <table>
    <tr><td width="120" align="center">320x240</td>
    <td align="right" width="100">
	     56 kbps<br> 
	    100 kbps<br>
	    256 kbps
    </td>
	<td align="left" width="80">
	    <input type="checkbox" name="320x240x56"><br>
	    <input type="checkbox" name="320x240x100"><br>
	    <input type="checkbox" name="320x240x256">
	</td>
    </tr>
    </table>
</td></tr>

<
tr bgcolor="White"><td>
    <table>
    <tr><td width="120" align="Right">Windows Media</td>
        <td align="Left"> <input type="checkbox" name="WindowsMedia">
    </td>
	</tr>
    <tr><td width="120" align="Right">Real Video</td>
        <td align="Left"> <input type="checkbox" name="RealVideo">
    </td>
	</tr>
    </table>
</td></tr>
</table>
<br>
   <font color="6666FF"><b>Short Description:</b></font><br>
   <input type=text id="sDescription" name="sDescription" size="60" value=""><br>
</FORM>
<OBJECT WIDTH=500 HEIGHT=50
	ID="UploadCtl" 
	CLASSID="CLSID:E87F6C8E-16C0-11D3-BEF7-009027438003"
	CODEBASE="XUpload.ocx">
<PARAM NAME="Server" VALUE="www.mystudionline.com">
<PARAM NAME="Script" VALUE="/qa/VidUploadSubmit.asp">
<PARAM NAME="ViewServerReply" VALUE="False">
<PARAM NAME="EnablePopupMenu" VALUE="False"> 
<PARAM NAME="ShowProgress" VALUE="True">
<PARAM NAME="MaxFileCount" VALUE="1">
<PARAM NAME="Redirect" VALUE="True"> 
<PARAM NAME="RedirectURL" VALUE="VidUpload.asp"> 
<PARAM NAME="HtmlForm" VALUE="frmInfo">
<% If strFileName <> "" Then %>
<PARAM NAME="File1" VALUE="<%=strFileName%>"> 
<% End If %>
</OBJECT>
<P> 
<INPUT TYPE=BUTTON NAME="SELECT" VALUE="Browse">  
<INPUT TYPE=BUTTON NAME="REMOVE" VALUE="Remove">    
<INPUT TYPE=BUTTON NAME="UPLOAD" VALUE="Upload"> 
</td></tr>
</table>
</BODY>
</HTML>

Back to Article

Listing Two

<%@ Language=VBScript %>
<!--#include file="adovbs.inc"-->
<% 
Dim viMemberID, vCount, vFileName, sFileDesc, sFileSize, oConn, strSQL, rsVideo


'For this sample page, we set the Member ID to 1.
viMemberID = 1


'Determines the value of Set160x120Profile
'------------------------------------------
Function Set160x120Profile(s160x120x28, s160x120x56, s160x120x100)
   Set160x120Profile = ""
   If (s160x120x28="on") AND NOT (s160x120x56="on") AND NOT (s160x120x100="on") Then
      Set160x120Profile = "160x120x28"
	  Exit Function
   End If
   If NOT (s160x120x28="on") AND (s160x120x56="on") AND NOT (s160x120x100="on") Then
      Set160x120Profile = "160x120x56"
	  Exit Function
   End If
   If NOT (s160x120x28="on") AND NOT (s160x120x56="on") AND (s160x120x100="on") Then
      Set160x120Profile = "160x120x100"
	  Exit Function
   End If
   If (s160x120x28="on") AND (s160x120x56="on") AND NOT (s160x120x100="on") Then
      Set160x120Profile = "160x120x28_56"
	  Exit Function
   End If
   If (s160x120x28="on") AND NOT (s160x120x56="on") AND (s160x120x100="on") Then
      Set160x120Profile = "160x120x28_100"
	  Exit Function
   End If
   If NOT (s160x120x28="on") AND (s160x120x56="on") AND (s160x120x100="on") Then
      Set160x120Profile = "160x120x56_100"
	  Exit Function
   End If
   If (s160x120x28="on") AND (s160x120x56="on") AND (s160x120x100="on") Then
      Set160x120Profile = "160x120x28_56_100"
	  Exit Function
   End If
End Function
'Determines the value of Set240x180Profile
'------------------------------------------
Function Set240x180Profile(s240x180x56, s240x180x100,s240x180x256)
   Set240x180Profile = ""
   If (s240x180x56="on") AND NOT (s240x180x100="on") AND NOT (s240x180x256="on") Then
      Set240x180Profile = "240x180x56"
	  Exit Function
   End If
   If NOT (s240x180x56="on") AND (s240x180x100="on") AND NOT (s240x180x256="on") Then
      Set240x180Profile = "240x180x100"
	  Exit Function
   End If
   If NOT (s240x180x56="on") AND NOT (s240x180x100="on") AND (s240x180x256="on") Then
      Set240x180Profile = "240x180x256"
	  Exit Function
   End If
   If  (s240x180x56="on") AND (s240x180x100="on") AND NOT (s240x180x256="on") Then
      Set240x180Profile = "240x180x56_100"
	  Exit Function
   End If
   If  (s240x180x56="on") AND NOT (s240x180x100="on") AND (s240x180x256="on") Then
      Set240x180Profile = "240x180x56_256"
	  Exit Function
   End If
   If  NOT (s240x180x56="on") AND (s240x180x100="on") AND (s240x180x256="on") Then
      Set240x180Profile = "240x180x100_256"
	  Exit Function
   End If
   If  (s240x180x56="on") AND (s240x180x100="on") AND (s240x180x25="on") Then
      Set240x180Profile = "240x180x56_100_256"
	  Exit Function
   End If 
End Function


'Determines the value of Set320x240Profile
'------------------------------------------
Function Set320x240Profile(s320x240x56, s320x240x100, s320x240x256)
   Set320x240Profile = ""
   If (s320x240x56="on") AND NOT (s320x240x100="on") AND NOT (s320x240x256="on") Then
      Set320x240Profile = "320x240x56"
	  Exit Function
   End If
   If NOT (s320x240x56="on") AND (s320x240x100="on") AND NOT (s320x240x256="on") Then
      Set320x240Profile = "320x240x100"
	  Exit Function
   End If
   If NOT (s320x240x56="on") AND NOT (s320x240x100="on") AND (s320x240x256="on") Then
      Set320x240Profile = "320x240x256"
	  Exit Function
   End If
   If (s320x240x56="on") AND (s320x240x100="on") AND NOT (s320x240x256="on") Then
      Set320x240Profile = "320x240x56_100"
	  Exit Function
   End If
    If (s320x240x56="on") AND NOT (s320x240x100="on") AND (s320x240x256="on") Then
      Set320x240Profile = "320x240x56_256"
	  Exit Function
   End If  
   If NOT (s320x240x56="on") AND (s320x240x100="on") AND (s320x240x256="on") Then
      Set320x240Profile = "320x240x100_256"
	  Exit Function
   End If  
   If (s320x240x56="on") AND (s320x240x100="on") AND (s320x240x256="on") Then
      Set320x240Profile = "320x240x56_100_256"
	  Exit Function
   End If 
End Function

'Determines the requested Streaming Video formats:
'  1: WindowsMedia Only
'  2: RealVideo Only
'  3: Both WindowsMedia and RealVideo
'-------------------------------------------------
Function SetFormat(sWindowsMedia, sRealVideo)
   SetFormat = 3
   If (sWindowsMedia="on") AND NOT (sRealVideo="on") Then
      SetFormat = 1
	  Exit Function
   End If
   If NOT (sWindowsMedia="on") AND (sRealVideo="on") Then
      SetFormat = 2
	  Exit Function
   End If
   If (sWindowsMedia="on") AND (sRealVideo="on") Then
      SetFormat = 3
	  Exit Function
   End If
End Function

'Set script timeout to 3000 seconds
Server.ScriptTimeout = 3000

'ASPUpload code
'---------------
Set vUpload = Server.CreateObject("Persits.Upload.1")
vUpload.OverwriteFiles = False    ' Generate unique filenames
vUpload.SetMaxSize 10040000, True ' Reject files above 10 Megabyte
vCount = vUpload.Save( Application("UploadPath") )
For each file in vUpload.Files
	vFileName = File.ExtractFileName
	sFileSize = File.Size
Next
sFileDesc = vUpload.Form("sDescription")


'Determine requested Streaming Video file formats
'------------------------------------------------
s160x120 = Set160x120Profile(vUpload.Form("160x120x28"),vUpload.Form("160x120x56"),vUpload.Form("160x120x100"))
s240x180 = Set240x180Profile(vUpload.Form("240x180x56"),vUpload.Form("240x180x100"),vUpload.Form("240x180x256"))
s320x240 = Set320x240Profile(vUpload.Form("320x240x56"),vUpload.Form("320x240x100"),vUpload.Form("320x240x256"))
sFormat  = SetFormat(vUpload.Form("WindowsMedia"),vUpload.Form("RealVideo"))
	
'Update tblVideo
'---------------
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open(application("CONNECTIONSTRING"))
strSQL = "select * from tblVideo Where ID = -1"
Set rsVideo = oConn.execute(strSQL)
rsVideo.AddNew
rsVideo("FileName") = cstr(vFileName)
rsVideo("Description") = cstr(sFileDesc)
rsVideo("FileSize") = sFileSize
rsVideo("MemberID") = viMemberID
rsVideo("[160x120]") = s160x120
rsVideo("[240x180]") = s240x180
rsVideo("[320x240]") = s320x240
rsVideo("Format") = sFormat
rsVideo("EncodingStatus") = 0
rsVideo("Active") = 0
rsVideo.Update
rsVideo.Close
Set rsVideo = Nothing	
oConn.Close
Set oConn = Nothing
Set vUpload = Nothing
%> 

Back to Article

May01: Automated Streaming Video

Figure 1: Automatic video encoding process overview.

May01: Automated Streaming Video

Figure 2: Video Upload web page.

May01: Automated Streaming Video

Figure 3: Encoding application flowchart.

May01: Automated Streaming Video

Figure 4: Encoding application in action.

May01: Encoding Windows Media Video Files

Encoding Windows Media Video Files

The steps required to encode Windows Media files are:

1. A WMEncoder object needs to be instantiated.

'Create a WMEncoder object

Dim encoder As WMEncoder

Set encoder = New WMEncoder

2. A Source Group has to be created. A Source Group holds the synchronized multimedia streams being encoded. It must contain an audio stream, and can contain a video stream and a script stream.

'Add a new source group to the source group collection

Dim SrcGrpColl As IWMEncSourceGroupCollection

Dim SrcGrp As IWMEncSourceGroup

Set SrcGrpCol = encoder.SourceGroup Collection

Set SrcGrp = SrcGrpCol.Add("SG_1")

3. Create an IWMEncSource object for each type of multimedia content in the source group. The IWMEncSource interface is used to either load streams from a file or capture streams from a device. Use the IWMEncSourceGroup interface to add streams to a source group.

'Create a video and an audio source object.

Set AudSrc = SrcGrp.AddSource(WMENC_AUDIO)

Set VidSrc = SrcGrp.AddSource(WMENC_VIDEO)

'Specify the .avi source file.

AudSrc.SetInput "C:\UserTemp\clip4.avi"

VidSrc.SetInput "C:\UserTemp\clip4.avi"

4. Select a profile for the encoding session. A profile specifies a codec, and identifies the number and bit rates of the encoded output streams. Only one profile can be assigned to all of the source groups in the encoding session.

'Iterating through all Windows Media Profiles on your System and setting the 'one you want

Dim ProColl As IWMEncProfileCollection

Dim Pro As IWMEncProfile

Set ProColl = encoder.ProfileCollection

For i = 0 To ProColl.Count - 1

Set Pro = ProColl.Item(i)

If Pro.Name = "Test01" Then

SrcGrp.Profile = Pro

Print "Profile: " & Pro.Name & vbCrLf

Exit For

End If

Next

5. Specify an output option; in this case, the name of the encoded Windows Media file.

'Specify the Output Windows Media File

Dim File As IWMEncFile

Set File = Encoder.File

File.LocalFileName = "C:\filename.wmv"

6. Before starting the actual encoding process, set some crucial parameters.

'Setting some crucial parameters.

Encoder.EnableAutoArchive = True

Encoder.AutoStop = True

Encoder.RemoteAdmin = True

Encoder.EnableAutoArchive = True

Encoder.PrepareToEncode True

7. Finally, start the Windows Media Encoder and stop the Encoder once it is finished. While the video clip is encoded, check on the RunState property of the Encoder object and call the Visual Basic DoEvents statement as long as RunState is not WMENC_ENCODER_STOPPED. DoEvents gives Windows a chance to do other chores while a clip is encoded.

'Start the encoder engine.

Encoder.Start

'Statistics Object required to determine if Encoding is finished

Dim Statistics As IWMEncStatistics

Dim IndexerStats As IWMEncIndexerStats

Set Statistics = encoder.Statistics

Set IndexerStats = Statistics.IndexerStats

'Loop until the Encoding process is finished.

While Encoder.RunState <> WMENC_ENCODER_STOPPED Do Events

Wend

While IndexerStats.FileCount <> 0

DoEvents

Wend

'Stop the encoder engine.

Encoder.Stop

Encoder.PrepareToEncode False

The server-side Visual Basic Application uses the described sequence to create Windows Media Video (WMV) files. Since WindowsMedia 7, Microsoft no longer uses the .ASF extension to describe WindowsMedia files, but uses the .WMV and .WMA (Windows Media Audio) extensions. As far as WindowsMedia Profiles is concerned, use the Microsoft WindowsMedia Encoder application to create the Profiles the encoding application expects. The encoding application requires profiles to comply with the following naming convention: SIZExHEIGHT_BITRATE1_BITRATE2_BITRATEX. For instance, 160X120_56_100 describes a profile that generates a WindowsMedia video clip that has a screen-size of 160X120, and contains a 56 Kbps and 100 Kbps stream. To generate a 320X240 file that contains a single 300 Kbps stream, the original video needs to be encoded with the profile 320X240_300.

— J.G.

May01: Using ActiveX Controls to Encode RealNetworks Video Files

Using ActiveX Controls to Encode RealNetworks Video Files

To encode a video file using the ActiveX control, you need to define the input and output file name, as well as the width and height of the encoded clip.

RealProducer.InputFilename = "file.avi" 'Input file name

RealProducer.OutputFilename = "file.rm" 'Output file name

RealProducer.VideoOutputWidth = "240" 'Width'

RealProducer.VideoOutputHeight = "180" 'Height'

You then need to specify what bit rates should be encoded. If the SureStream option is set to True, the RealProducer ActiveX control creates one large file that contains all the bit rates that were specified.

RealProducer.Target28KModem = True '28Kmodem bit rate

RealProducer.Target56KModem = True '56Kmodem bit rate

RealProducer.TargetDualISDN = True 'DualISDN bit rate

RealProducer.Target256KDSLCableModem = True '256K bit rate

RealProducer.SureStream = True 'SureStream enabled

After you start the encoding, check if the IsEncoding property is True and call the VisualBasic DoEvent routine to give the OS a chance to service other requests. Once the IsEncoding property changes to False, stop the encoding process.

RealProducer.StartEncoding

While RealProducer.IsEncoding = True And EncError = 0

DoEvents

Wend

RealProducer.StopEncoding

Unlike Microsoft WindowsMedia Encoder (which encodes according to a selected profile), the RealProducer ActiveX control lets you define the bit rates you want to generate by setting the appropriate Target bit rate property.

— J.G.

May01: Automated Streaming Video

Table 1: tblVideo.

Terms of Service | Privacy Statement | Copyright © 2024 UBM Tech, All rights reserved.