Error adding image files to the video track?

Mar 19, 2012 at 7:56 PM
Edited Mar 19, 2012 at 8:01 PM

I have the following code, mostly from code_sample1 with some debugging statements.  It is intended to add .jpgs, which are screenshots that were previously saved to a relative path (filenames are stored in videoFrameNames) to a video file in a slideshow.  

 

string outputFile = "TestFile.wmv";

using (ITimeline timeline = new DefaultTimeline())

{

Console.WriteLine("Creating group...");

IGroup group = timeline.AddVideoGroup(32, 400, 400);

Console.WriteLine("Creating video track...");

ITrack videoTrack = group.AddTrack();Console.WriteLine("Adding frames to video...");

foreach (string s in videoFrameNames)

{

try

{

IClip clip = videoTrack.AddImage(s, 0, 2);

//group.AddTransition(clip.Offset - .5, .5, StandardTransitions.CreateIris());

}

catch (Exception e)

{

Console.WriteLine(e.Message);

}

}

//ITrack audioTrack = timeline.AddAudioGroup().AddTrack();

//IClip audio = audioTrack.AddAudio();

try

{

Console.WriteLine("Initializing renderer...");

WindowsMediaRenderer r = new

  WindowsMediaRenderer(timeline, outputFile, WindowsMediaProfiles.HighQualityVideo);
Console.WriteLine("Rendering video...");

r.Render();

}

catch (Exception e)

{

Console.WriteLine(e.Message);

}

}

When I call this function, it prints out

"A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in DirectShowLib-2005.dll"

"The filename, directory name, or volume label syntax is incorrect."

Jun 1, 2012 at 4:25 AM

It could be that your software couldn't find or doesn't have permission to write to "TestFile.wmv". You could try an absolute path to be sure it's not this issue.

Also, try to be sure that all the strings in videoFrameNames contains absolute paths to the images you're trying to add and that you have directory permission to this folder.