tVideoTool.GetCompressor error

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
dpatch
Newbie
Newbie
Posts: 53
Joined: Mon Jul 02, 2007 12:00 am

tVideoTool.GetCompressor error

Post by dpatch » Thu Jul 26, 2007 5:21 pm

I am trying to get the list of machine specific compressors installed. When I run the following code, I get an EAbstractError exception with message 'Abstract Error'.

Can you tell me why? Thanks!

var
VTool : TVideoTool;
CodecList : TStrings;

begin
VTool := TVideoTool.Create(application);
CodecList := TStrings.Create;
VTool.GetCompressors(CodecList);
end;

dpatch
Newbie
Newbie
Posts: 53
Joined: Mon Jul 02, 2007 12:00 am

Post by dpatch » Thu Jul 26, 2007 6:25 pm

Sorry...operator error! I needed to assign the tool to a chart and use TStringList instead of TStrings.

dpatch
Newbie
Newbie
Posts: 53
Joined: Mon Jul 02, 2007 12:00 am

TVideoTool.SetCompression

Post by dpatch » Thu Jul 26, 2007 7:21 pm

OK, here is the next related issue...

Why is the first line in procedure TVideoTool.SetCompression the Exit statement?

This prevents me from setting the video compression.

Pep
Site Admin
Site Admin
Posts: 3272
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Aug 07, 2007 3:43 pm

Hi,

