How to add wave file to wmv file
-
Hi, I have the wmv file and a wave file. I want to add the wave file into wmv file. How can we achive this? Regards, Hemant.
-
Hi, I have the wmv file and a wave file. I want to add the wave file into wmv file. How can we achive this? Regards, Hemant.
Like I keep telling you. The Windows Media Format SDK is made for this. It's THE SDK for ASF files, which is what a WMV file is.
-
Hi, I have the wmv file and a wave file. I want to add the wave file into wmv file. How can we achive this? Regards, Hemant.
While I can't write it and post it here, maybe I can point you in the right direction. You'll need to read the video stream(s) (there could be more than one) and write them to to the new file. At the same time you will read PCM samples from the wave file and write them to a new, separate audio stream in the new file. For synchronizing audio and video you'll need to handle the sample time (passed to IWMWriter::WriteSample()) somehow. It's alot of code to post an example here but there is plenty of sample code in the Windows Media Format SDK. The "WMVCopy" sample application is a good place to start. Hope this helps, Mark
-
While I can't write it and post it here, maybe I can point you in the right direction. You'll need to read the video stream(s) (there could be more than one) and write them to to the new file. At the same time you will read PCM samples from the wave file and write them to a new, separate audio stream in the new file. For synchronizing audio and video you'll need to handle the sample time (passed to IWMWriter::WriteSample()) somehow. It's alot of code to post an example here but there is plenty of sample code in the Windows Media Format SDK. The "WMVCopy" sample application is a good place to start. Hope this helps, Mark
Hi, Thanks for your comments!. Now I am using the Windows Media Format SDK for adding the wave file to wmv file. I have written the following code, but it is not allowing to add audio to me. It adds either audio or video and not the both. WHat may be the reason public static void AddAudioVideo() { 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("D:\\wmv\\input\\2006_10_16_13_9_49_759.wav", "", ""); IWMEncVideoSource2 SrcVid = (IWMEncVideoSource2)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO); SrcVid.SetInput("D:\\wmv\\output\\TestOutPut.wmv", "", ""); // Specify a file object in which to save encoded content. IWMEncFile File = Encoder.File; File.LocalFileName = "D:\\wmv\\output\\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; } } // 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. } } /////// } Regards, Hemant.
-
Hi, Thanks for your comments!. Now I am using the Windows Media Format SDK for adding the wave file to wmv file. I have written the following code, but it is not allowing to add audio to me. It adds either audio or video and not the both. WHat may be the reason public static void AddAudioVideo() { 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("D:\\wmv\\input\\2006_10_16_13_9_49_759.wav", "", ""); IWMEncVideoSource2 SrcVid = (IWMEncVideoSource2)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO); SrcVid.SetInput("D:\\wmv\\output\\TestOutPut.wmv", "", ""); // Specify a file object in which to save encoded content. IWMEncFile File = Encoder.File; File.LocalFileName = "D:\\wmv\\output\\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; } } // 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. } } /////// } Regards, Hemant.
What language is that code written in? :) *shrug*
-
What language is that code written in? :) *shrug*
It is written in c#