public void SetFileAsOutput(string szFileName)
 {
     try
     {
         m_encFile = m_encoder.File;
         m_encFile.LocalFileName = szFileName;
     }
     catch (Exception exp)
     {
         WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Video Recordong Module ===>Screen Capture.cs line==> 175", exp, "Error Setting Audio File: " + exp.Message.ToString(), true);
         //Trace.WriteLine(exp.ToString()+"---"+exp.Message+"---"+exp.Source+exp.StackTrace+"---"+exp.TargetSite+"---"+exp.InnerException);
         //WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Error setting file" + exp.ToString());
     }
 }
        private void SetOutputFileName(string BaseFileName)
        {
            IWMEncFile File     = m_Encoder.File;
            string     FilePath = m_CurrentInfo.FilePath;

            switch (m_CurrentProfile)
            {
            case EncodingProfileEnum.LOW:
                File.LocalFileName = FilePath + BaseFileName + ".wmv";
                break;

            case EncodingProfileEnum.HIGH:
                File.LocalFileName = FilePath + BaseFileName + "_high.wmv";
                break;

            case EncodingProfileEnum.LOSSLESS:
                File.LocalFileName = FilePath + BaseFileName + "_ll.wmv";
                break;
            }
        }
Exemple #3
0
    static void Main()
    {
        try
        {
            // Create a WMEncoder object.
            WMEncoder Encoder = new WMEncoder();

            // Retrieve the source group collection.
            IWMEncSourceGroupCollection SrcGrpColl = Encoder.SourceGroupCollection;

            // Add a source group to the collection.
            IWMEncSourceGroup SrcGrp = SrcGrpColl.Add("SG_1");

            // Add a video and audio source to the source group.
            IWMEncSource SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
            SrcAud.SetInput("C:\\Inputfile.mpg", "", "");

            IWMEncVideoSource2 SrcVid = (IWMEncVideoSource2)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
            SrcVid.SetInput("C:\\Inputfile.mpg", "", "");

            // Crop 2 pixels from each edge of the video image.
            SrcVid.CroppingBottomMargin = 2;
            SrcVid.CroppingTopMargin    = 2;
            SrcVid.CroppingLeftMargin   = 2;
            SrcVid.CroppingRightMargin  = 2;

            // Specify a file object in which to save encoded content.
            IWMEncFile File = Encoder.File;
            File.LocalFileName = "C:\\OutputFile.wmv";

            // Choose a profile from the collection.
            IWMEncProfileCollection ProColl = Encoder.ProfileCollection;
            IWMEncProfile           Pro;
            for (int i = 0; i < ProColl.Count; i++)
            {
                Pro = ProColl.Item(i);
                if (Pro.Name == "Windows Media Video 8 for Local Area Network (384 Kbps)")
                {
                    SrcGrp.set_Profile(Pro);
                    break;
                }
            }

            // Fill in the description object members.
            IWMEncDisplayInfo Descr = Encoder.DisplayInfo;
            Descr.Author      = "Author name";
            Descr.Copyright   = "Copyright information";
            Descr.Description = "Text description of encoded content";
            Descr.Rating      = "Rating information";
            Descr.Title       = "Title of encoded content";

            // Add an attribute to the collection.
            IWMEncAttributes Attr = Encoder.Attributes;
            Attr.Add("URL", "IP address");

            // Start the encoding process.
            // Wait until the encoding process stops before exiting the application.
            Encoder.PrepareToEncode(true);
            Encoder.Start();
            Console.WriteLine("Press Enter when the file has been encoded.");
            Console.ReadLine();     // Press Enter after the file has been encoded.
        }
        catch (Exception e)
        {
            // TODO: Handle exceptions.
        }
    }