yes, you're correct. We put the Exit because for the moment there's not a robust code (it does not work fine for all the OS's, it depends on the codecs the users have installed on their maquines).

We'll try to find a good way to include this for the next maintenance releases.
In meantime, if you're source code customer you can remove the Exit line and test it (or modify the code if required).

dpatch
Newbie
Newbie
Posts: 53
Joined: Mon Jul 02, 2007 12:00 am

Post by dpatch » Tue Aug 07, 2007 3:50 pm

Yes, I did modify it and it seems to work for some codec, but not all. This (like all) is a really important fix for me.

Thanks in advance!

dpatch
Newbie
Newbie
Posts: 53
Joined: Mon Jul 02, 2007 12:00 am

Post by dpatch » Tue Nov 27, 2007 4:34 pm

Has there been any consideration given for this fix?

Also, Have you considerec storing video in formats other than windos AVI which creats VERY large files.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Nov 27, 2007 6:00 pm

Hi dpatch,
Has there been any consideration given for this fix?
This issue hasn't been fixed yet.
Also, Have you considerec storing video in formats other than windos AVI which creats VERY large files.
Not yet. Please be aware at this forum for new release announcements and what's being implemented/fixed on them. You can also subscribe to the RSS feed at our home page.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Jan 28, 2009 11:22 am

Hi dpatch,

This issue (TV52012609) has been fixed for the next TeeChart maintenance release so that code below works fine. In the meantime I'll send you TeeVideo.pas so that you can test it at your end.

Code: Select all

procedure TForm1.BitBtn1Click(Sender: TObject);
var i,ii : integer;
  ss : String;
  st : tstrings;
begin
//ChartTool1.GetCompressors(ComboBox1.Items);
  st := TStringList.Create;
  ChartTool1.GetCompressors(st);

  //for ii := 1 to ComboBox1.Items.Count-1 do
  for ii := 1 to st.Count-1 do
  begin
  //  ss := Copy(ComboBox1.items.Strings[ii],1,4);
    ss := Copy(st[ii],1,4);
    //showmessage(ss);
    Charttool1.compression:=ss;
    ChartTool1.StartRecording('C:\temp\testvid_'+ss+'.avi');
    Series1.Clear;
    for i :=0 to 500 do
    begin
       label1.Caption := inttostr(i);
       Series1.Addxy(i,random(100));
       Application.ProcessMessages;
    end;
    ChartTool1.StopRecording;
  end;

  showmessage('stopped');
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
var i : integer;
begin
  ChartTool1.Compression :='MSVC';
  ChartTool1.StartRecording('C:\temp\testvid_err.avi');

  for i :=0 to 500 do
  begin
     label1.Caption := inttostr(i);
     Series1.Addxy(i,random(100));
     Application.ProcessMessages;
  end;

  ChartTool1.StopRecording;
end;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

dpatch
Newbie
Newbie
Posts: 53
Joined: Mon Jul 02, 2007 12:00 am

Post by dpatch » Wed Jan 28, 2009 3:38 pm

Thanks. I just installed the latest binaries installed. I will get the source compiling and test it today!

Thanks.

dpatch
Newbie
Newbie
Posts: 53
Joined: Mon Jul 02, 2007 12:00 am

Post by dpatch » Wed Jan 28, 2009 6:22 pm

OK, I have tested it and I do not think it works.

Some comments...

1. In file TeeVideo.pas, procedure SetCompression after calling GetCompressors, you only compare the 1st 4 characters of the compressor strings returned to the value passed in. This will never result in a "True" comparrison if the whole name of the compressor returned from GetCompressors is passed in. It looks like you were trying to copy only the CVID tag that is returned with the compressor names. But the comparison makes no sense. The first thing that GetCompressor adds to the compressor list is TeeMsg_NoCompression which is "No Compressor". If selected, this would never pass the comparison test.

2. In procedure SetCompression, when you raise the exception, if cexists is false FFourCC is not set. This causes the message displayed to have a blank compressor name. cexist is never set because the 4 character comparison never works.

3. It appears that the example code below works only for 2 reasons.

reason 1: Your for loop starts at 1, not 0. If you start it at zero, you would see the error message I mention in number 2 above. "No Compression" is at index 0 so when you set the compression to No Compression, SetCompression will throw an exception. This of course is true only if you pass the whole name in, not just the 1st 4 characters.

reason 2: you only copy the 1st 4 characters into ss which on my machine are the characters "cvid". This allows procedure SetCompression to think you passed it a valid compressor name when you really didn't. All the compressor names on my computer start with the tag cvid.

I do not have the code for your example below so I didn't actually run it on my computer. If you email it to me I will compile it and run it here.

For these reasons, I do not think that this issue should be closed. I will have to restore my earlier version of TeeVideo. Thanks for sending me the update, and I would love to get another if additional changes are made.

Thanks again,
dave

Pep
Site Admin
Site Admin
Posts: 3272
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Fri Jan 30, 2009 9:01 am

Hi Dave,
OK, I have tested it and I do not think it works.
It's strange, it works fine. I've test it with three codecs (MSVC, IYUV,CVID,MPG).
1. In file TeeVideo.pas, procedure SetCompression after calling GetCompressors, you only compare the 1st 4 characters of the compressor strings returned to the value passed in. This will never result in a "True" comparrison if the whole name of the compressor returned from GetCompressors is passed in. It looks like you were trying to copy only the CVID tag that is returned with the compressor names. But the
Yes, this is becaouse normally the handler of TStream works with the first four characters of the Coded. Here you can find some info about this (just some pages) :
http://msdn.microsoft.com/en-us/library ... S.85).aspx

Four-character code indicating the preferred stream handler to use. Typically, this information is stored in the stream header in an AVI file.

http://cybertiggyr.com/vwu/
comparison makes no sense. The first thing that GetCompressor adds to the compressor list is TeeMsg_NoCompression which is "No Compressor". If selected, this would never pass the comparison test.
This is the reason why the "for" starts at position 1 intead of 0.
2. In procedure SetCompression, when you raise the exception, if cexists is false FFourCC is not set. This causes the message displayed to have a blank compressor name. cexist is never set because the 4 character comparison never works.
Yes, you're correct, I've modified the code in order to assign the FourCC value before the "if".
reason 2: you only copy the 1st 4 characters into ss which on my machine are the characters "cvid". This allows procedure SetCompression to think you passed it a valid compressor name when you really didn't. All the compressor names on my computer start with the tag cvid.
Is there a place where I can see that exists more than one CVID codec?

Post Reply