473,473 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How can i change AVI file into wmv file in C#?

Hi

I have an application in C#.net,my application displays
the video file.The file is in AVI format,now i want to
change this AVI file into wmv file.How can i do this?
Is it possible?Please give me any releated websites or any
source code etc.
If you know the solution please let meknow
Thanks in advance.


Mamatha
Nov 21 '05 #1
6 10289
Mamatha,

Probably a mistake, however you posted this to a VBNet newsgroup.

Cor
Nov 21 '05 #2
"Mamatha" <ma***********@yahoo.com> schrieb:
I have an application in C#.net,my application displays
the video file.The file is in AVI format,now i want to
change this AVI file into wmv file.How can i do this?
Is it possible?Please give me any releated websites or any
source code etc.


Windows Media Downloads - Windows Media Encoder 9 Series SDK
<URL:http://www.microsoft.com/downloads/details.aspx?familyid=000a16f5-d62b-4303-bb22-f0c0861be25b>

Sample:

\\\
Imports WMEncoderLib
..
..
..

' Erstellen des Encoders.
Private WithEvents m_Encoder As New WMEncoder()

' Gesamtdauer der zu codierenden Daten.
Private m_TotalDuration As Double

Private Sub StartButton_Click(...) Handles StartButton.Click

' Quellengruppe der Gruppenauflistung hinzufügen.
Dim SrcGrp As IWMEncSourceGroup2 = _
DirectCast( _
m_Encoder.SourceGroupCollection.Add("SG_1"), _
IWMEncSourceGroup2 _
)

' Hinzufügen einer Video- und einer Audioquelle.
Dim SrcVid As IWMEncVideoSource2 = _
DirectCast( _
SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO), _
IWMEncVideoSource2 _
)
SrcVid.SetInput("C:\WINDOWS\clock.avi")
Dim SrcAud As IWMEncAudioSource = _
DirectCast( _
SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO), _
IWMEncAudioSource _
)
SrcAud.SetInput("C:\WINDOWS\Media\Ee_rev.wav")

' Profil für Audio/Video anhand des Namens wählen ("scmeda.prx").
Const ProfileName As String = _
"Bildschirmvideo/Audio mit mittlerer Bitrate (CBR)"
For Each Profile As IWMEncProfile In m_Encoder.ProfileCollection
If Profile.Name = ProfileName Then
SrcGrp.Profile = Profile
Exit For
End If
Next Profile

' Eigenschaften des Medienobjekts setzen.
With m_Encoder.DisplayInfo
.Author = "John Doe"
.Copyright = _
"Copyright © 2005 John Doe Media Corporation. " & _
"All rights reserved."
.Description = "An animated clock with sound"
.Rating = "Great video."
.Title = "The Animated Clock"
End With

' Ausgabedateinamen angeben.
m_Encoder.File.LocalFileName = "C:\test.wmv"

' Videoframes um zwei Pixel auf jeder Seite beschneiden.
With SrcVid
.CroppingBottomMargin = 2
.CroppingTopMargin = 2
.CroppingLeftMargin = 2
.CroppingRightMargin = 2
End With

' Encoder vorbereiten. Dies muss vor der Berechnung Längen der
' Datenquellen geschehen.
m_Encoder.PrepareToEncode(True)

m_TotalDuration = _
Math.Max(SrcVid.Duration, SrcAud.Duration) / 1000

' Start the encoding process.
m_Encoder.Start()
End Sub

Private Sub Encoder_OnStateChange( _
ByVal enumState As WMENC_ENCODER_STATE _
) Handles m_Encoder.OnStateChange
Dim s As String
Select Case enumState
Case WMENC_ENCODER_STATE.WMENC_ENCODER_END_PREPROCESS
s = "Vorverarbeitung beendet."
Case WMENC_ENCODER_STATE.WMENC_ENCODER_PAUSED
s = "Unterbrochen."
Case WMENC_ENCODER_STATE.WMENC_ENCODER_PAUSING
s = "Unterbrechen..."
Case WMENC_ENCODER_STATE.WMENC_ENCODER_RUNNING
s = "Läuft..."
Case WMENC_ENCODER_STATE.WMENC_ENCODER_STARTING
s = "Startet..."
Me.EncodingProgressBar.Value = 0
Me.ProgressTimer.Enabled = True
Case WMENC_ENCODER_STATE.WMENC_ENCODER_STOPPED
s = "Beendet."
Me.EncodingProgressBar.Value = 100
Me.ProgressTimer.Enabled = False
Case WMENC_ENCODER_STATE.WMENC_ENCODER_STOPPING
s = "Beenden..."
End Select
Me.StatusLabel.Text = s
End Sub