Exemple #4
0
 public void SetFileAsOutput(string szFileName)
 {
     try
     {
         m_encFile = m_encoder.File;
         m_encFile.LocalFileName =szFileName;
     }
     catch(Exception exp)
     {
         WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Video Recordong Module ===>Screen Capture.cs line==> 175",exp,"Error Setting Audio File: " + exp.Message.ToString(),true);
         //Trace.WriteLine(exp.ToString()+"---"+exp.Message+"---"+exp.Source+exp.StackTrace+"---"+exp.TargetSite+"---"+exp.InnerException);
         //WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Error setting file" + exp.ToString());
     }
 }
Exemple #5
0
        //To Start the Recording.
        private void startRecordingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IWMEncProfile SelProfile;
            IWMEncSource  AudioSrc;

            try
            {
                if (DesktopEncoder != null)
                {
                    if (DesktopEncoder.RunState == WMENC_ENCODER_STATE.WMENC_ENCODER_PAUSED)
                    {
                        DesktopEncoder.Start();
                        return;
                    }
                }
                DesktopEncoderAppln = new WMEncoderApp();
                DesktopEncoder      = DesktopEncoderAppln.Encoder;
                IWMEncSourceGroupCollection SrcGroupCollection = DesktopEncoder.SourceGroupCollection;
                IWMEncSourceGroup           SrcGroup           = SrcGroupCollection.Add("SG_1");
                IWMEncVideoSource2          VideoSrc           = (IWMEncVideoSource2)SrcGroup.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
                //Set Audio Source.
                if (addAudio.Checked)
                {
                    AudioSrc = SrcGroup.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
                    if (txtAudioFile.Text.Trim() != "")
                    {
                        if (File.Exists(txtAudioFile.Text.Trim()))
                        {
                            AudioSrc.SetInput(txtAudioFile.Text.Trim(), "", "");
                        }
                        else
                        {
                            AudioSrc.SetInput("Default_Audio_Device", "Device", "");
                        }
                    }
                    else
                    {
                        AudioSrc.SetInput("Default_Audio_Device", "Device", "");
                    }
                }
                //Set Video Source:Desktop.
                VideoSrc.SetInput("ScreenCapture1", "ScreenCap", "");
                IWMEncProfileCollection ProfileCollection = DesktopEncoder.ProfileCollection;
                ProfileCollection = DesktopEncoder.ProfileCollection;
                int lLength = ProfileCollection.Count;
                //Set Profile.
                if (toolstripEnableBroadcast.Checked && txtPortNbr.Text.Trim() != "")
                {
                    IWMEncBroadcast broadcast = DesktopEncoder.Broadcast;
                    broadcast.set_PortNumber(WMENC_BROADCAST_PROTOCOL.WMENC_PROTOCOL_HTTP, Convert.ToInt32(txtPortNbr.Text.Trim()));
                    for (int i = 0; i <= lLength - 1; i++)
                    {
                        SelProfile = ProfileCollection.Item(i);
                        if (SelProfile.Name == "Windows Media Video 8 for Local Area Network (768 Kbps)")
                        {
                            SrcGroup.set_Profile((IWMEncProfile)SelProfile);
                            break;
                        }
                    }
                }
                else
                {
                    for (int i = 0; i <= lLength - 1; i++)
                    {
                        SelProfile = ProfileCollection.Item(i);
                        if (SelProfile.Name == "Screen Video/Audio High (CBR)")
                        {
                            SrcGroup.set_Profile((IWMEncProfile)SelProfile);
                            break;
                        }
                    }
                }
                //Local File to Store Recording temporarily.
                IWMEncFile inputFile = DesktopEncoder.File;
                inputFile.LocalFileName = "C:\\TempRecording.wmv";
                DesktopEncoder.PrepareToEncode(true);
                DesktopEncoder.Start();
                tmrRcCounter.Enabled = true;
                recordStarttime      = DateTime.Now;
                if (toolstripEnableBroadcast.Checked && txtPortNbr.Text.Trim() != "")
                {
                    //Start Timer to Count Viewers connected to Broadcast.
                    tmrViewerCount.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }