LEADTOOLS Support
Multimedia
Multimedia SDK Questions
Problem with converting jpeg to mpeg2 stream using memory
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, March 18, 2009 10:36:38 PM(UTC)
Groups: Registered
Posts: 40
I am getting message of filter in wrong state when I try to convert jpeg image to mpeg2 using convmem demo application.I am using mpeg encoder 3.0 for this.Please help on this.Thanks.
#2
Posted
:
Friday, March 20, 2009 5:24:12 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
The demo wasn't designed to read image files. What you will have to do is either modify the demo to take an image file. What language are you programming in?
#3
Posted
:
Monday, March 23, 2009 1:44:56 AM(UTC)
Groups: Registered
Posts: 40
I am using c++ language.Can you give me some details on this.Steps to give jpeg as input to mpeg2 conversion.
#4
Posted
:
Monday, March 23, 2009 11:53:52 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
You can use this code below to convert a JPEG to MPEG. Note that I am sleeping the thread for 10 seconds before calling stop convert. To enable the convert object to close the file handle for the target file it is necessary to call stop convert, and release the object.
hr = CoInitialize(NULL);
// Create convert control.
IltmmConvert *convert;
hr = CoCreateInstance(CLSID_ltmmConvert, NULL, CLSCTX_INPROC_SERVER, IID_IltmmConvert, (void**)&convert);
// Set source file to an image.
hr = convert->put_SourceFile(L"C:\\Root\\Images\\Vista\\Dock.jpg");
IltmmCompressors *videoCompressors;
IltmmCompressors *audioCompressors;
// Select video compressor.
long videoCompIdx = 0;
hr = convert->get_VideoCompressors(&videoCompressors);
hr = videoCompressors->Find(L"@device:sw:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\\LEAD MPEG2 Encoder (3.0)", &videoCompIdx);
hr = videoCompressors->put_Selection(videoCompIdx);
// Select audio compressor.
long audioCompIdx = 0;
hr = convert->get_AudioCompressors(&audioCompressors);
hr = audioCompressors->Find(L"@device:sw:{33D9A761-90C8-11D0-BD43-00A0C911CE86}\\LEAD MPEG Audio Encoder (2.0)", &audioCompIdx);
hr = audioCompressors->put_Selection(audioCompIdx);
// Set target format to MPEG2.
hr = convert->put_TargetFormat(ltmmConvert_TargetFormat_MPEG2_PROGRAM);
// Set target file
hr = convert->put_TargetFile(L"C:\\deleteme.mpg");
// Start conversion.
hr = convert->StartConvert();
Sleep(10000);
hr = convert->StopConvert();
hr = convert->Release();
LEADTOOLS Support
Multimedia
Multimedia SDK Questions
Problem with converting jpeg to mpeg2 stream using memory
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.