ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Extract, Process and Insert frames from .AVI files
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

yogiyang

India
727 Posts

Posted - Aug 26 2011 :  00:40:11  Show Profile  Reply
I have observed that ImageEn will allow one to open .AVI files. I was wondering if it is possible to Extract a range of frames from the video and then process them and Insert them back to their respective location in the AVI file.




Yogi Yang

fab

1310 Posts

Posted - Aug 27 2011 :  13:30:52  Show Profile  Reply
You could use OpenMediaFile method to open the AVI (or any other multipage file format) for reading and CreateAVIFile of the same object to open an AVI for writing, like in this example:

// writes "Hello!" in each frame of "input.avi" and writes the resulting video to "output.avi"
var
  frameIndex:integer;
  bmp:TIEBitmap;
  io:TImageEnIO;
begin
  bmp := TIEBitmap.Create();
  io := TImageEnIO.CreateFromBitmap(bmp);

  try
    io.OpenMediaFile('input.avi');
    io.CreateAVIFile('output.avi');
    for frameIndex:=100 to 200 do
    begin
      io.LoadFromMediaFile(frameIndex);
      with bmp.Canvas do
      begin
        Pen.Color := clRed;
        Font.Size := 40;
        TextOut(0, 0, 'Hello!');
      end;
      io.SaveToAVI();
    end;
    io.CloseAVIFile();
    io.CloseMediaFile();

  finally
    io.Free();
    bmp.Free();
  end;
end;


Just two notes:
1) timings could be differents
2) audio is not supported
3) you need the right codec installed
Go to Top of Page

yogiyang

India
727 Posts

Posted - Aug 28 2011 :  23:36:11  Show Profile  Reply
@Fabrizio,
Thanks for your help.

I will try as you have suggested and get back here if I am stuck anywhere.

Once more thanks for your help.


Yogi Yang
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: