Discussion:
HELP! How To Join jpg's into a wmv Windows Media encoder SDK
(too old to reply)
Lordrick
2005-03-22 15:42:35 UTC
Permalink
Hi,

Somebody knows how can i consolidate some jpg's into a wmv file?
Could you paste a source code example?
I prefer a VB .NET but in C# also is ok.


Thank you very much!!!
Lord Rick
Jeremy Noring
2005-03-22 17:07:16 UTC
Permalink
Post by Lordrick
Hi,
Somebody knows how can i consolidate some jpg's into a wmv file?
Could you paste a source code example?
I prefer a VB .NET but in C# also is ok.
My guess is that you'd have to decompress the jpgs into RGB bitmaps (pretty
easy using C#, if I recall correctly) and then hand those samples to an
instance of the WMWriter that is configured to take the RGB format you
specify.

There are no code samples to do what you want to do that I know of. I'd
recommend looking through the writer samples that ship with the WMFSDK and
possibly modifying one of those. Additionally, I think most of the WMFSDK
isn't available in C# (all the samples are in C++), but I could be mistaken.
You may have to write some sort of wrapper class to bridge the managed and
unmanaged code.

You might also look at the "Writing Image Streams" section of the WMFSDK.
--
Where am I going?
And why am I in this handbasket?
Brandon Pai
2005-03-23 18:31:30 UTC
Permalink
You can do this through the encoder SDK. Try setup multiple source groups,
with each source group for one jpeg image and switch to another group based
on duration you want.

