CODE to control IMAGE SAVE AS MP4 . . .
2020-12-21-164021
All --
I have a ROUTINE (below) which will save an IMAGE SEQUENCE into an MP4 VIDEO FILE.
I opened the MP4 VIDEO FILE using VLC, I can see that the CODEC used to save this file is H264 as shown below.
This matches the COMPRESSION setting in the IMAGE-PRO SAVE AS DIALOG BOX as shown below.
When working with JPG IMAGE FILES recently, I provided with the following CODE to adjust the COMPRESSION QUALITY ATTRIBUTE during a FILE SAVE AS JPG IMAGE.
Public Sub SaveJpg
Dim image1 As McImage
With Application.DocumentCommands.ActiveImage(Nothing)
.Run(image1)
End With
image1.File.Format="jpg"
image1.File.Attributes("CompressionQuality") = 50
image1.SaveAs(ThisApplication.Path(mcPathType.mcptWritableImages) & "test.jpg")
End Sub
Dim image1 As McImage
With Application.DocumentCommands.ActiveImage(Nothing)
.Run(image1)
End With
image1.File.Format="jpg"
image1.File.Attributes("CompressionQuality") = 50
image1.SaveAs(ThisApplication.Path(mcPathType.mcptWritableImages) & "test.jpg")
End Sub
I would like to know what the ATTRIBUTES are that I can modify in the FILE SAVE AS MP4 MOVE FILE so that I can fine-tune the MOVIE for the users of the IMAGE-PRO APP that I am writing. If I can adjust FRAMES PER SECOND on PLAYBACK and LOOPING AT END or REVERS AT END, that would be super.
I have poked around in IMAGE-PRO HELP FILES and on the INTERNET and I am unable to find guidance on this.
I did find a reference that pointed me to a list of the CODECs that I as a USER can see within WINDOWS but this list does not match the list in IMAGE-PRO.
I have attached a TEST SEQUENCE to hopefully simplify providing info on this.
Thanks in advance.
-- Matt
Public Function Tester 'SAVE THE IMAGE SEQUENCE AS MP4 MOVIE Dim imageAA As McImage With Application.DocumentCommands.ActiveImage(Nothing) .Run(imageAA) End With imageAA.File.Format="mp4" imageAA.SaveAs _ ( _ textBox_SourceFolder.Text & _ "\Annotated Images and Video" & _ "\" & _ textBox_SampleInfo.Text & _ ".mp4" _ ) End Function
0
Answers
You can set "Frames per second" in the sequence toolbar:
or using the macro:
Public Sub SetImageFPS Dim win As McWindow=ThisApplication.ActiveWindow Dim view As Mediacy.IQL.Display.Viewer.McView=win.ImageView Dim fps As Double=10'set frames per second 'set to View view.SequenceFrameRate=fps 'set to image view.ImageToDisplay.Properties(MediaCy.IQL.Engine.mcImageLibPropertyIDs.ID_IMcImage_FramesPerSecond)=fps End Sub
After that the image can be saved to MP4 with the given rate. The LOOPING AT END or REVERS AT END are not image properties and should be set in the player, where you play the movie.
Yuri