Private Sub ProgressTimer_Tick(...) Handles ProgressTimer.Tick
If m_Encoder.RunState = WMENC_ENCODER_STATE.WMENC_ENCODER_RUNNING Then
Dim FileStats As IWMEncFileArchiveStats = _
DirectCast( _
m_Encoder.Statistics.FileArchiveStats, _
IWMEncFileArchiveStats _
)
Me.EncodingProgressBar.Value = _
CInt( _
MakeValid( _
FileStats.FileDuration * 10 / m_TotalDuration * 100, _
0, _
100 _
) _
)
End If
End Sub
///

BTW: This is a VB.NET group!

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
Hi

Thanks

I converted your code into C#.NET and executed the application,while
executing it gives error like

" No profile is set for the source."

at the line "m_Encoder.PrepareToEncode(true);"

Please give me any suggetions,this is very urgent need for me.

If possible please mail to me,my mail ID is ma***********@yahoo.com

Thanks in advance.

Mamatha

--
Message posted via http://www.dotnetmonster.com
Nov 21 '05 #4
"Mamatha k via DotNetMonster.com" <fo***@DotNetMonster.com> schrieb:
I converted your code into C#.NET and executed the application,while
executing it gives error like

" No profile is set for the source."

at the line "m_Encoder.PrepareToEncode(true);"


You'll have to replace "Bildschirmvideo/Audio mit mittlerer Bitrate (CBR)"
with the name of the profile that should be used. Profile files have the
extension ".prx".

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5
Hi

In my system,i have so many prx files.
I have this "scmeda.prx" file also.
But,how can i know this prx file is for this application?
Please suggest the way.

Thanks
Mamatha

--
Message posted via http://www.dotnetmonster.com
Nov 21 '05 #6
"Mamatha k via DotNetMonster.com" <fo***@DotNetMonster.com> schrieb:
In my system,i have so many prx files.
I have this "scmeda.prx" file also.
But,how can i know this prx file is for this application?
Please suggest the way.


You can doubleclick the PRX file in Windows explorer to check the profile
and get its name. Depending on what you want to archieve you may either
want to use one of the existing PRX files or create your own profile.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Max | last post by:
Hi, What is the best way to change passwords via php? I was first thinking of using the chpasswd function, but even though I added an entry for apache to be able to run chpassword vi visudo,...
2
by: Sami | last post by:
I keep getting the famous 'Too Many Connection' Error, and don't know how to change my variables, so they persist even if i have to restart mysql service. Platform: Windows 2003 Server My...
5
by: who be dat? | last post by:
Hello all. I'm writing an application that is writing trace information that can be viewed in trace.axd. I would like to rename this and use a different name specific to my application. I know...
2
by: david | last post by:
When you right click on a file in windows, there is a property of type of file, which seems to associate this file with an application for it. For example, when you double click on a .doc file, the...
2
by: Joel D Kraft | last post by:
I'm using controls in my ASP.NET application from a couple of vendors. Between the vendors and thier versioning, I've set up subfolders under my bin directory: bin bin\Infragistics\v5.2...
1
by: Dom | last post by:
I get an InvalidOperationException with the message "The resource class for this page was not found. Please check if the resource file exists and try again." when I change the resource file of a...
8
by: miladhatam | last post by:
can i change the size of a file dynamically ? for example have 100 Kb and i want to decrease it to 20 Kb thanks
27
by: Jon Slaughter | last post by:
Can I modify code that I have included using <?php include("../Index.php"); ?> The Index.php file contains links that need to be modified to work. Index.php is basically an html file uses a...
1
by: PSiegmann | last post by:
Hello group, if I open with streamreader a file to read in that way: StreamReader sr = new StreamReader(c:\\test.txt, System.Text.Encoding.GetEncoding(10000)); Is it possible that it can...
0
by: Michael Bray | last post by:
I've found a change in SP1 that doesn't seem to make sense to me, but seems to be there nonetheless. The situation is this... I have an application that stores it's configuration in a file in...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.