I could use some help on this. I'd like to overlay an audio.mp3 file (or any other format for that matter) onto a video.
I'm using the free version of Expression Encoder 4, and so all my video outputs are wmv. Thing is, I don't know how to add an audio file to the video MediaItem. I tried something like this, but it didn't add the audio on the result:
MediaItem videoTrack = new MediaItem(@"path\to\videofile.wmv");
videoTrack.OutputFormat = new WindowsMediaOutputFormat();
videoTrack.OutputFormat.VideoProfile = new AdvancedVC1VideoProfile();
MediaItem audioTrack = new MediaItem(@"path\to\audio.mp3");
videoTrack.OutputFormat.AudioProfile = audioTrack.SourceAudioProfile;
job.MediaItems.Add(videoTrack);
job.Encode();
And when that didn't work (perhaps because a profile alone is just metadata, and not the audio file itself), then I tried to overlay the audio the way I would overlay an image onto the video, by doing this:
MediaItem videoTrack = new MediaItem(@"path\to\videofile.wmv");
string overlayFilename = @"path\to\audio.mp3";
videoTrack.OverlayFileName = overlayFilename;
job.MediaItems.Add(videoTrack);
job.Encode();
This failed too, with an error this time saying that the overlay item needs to have video stream or something (I guess ExEncoder expected that overlay to be a video file). Some help would be greatly appreciated. This really shouldn't be this difficult for a powerful product like ExEncoder 4.