Resultant Filesize and MP4 Encoding

Topics: User Forum
Jun 9, 2009 at 12:44 PM

Hello bittercoder and the other dev's

Greatly appreciate your work (although I appreciate that DirectShow is doing the hard work ;-))

I have been using the splicer library to turn one picture and one song into a video file suitable for uploading to youtube.

Youtube recommend uploading in MP4 with a 640*480 resolution.

I have been making videos using the following method:

 

private void CreateVideo(string videoToCreate,string imageLoc,string tuneLoc)

{

using (ITimeline timeline = new DefaultTimeline())

{

IGroup group = timeline.AddVideoGroup(32, 640, 480);

ITrack videoTrack = group.AddTrack();

 

IClip clip1 = videoTrack.AddImage(imageLoc, 0, DetermineSongLength());

 

// add some audio

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

IClip audio = audioTrack.AddAudio(tuneLoc, 0, videoTrack.Duration);

 

// 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, audio.Duration,StandardEffects.CreateAudioEnvelope(1.0, 1.0, 1.0, audio.Duration));

 

// 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();

}

}

}

 

As you can see I'm using the WindowsMediaRenderer. This is fine and produces what I'm after, but a 10MB mp3 is turned into a 2.3MB WMV ?

 

I would have thought that the file size would have increased.

 

I was aiming for MP4, I have read through the discussion forum, but I don't know how to assign an audio and video compress to the method. Do you have any insights to help me with this?

 

Thank you kindly,

d3

 

 

 

Jun 12, 2009 at 9:05 AM

Hi,

Just an FYI.

To change the outputted video quality settings.

Download Windows Media Renderer SDK 9:

http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=e43cbe59-678a-458a-86a7-ff1716fad02f&displaylang=en

Download the Splicer Source.

Open one of the WindowsMediaProfile Files in Splicer\WindowsMedia\*.prx in the WMEncoder (in the SDK)

Change the settings you want audio/video bitrate.

Save the file, re-compile source, export .dll into your project.

Was thinking of attempting a method that pass in the audio/video bitrate you want to encode into, but I'm very busy atm.

And for my purposes this is an adequate method.

Thanks,

d3

 

 

Jun 22, 2009 at 8:55 AM

Hello, everyone, I appreciate the splicer library as well, amazing tool.

I was having trouble compiling the source in 2005, so if anyone else has trouble with that, upgrade to visual studio 2008.

I needed higher quality video in my project, however, I took a bit different approach. I created a CustomQualityVideo.prx file and placed it in the same directory as my executable, and then recompiled the splicer library with the following changes.

 

        public static string CustomStream
        {
            get { return GetStream("CustomQualityVideo.prx"); }
        }

        private static string GetStream(string name)
        {
            StreamReader sr = new StreamReader(name);
            string what = sr.ReadToEnd();
            return what;
        }

 

Enjoy =]