LEADTOOLS Support
Multimedia
Multimedia SDK Questions
Re: Wrong size of extracted frame from high res movie
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Friday, July 24, 2009 5:17:11 AM(UTC)
Groups: Registered
Posts: 3
I need to capture a frame from an avi file, which is at the resolution 1344x1032.
I realized that the size of the picture I get is not the same as the size of the original movie, and it depends on the resolution of the video!
At a high resolution everything works fine. For example, at 1920x1200 the extracted frame has size 1344x1032.
But at lower video resolution, the picture is somehow resized at the res of the graphic card. E.g at 1280x1024, it is reduced 1276x1000.
I have a windows vista system, but the same happens on XP. The multimedia leadtools version is 15.1
Please find attached a simple code with the operations I perform to extract the frame.
#2
Posted
:
Friday, July 24, 2009 5:19:43 AM(UTC)
Groups: Registered
Posts: 3
Sorry this is the code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Leadtools;
using Leadtools.ImageProcessing;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Threading;
using System.Drawing;
namespace TestHiResAvi
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public LTMMLib.ltmmPlay ltplay;
private void button1_Click(object sender, EventArgs ev)
{
try
{
LTMMLib.ltmmSupportManagerClass C = new LTMMLib.ltmmSupportManagerClass();
if (C.IsSupportLocked(1)) C.UnlockSupport(1, "*********************");
ltplay = new LTMMLib.ltmmPlayClass() as LTMMLib.ltmmPlay;
ltplay.sourcefile = this.textBox1.Text;
ltplay.CurrentFramePosition = 0;
ltplay.StillTap = 0; // test 0 and 1
ltplay.VideoWindowSizeMode = LTMMLib.ltmmSizeMode.ltmmNormal; // test normal and Fit
}
catch (Exception e)
{
string Msg = System.DateTime.Now.ToLongTimeString() + " -- " + e.Message;
if (e.InnerException != null) Msg += " -- inner ex " + e.InnerException.Message;
if (e.Source != null) Msg += " -- source " + e.Source;
if (e.StackTrace != null) Msg += " -- stack " + e.StackTrace;
MessageBox.Show(Msg);
Application.Exit();
}
Image Imm = GetMMFrame(0);
this.pictureBox1.Image = Imm;
this.textBox2.Text = "Width = " + Imm.Width + " Height = " + Imm.Height;
}
Image GetMMFrame(int nFrame)
{
ltplay.Stop();
ltplay.CurrentFramePosition = nFrame;
stdole.IPictureDisp pic;
try
{
pic = ltplay.GetStillPicture(20000);
}
catch (Exception e)
{
System.Diagnostics.Debug.Write(e.Message);
return null;
}
Image image1 = System.Drawing.Image.FromHbitmap(new IntPtr(pic.Handle), new IntPtr(pic.hPal));
return image1;
}
}
}
#3
Posted
:
Sunday, July 26, 2009 6:04:12 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
When using one of the still capturing methods, the resulting image will depend on the video rendering resolution which could affect the quality of the output file.
If you want the image to be rendered at its original size, insert one of the LEADTOOLS video processing filters into the control. You don't have to enable the processing feature of that filter. You only need to add it to the internal filter graph.
LEADTOOLS Support
Multimedia
Multimedia SDK Questions
Re: Wrong size of extracted frame from high res movie
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.