Home Image-Pro Automation (Macros, Apps, Reports)

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

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


Answers

  • 2020-12-21-171849

    All --

    I did also manage to find a page on the internet that gave directions on getting a list of CODECs on a given WINDOWS computer via the WINDOWS MEDIA PLAYER.

    The article is at


    According to that, the CODECs on my WINDOWS 10 COMPUTER are




    I hope this information is helpful.

    Thanks.

    -- Matt



  • Hi Matt,

    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
  • 2020-12-22-090316

    Yuri --

    Thanks for the CODE to modify the FRAMES PER SECOND.

    It has been a long time since I have done a project with a movie but back in the days of AVI FILES I thought that the END OPTIONS of

    -- STOP
    -- LOOP
    -- REVERSE

    were embedded in the MOVIE FILE.  I expect these can be over-ridden by the MOVIE PLAYER.  This is the first time I have really dug into using an MP4 FILE so I don't know what its FEATURES and OPTIONS are.

    Is there CODE that will allow the SAVE MOVIE ROUTINE in my APP to:

    -- List the CODECS that are options
    -- Set the CODEC that will be used

    during the SAVE AS MP4 FILE?

    Thanks again.

    -- Matt
Sign In or Register to comment.