C# "This Mediatype is not valid"

1

I try to create a video from a picture and a MP3 with splicer. With some audio files, I do not have any problems, but for some reasons, I get "This Mediatype is not valid.".

Here is my code, maybe you can help me

CreateVideo(@"C:\save_in_here\test.wmv", @"C:\pic\1.jpg", @"C:\mus\1.mp3");

. . .

 public void CreateVideo(string videoToCreate, string imageLoc, string tuneLoc)
    {
        if (videoToCreate.Equals(""))
        {
            MessageBox.Show("Error");
        }
        else
        {
            using (ITimeline timeline = new DefaultTimeline())
            {
                IGroup group = timeline.AddVideoGroup(32, 720, 576);
                ITrack videoTrack = group.AddTrack();
                IClip clip = videoTrack.AddImage(imageLoc, 0, 120);

                // add some audio
                ITrack audioTrack = timeline.AddAudioGroup().AddTrack();
                    IClip audio = audioTrack.AddAudio(tuneLoc, 0, 120); // ERROR?!

                // create an audio envelope effect, this will:
                // fade the audio from 0% to 100% in 1 second.
                // play at full volume until 1 second before the end of the track
                // fade back out to 0% volume
                audioTrack.AddEffect(0, 120, StandardEffects.CreateAudioEnvelope(1.0, 1.0, 1.0, 120));

                // render our slideshow out to a windows media file
                using (WindowsMediaRenderer renderer = new WindowsMediaRenderer(timeline, videoToCreate, WindowsMediaProfiles.HighQualityVideo))
                //using (AviFileRenderer renderer= new AviFileRenderer(timeline,videoToCreate))
                {
                    renderer.Render();
                }
            }
        }
    }

by the way: I integrated the dll and linked it.

System.Runtime.InteropServices.COMException (0x80040200): Es wurde ein ungültiger Medientyp angegeben.
   bei DirectShowLib.DES.DESError.ThrowExceptionForHR(Int32 hr)
   bei Splicer.Utilities.MediaInspector.GetLength(String fileName)
   bei Splicer.Timeline.MediaFile..ctor(String fileName, Boolean manageLifespan)
   bei Splicer.Timeline.Track.AddClip(String name, String fileName, GroupMediaType mediaType, InsertPosition position, Double offset, Double clipStart, Double clipEnd, Boolean manageLifespan)
   bei Splicer.Timeline.Track.AddClip(String name, String fileName, GroupMediaType mediaType, InsertPosition position, Double offset, Double clipStart, Double clipEnd)
   bei Splicer.Timeline.Track.AddClip(String fileName, GroupMediaType mediaType, InsertPosition position, Double offset, Double clipStart, Double clipEnd)
   bei Splicer.Timeline.Track.AddAudio(String fileName, Double offset, Double clipEnd)
   bei uMusic.lib.Helper.CreateVideo(String videoToCreate, String imageLoc, String tuneLoc) in C:\Users\Moe\Documents\Visual Studio 2010\Projects\WindowsFormsApplication5\WindowsFormsApplication5\lib\Helper.cs:Zeile 135.

That is the full Exception-Error I get.

c#
media
asked on Stack Overflow Oct 4, 2012 by Klaus Dieter • edited Dec 6, 2013 by Charles

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0