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
 Error creating video file from photo
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

khorsandreza

Iran
26 Posts

Posted - Jan 20 2019 :  08:24:37  Show Profile  Reply
Hello
I am using the Imageen Components to convert a limited number of images to a video file in AVI format. But I do not know what's wrong with my writing code? Only the first image will be created in the video file. And the rest of the images will not be shown.
I've attached the example to you, please give me a guide.
Yours sincerely


R.Khorsandi





attach/khorsandreza/201912082418_avi.zip
55.36 KB

khorsandreza

Iran
26 Posts

Posted - Jan 21 2019 :  14:36:00  Show Profile  Reply
Hello dear friends
For this problem, do not have a suggested solution?

Var
I:Integer;
const
  Radius_Cinepack_Compressor_4CC   = 'cvid';
  Microsoft_Video_1_Compressor_4CC = 'msvc';
begin
Try
    xCount:= 0;
    ImageEnView1.IO.CreateAVIFile( PStr, 10, 'DIB ');//Microsoft_Video_1_Compressor_4CC );
//    ImageEnView1.AutoFit:=True;
    DeleteFile( PStr );
      for I := 0 to Grid.Items.Count-1  do
      Begin
        _ShowImageName:=   Grid.Items[I];
        ImageEnView1.IO.LoadFromFileJpeg(_ShowImageName);
        ImageEnView1.IO.Params.BitsPerSample   := 8;
        ImageEnView1.IO.Params.SamplesPerPixel := 1;
        ImageEnView1.IO.SaveToAVI();
        Application.ProcessMessages;
        Sleep(1000);
      End;
    ImageEnView1.IO.CloseAVIFile;
    FreeAndNil( ImageEnView1 );
    ImageEnMView1.MIO.LoadFromFile( PStr );
Except
    ImageEnView1.IO.CloseAVIFile;
    FreeAndNil( ImageEnView1 );
    ImageEnMView1.MIO.LoadFromFile( PStr );

End;

Go to Top of Page

klausdoege

Germany
389 Posts

Posted - Jan 22 2019 :  08:35:06  Show Profile  Reply
Hi,
you have only 15 pictures in your list.
Here you say the Avi has 10 Pictures per Sec.
-> ImageEnView1.IO.CreateAVIFile( PStr, 10, 'DIB
Now you insert 15 pictures in the Avi.
-> for I := 0 to Grid.Items.Count-1 do
But 15 / 10 is one Pictures in one sec.
Try follow:
-> ImageEnView1.IO.CreateAVIFile( PStr, 1, 'DIB
-> for I := 0 to Grid.Items.Count-1 do

Now you have a AVI with 15 Pictures over 15 sec.
I hope this is useful for you
Klaus

Klaus
www.klausdoege.de
Go to Top of Page

khorsandreza

Iran
26 Posts

Posted - Jan 22 2019 :  13:11:11  Show Profile  Reply
Hello
Thanks for your advice, but with the changes that you said, there was no change in the output file, only the first frame fits right. If the images are corrupted, I will send the output example again.
If I want to insert 10 images in AVI file and show each photo for 10 seconds, how to create a drawing order? What changes should I make?
Go to Top of Page

khorsandreza

Iran
26 Posts

Posted - Jan 22 2019 :  13:41:15  Show Profile  Reply
Hello
Thanks for your advice, but with the changes that you said, there was no change in the output file, only the first frame fits right. If the images are corrupted, I will send the output example again.
If I want to insert 10 images in AVI file and show each photo for 10 seconds, how to create a drawing order? What changes should I make?



attach/khorsandreza/2019122133945_Temp.zip
3062.45 KB
Go to Top of Page

zerob

161 Posts

Posted - Jan 22 2019 :  17:06:15  Show Profile  Reply
Try to set the rate to 1 and save each image 10 times as you need to have a frame each second for these 10 seconds per image...

Also your "DeleteFile( PStr );" should not be called after "ImageEnView1.IO.CreateAVIFile(...".
Call it before creating a new AVI file.

Is there a reason for setting "SamplesPerPixel" to 1 (Gray scale) and not 3 (RGB).

Maybe you need to check the image sizes to make sure that all images are the same size and also have the right dimension for your video format (there are standard dimensions and some formats also need the sizes to be multiples of 2,4 or 8). I don't know if ImageEn handles that for you automatically or if you need to do that by yourself...
Go to Top of Page

xequte

38613 Posts

Posted - Jan 22 2019 :  23:16:11  Show Profile  Reply
Hi

Please try this demo...


attach/xequte/201912223166_ImagesToAvi.zip
131.44 KB

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

zerob

161 Posts

Posted - Jan 23 2019 :  03:19:31  Show Profile  Reply
Nigels demo is nice, and if you want each image to be shown for 10 seconds, save each image 10 times before loading the next one.
This way you present the same image, 1 frame for 1 frame per second 10 seconds = 10 times.

Here is the modified version... i set it to show a frame for 1 second and save it 10 times (10 seconds)...

procedure TForm1.btnSaveClick(Sender: TObject);
const
Radius_Cinepack_Compressor_4CC = 'cvid';
Microsoft_Video_1_Compressor_4CC = 'msvc';
var
I,iSeconds: Integer;
begin
// Init AVI
fHiddenIEView := TImageEnView.Create(nil);
DeleteFile( edtFilename.Text );
fHiddenIEView.IO.CreateAVIFile( edtFilename.Text, 1, Microsoft_Video_1_Compressor_4CC ); // show each frame for 1 second

for I := 0 to lbxFiles.Items.Count - 1 do
begin
// Add a frame
fHiddenIEView.IO.LoadFromFile( lbxFiles.Items[ i ]);
fHiddenIEView.IO.Params.BitsPerSample := 8;
fHiddenIEView.IO.Params.SamplesPerPixel := 3;
for iSeconds:= 9 downto 0 do // save it 10 times for 10 seconds
fHiddenIEView.IO.SaveToAVI;
end;

// Save AVI
fHiddenIEView.IO.CloseAVIFile;
FreeAndNil( fHiddenIEView );
ImageEnMView1.MIO.LoadFromFile( edtFilename.Text );

btnPlay.Enabled := True;
end;
Go to Top of Page

khorsandreza

Iran
26 Posts

Posted - Jan 23 2019 :  06:42:03  Show Profile  Reply
Hello dear Nigel
Thanks to my troubleshooting guide, this problem has been resolved.
There is only one bug. If the images are portraits, the video file will be corrupted.
Go to Top of Page

zerob

161 Posts

Posted - Jan 23 2019 :  08:07:25  Show Profile  Reply
Maybe it has to do with the image dimension. What size does your portrait have?
Go to Top of Page

khorsandreza

Iran
26 Posts

Posted - Jan 23 2019 :  16:19:22  Show Profile  Reply
Sample my photos


attach/khorsandreza/2019123161652_1.zip
1620.38 KB


Go to Top of Page

zerob

161 Posts

Posted - Jan 25 2019 :  04:04:32  Show Profile  Reply
Try to make all images the same size (painting them on a black background if needed) and make them even (dividable by 2... for example not 5 pixels but 4)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: