472,334 Members | 2,512 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,334 software developers and data experts.

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 10230
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...
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...
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...
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...
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...
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...
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...
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,...
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...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

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.