473,698 Members | 2,339 Online
Bytes | Software Development & Data Engineering Community
+ 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 10303
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.c om/downloads/details.aspx?fa milyid=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_Cli ck(...) Handles StartButton.Cli ck

' Quellengruppe der Gruppenauflistu ng hinzufügen.
Dim SrcGrp As IWMEncSourceGro up2 = _
DirectCast( _
m_Encoder.Sourc eGroupCollectio n.Add("SG_1"), _
IWMEncSourceGro up2 _
)

' Hinzufügen einer Video- und einer Audioquelle.
Dim SrcVid As IWMEncVideoSour ce2 = _
DirectCast( _
SrcGrp.AddSourc e(WMENC_SOURCE_ TYPE.WMENC_VIDE O), _
IWMEncVideoSour ce2 _
)
SrcVid.SetInput ("C:\WINDOWS\cl ock.avi")
Dim SrcAud As IWMEncAudioSour ce = _
DirectCast( _
SrcGrp.AddSourc e(WMENC_SOURCE_ TYPE.WMENC_AUDI O), _
IWMEncAudioSour ce _
)
SrcAud.SetInput ("C:\WINDOWS\Me dia\Ee_rev.wav" )

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

' Eigenschaften des Medienobjekts setzen.
With m_Encoder.Displ ayInfo
.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

' Ausgabedateinam en angeben.
m_Encoder.File. LocalFileName = "C:\test.wm v"

' Videoframes um zwei Pixel auf jeder Seite beschneiden.
With SrcVid
.CroppingBottom Margin = 2
.CroppingTopMar gin = 2
.CroppingLeftMa rgin = 2
.CroppingRightM argin = 2
End With

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

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

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

Private Sub Encoder_OnState Change( _
ByVal enumState As WMENC_ENCODER_S TATE _
) Handles m_Encoder.OnSta teChange
Dim s As String
Select Case enumState
Case WMENC_ENCODER_S TATE.WMENC_ENCO DER_END_PREPROC ESS
s = "Vorverarbeitun g beendet."
Case WMENC_ENCODER_S TATE.WMENC_ENCO DER_PAUSED
s = "Unterbroch en."
Case WMENC_ENCODER_S TATE.WMENC_ENCO DER_PAUSING
s = "Unterbrechen.. ."
Case WMENC_ENCODER_S TATE.WMENC_ENCO DER_RUNNING
s = "Läuft..."
Case WMENC_ENCODER_S TATE.WMENC_ENCO DER_STARTING
s = "Startet... "
Me.EncodingProg ressBar.Value = 0
Me.ProgressTime r.Enabled = True
Case WMENC_ENCODER_S TATE.WMENC_ENCO DER_STOPPED
s = "Beendet."
Me.EncodingProg ressBar.Value = 100
Me.ProgressTime r.Enabled = False
Case WMENC_ENCODER_S TATE.WMENC_ENCO DER_STOPPING
s = "Beenden... "
End Select
Me.StatusLabel. Text = s
End Sub

Private Sub ProgressTimer_T ick(...) Handles ProgressTimer.T ick
If m_Encoder.RunSt ate = WMENC_ENCODER_S TATE.WMENC_ENCO DER_RUNNING Then
Dim FileStats As IWMEncFileArchi veStats = _
DirectCast( _
m_Encoder.Stati stics.FileArchi veStats, _
IWMEncFileArchi veStats _
)
Me.EncodingProg ressBar.Value = _
CInt( _
MakeValid( _
FileStats.FileD uration * 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,whi le
executing it gives error like

" No profile is set for the source."

at the line "m_Encoder.Prep areToEncode(tru e);"

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

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

Thanks in advance.

Mamatha

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

" No profile is set for the source."

at the line "m_Encoder.Prep areToEncode(tru e);"


You'll have to replace "Bildschirmvide o/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.c om" <fo***@DotNetMo nster.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
4575
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, but I still get the following error: chpasswd: can't lock password file
2
23811
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 Program is a WebApplication that is written in VB.Net Using ODBC and OLEDB to connect <- (don't blame me, i just took this over) From what i have read so far, the problem is that i need to change
5
2932
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 the name of this is set in machine.config. I was hoping it would be possible to change this in web.config. I got it to work, kind of. Good news is I can change the name in my web.config file. Bad news is that trace.axd still works meaning I can...
2
1975
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 microsoft word application is activiated and open the file. I have the following question: When I instored my image files in my computer, the system assign the default application to files automatically so that whenever I double click any...
2
2391
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 bin\RadControls\v5.3 Under 2.0b2, I had the following setup in my web.config: <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
1
3859
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 user control. If I recompile the exception is no longer thrown, however this is also an issue on the production site (where we want to change resource files without having to deploy a new build). The only ways around this issue I have discovered...
8
2342
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
1925
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 linked css file and when its included in the new file its referencing a css file in the wrong spot. I need to add "../" to the css file reference in Index.php to make it work.
1
1663
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 change the file in any way? (Change the encoding of the actual file as example)
0
1050
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 the Application directory. If the application is called "MyApp.exe", the configuration file is "MyApp.config". Note that this is not the same as "MyApp.exe.config" which is where the .NET-based XML-format configuration normally goes. This...
0
8603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8895
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7725
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2329
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.