To use a image, it's the same as AVI/WMV source to the encoder, just set it
using IWMEncSource::SetInput
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by Jeremy Noring
Post by Lordrick
Hi,
Somebody knows how can i consolidate some jpg's into a wmv file?
Could you paste a source code example?
I prefer a VB .NET but in C# also is ok.
My guess is that you'd have to decompress the jpgs into RGB bitmaps
(pretty easy using C#, if I recall correctly) and then hand those samples
to an instance of the WMWriter that is configured to take the RGB format
you specify.
There are no code samples to do what you want to do that I know of. I'd
recommend looking through the writer samples that ship with the WMFSDK and
possibly modifying one of those. Additionally, I think most of the WMFSDK
isn't available in C# (all the samples are in C++), but I could be
mistaken. You may have to write some sort of wrapper class to bridge the
managed and unmanaged code.
You might also look at the "Writing Image Streams" section of the WMFSDK.
--
Where am I going?
And why am I in this handbasket?
Olivier
2005-03-24 11:45:10 UTC
Permalink
I did try to put various jpg or bmp inputs. Each of them in a separate source
group. I then tried to use the SetAutoRollover(-1, "XXX") method and it does
not work. It creates a wmv file but when u play it back u cannot see nothing!
It does not "rollover" to the next source group (image) either. I also tried
to put 1 second in the SetAutoRollover(1000,"XXX") method and still not
results... I also tried to put a video as the first source group and then
images. The output wmv file show the video and then stops. I does not
rollover to images...

Therefore how can we make a video from jpg's with the WME 9 SDK ???

Using the software itself I succeeded creating a video inserting various
sources put it did not rollover automatically between images... I had to
click on the different sources manually to make transitions in the video. My
assumption would be that the rollover method does not apply to images...
therefore it would not be possible to make videos from still images with this
SDK...

Please have you got any ideas ????? Thank you very much!
Post by Brandon Pai
You can do this through the encoder SDK. Try setup multiple source groups,
with each source group for one jpeg image and switch to another group based
on duration you want.
To use a image, it's the same as AVI/WMV source to the encoder, just set it
using IWMEncSource::SetInput
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by Jeremy Noring
Post by Lordrick
Hi,
Somebody knows how can i consolidate some jpg's into a wmv file?
Could you paste a source code example?
I prefer a VB .NET but in C# also is ok.
My guess is that you'd have to decompress the jpgs into RGB bitmaps
(pretty easy using C#, if I recall correctly) and then hand those samples
to an instance of the WMWriter that is configured to take the RGB format
you specify.
There are no code samples to do what you want to do that I know of. I'd
recommend looking through the writer samples that ship with the WMFSDK and
possibly modifying one of those. Additionally, I think most of the WMFSDK
isn't available in C# (all the samples are in C++), but I could be
mistaken. You may have to write some sort of wrapper class to bridge the
managed and unmanaged code.
You might also look at the "Writing Image Streams" section of the WMFSDK.
--
Where am I going?
And why am I in this handbasket?
Brandon Pai [msft]
2005-03-31 02:29:20 UTC
Permalink
Your assumption is correct. There is not an EOF for Images, so auto rollover
will not work for images. You will need to set the active source group in
the collection manually based on a timer
(IWMEncSourceGroupCollection::put_Active).
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by Olivier
I did try to put various jpg or bmp inputs. Each of them in a separate source
group. I then tried to use the SetAutoRollover(-1, "XXX") method and it does
not work. It creates a wmv file but when u play it back u cannot see nothing!
It does not "rollover" to the next source group (image) either. I also tried
to put 1 second in the SetAutoRollover(1000,"XXX") method and still not
results... I also tried to put a video as the first source group and then
images. The output wmv file show the video and then stops. I does not
rollover to images...
Therefore how can we make a video from jpg's with the WME 9 SDK ???
Using the software itself I succeeded creating a video inserting various
sources put it did not rollover automatically between images... I had to
click on the different sources manually to make transitions in the video.
My
assumption would be that the rollover method does not apply to images...
therefore it would not be possible to make videos from still images with this
SDK...
Please have you got any ideas ????? Thank you very much!
Post by Brandon Pai
You can do this through the encoder SDK. Try setup multiple source groups,
with each source group for one jpeg image and switch to another group based
on duration you want.
To use a image, it's the same as AVI/WMV source to the encoder, just set it
using IWMEncSource::SetInput
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by Jeremy Noring
Post by Lordrick
Hi,
Somebody knows how can i consolidate some jpg's into a wmv file?
Could you paste a source code example?
I prefer a VB .NET but in C# also is ok.
My guess is that you'd have to decompress the jpgs into RGB bitmaps
(pretty easy using C#, if I recall correctly) and then hand those samples
to an instance of the WMWriter that is configured to take the RGB format
you specify.
There are no code samples to do what you want to do that I know of.
I'd
recommend looking through the writer samples that ship with the WMFSDK and
possibly modifying one of those. Additionally, I think most of the WMFSDK
isn't available in C# (all the samples are in C++), but I could be
mistaken. You may have to write some sort of wrapper class to bridge the
managed and unmanaged code.
You might also look at the "Writing Image Streams" section of the WMFSDK.
--
Where am I going?
And why am I in this handbasket?
Rob H
2009-01-02 17:06:01 UTC
Permalink
Hi,

I realize this thread has been dead for a couple of years, but I am
experiencing a very similar problem to Oliver.

Any time I try to programatically encode a .jpg to a file using the WME SDK,
the file comes up with a blank screen. I have noticed that the image will
flash for an instant in the middle of the video file, but the rest of the
video file is a blank screen.

Using the windows media encoder UI, i have been able to encode the image to
a file with no problems, but the SDK doesn't appear to work the same way.

I am not worrying about setting the Rollover or MarkIn/MarkOut as mentioned
in the replies to this thread. I am manually switching between my source
groups using a dropdown on my UI, so these solutions do not apply to my
situation.

Is there something I need to set on my encoder / profile in order for a jpg
to create a proper output file?

Thanks,

Rob
Post by Jeremy Noring
Post by Lordrick
Hi,
Somebody knows how can i consolidate some jpg's into a wmv file?
Could you paste a source code example?
I prefer a VB .NET but in C# also is ok.
My guess is that you'd have to decompress the jpgs into RGB bitmaps (pretty
easy using C#, if I recall correctly) and then hand those samples to an
instance of the WMWriter that is configured to take the RGB format you
specify.
There are no code samples to do what you want to do that I know of. I'd
recommend looking through the writer samples that ship with the WMFSDK and
possibly modifying one of those. Additionally, I think most of the WMFSDK
isn't available in C# (all the samples are in C++), but I could be mistaken.
You may have to write some sort of wrapper class to bridge the managed and
unmanaged code.
You might also look at the "Writing Image Streams" section of the WMFSDK.
--
Where am I going?
And why am I in this handbasket?
Alex Jones
2009-06-11 18:55:02 UTC
Permalink
I'm also trying to use the Windows Media Encoder to create a video with a
static image, I'm also trying to make the audio source for the video an mp3
file. I have managed to make a video of no length which is contantly playing
the image, so I got a little further than you rob, I realize we are talk to
each other across many months but maybe you are still working/abandoned
etc..... And you notice this post.

I guess this is some form of code sample ^^.



WMEncoder en = new WMEncoder();

IWMEncSourceGroupCollection SrcGrpColl = en.SourceGroupCollection;

IWMEncSourceGroup SrcGrp = SrcGrpColl.Add("SG_1");

IWMEncVideoSource SrcVid =
(IWMEncVideoSource)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
SrcVid.SetInput(txtbPicLoc.Text, "", ""); //Bitmap file (.bmp, .gif
or .jpg file)

IWMEncAudioSource SrcAud =
(IWMEncAudioSource)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
SrcAud.SetInput(txtbTuneLoc.Text, "", "");

IWMEncProfile2 Pro = new WMEncProfile2();
Pro.LoadFromFile(@"D:\Panel\C#
Programs\AviDemo\AviDemo\AviDemo\uMusic.prx");

SrcGrp.set_Profile((IWMEncProfile)Pro);

IWMEncFile2 File = (IWMEncFile2)en.File;

File.LocalFileName = @"C:\output.wmv";
File.FileDuration = DetermineSongLength(); //Duration of audio file

en.PrepareToEncode(true);
en.Start();
Kyle Lee
2010-03-09 08:31:01 UTC
Permalink
I had a stupid way to do this and implemented it.
Fisrt, I put Bitmap into a video stream and convert it to AVI by DirectShow.
Next, I convert AVI to WMV by WMV SDK.
But I don't know how to SetInput with video stream in WMV DMO by DirectShow.
Post by Alex Jones
I'm also trying to use the Windows Media Encoder to create a video with a
static image, I'm also trying to make the audio source for the video an mp3
file. I have managed to make a video of no length which is contantly playing
the image, so I got a little further than you rob, I realize we are talk to
each other across many months but maybe you are still working/abandoned
etc..... And you notice this post.
I guess this is some form of code sample ^^.
WMEncoder en = new WMEncoder();
IWMEncSourceGroupCollection SrcGrpColl = en.SourceGroupCollection;
IWMEncSourceGroup SrcGrp = SrcGrpColl.Add("SG_1");
IWMEncVideoSource SrcVid =
(IWMEncVideoSource)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
SrcVid.SetInput(txtbPicLoc.Text, "", ""); //Bitmap file (.bmp, .gif
or .jpg file)
IWMEncAudioSource SrcAud =
(IWMEncAudioSource)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
SrcAud.SetInput(txtbTuneLoc.Text, "", "");
IWMEncProfile2 Pro = new WMEncProfile2();
Programs\AviDemo\AviDemo\AviDemo\uMusic.prx");
SrcGrp.set_Profile((IWMEncProfile)Pro);
IWMEncFile2 File = (IWMEncFile2)en.File;
File.FileDuration = DetermineSongLength(); //Duration of audio file
en.PrepareToEncode(true);
en.Start();
Alessandro Angeli
2010-03-09 22:46:54 UTC
Permalink
From: "Kyle Lee"
Post by Kyle Lee
I had a stupid way to do this and implemented it.
Fisrt, I put Bitmap into a video stream and convert it to
AVI by DirectShow. Next, I convert AVI to WMV by WMV SDK.
But I don't know how to SetInput with video stream in WMV
DMO by DirectShow.
You are replying to a post about Windows Media Encoder 9,
which has nothing to do with DirectShow or the WMF SDK (I am
assuming that you meant WMF SDK, since there is no "WMV
SDK").

If you know how to push bitmaps into a DirectShow graph, why
do you need the intermediate file at all? The WMASFWriter
filter will create the WMV directly. Why do you even need
the WMV DMO encoder? The WMASFWriter and the WMF SDK will
use it for you.

Read the docs in the WMF SDK to learn how to create a
profile and for the WMWriter (WMF) or WMASFWriter
(DirectShow).
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
Kyle Lee
2010-03-11 08:28:01 UTC
Permalink
Thanks a lot for the answers.
I'm new in Media encoder/decoder.
My case is that Bitmaps are put into video stream, and is encoded a VC-1
compliant video files, such as WMV9/VC-1.
Can WMASFWriter encode VC-1 compliant video files, such as WVC1 codec?
Post by Alessandro Angeli
From: "Kyle Lee"
Post by Kyle Lee
I had a stupid way to do this and implemented it.
Fisrt, I put Bitmap into a video stream and convert it to
AVI by DirectShow. Next, I convert AVI to WMV by WMV SDK.
But I don't know how to SetInput with video stream in WMV
DMO by DirectShow.
You are replying to a post about Windows Media Encoder 9,
which has nothing to do with DirectShow or the WMF SDK (I am
assuming that you meant WMF SDK, since there is no "WMV
SDK").
If you know how to push bitmaps into a DirectShow graph, why
do you need the intermediate file at all? The WMASFWriter
filter will create the WMV directly. Why do you even need
the WMV DMO encoder? The WMASFWriter and the WMF SDK will
use it for you.
Read the docs in the WMF SDK to learn how to create a
profile and for the WMWriter (WMF) or WMASFWriter
(DirectShow).
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
.
Alessandro Angeli
2010-03-11 22:47:37 UTC
Permalink
From: "Kyle Lee"
Post by Kyle Lee
I'm new in Media encoder/decoder.
My case is that Bitmaps are put into video stream, and is
encoded a VC-1 compliant video files, such as WMV9/VC-1.
Can WMASFWriter encode VC-1 compliant video files, such
as WVC1 codec?
The WM[ASF]Writer doesn't care, it simply uses whatever WM
codecs are on your system.

Since version 9.5 (or 11?) of the WMF runtime, the standard
WMV3 (aka WMV9) codec produces VC-1 simple and main profile
streams and the advanced WVC1 codec produces VC-1 advanced
profile.

The VC-1 SDK has more optimized codecs, but it is provided
as a static link library and it is not integrated with
DirectShow or WMF (but you can encode the video and then use
the WM[ASF]Writer to mux the pre-compressed stream into a
WMV file).
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
Loading...