Create a movie file

I simply need to create a movie file (mp4, or AVI), that is a simple image file, repeated for 3 or 4 seconds.
Does Xojo have a way to make with the native commands?
I searched and it seems to only be able to read movies, not create or save them.

You could use ffmpeg with Shell class in Xojo.

Or for macOS/iOS check the MBS Xojo AVFoundation Plugin.

1 Like

Hi Rui,
repeated for 3 or 4 seconds?
Do you want to make of an mp4 an gif file?
If you like to know more about how to work with ffmpeg and xojo 's shell, go to my youtube channel.
There i show how to create a screenrecoder , gif files from a mp4.
Search on youtube : roger van leeuwen xojo.
Then you will have english and german videos.

Be prepared to deal with Frames Per Second and other subtle things :wink:

Thank you all.
I really do need to create an .mp4 or .mov, ou .avi file, not a .gif file.
And I need it to work on Windows (and Mac, also, but not required).
Will the ffmpeg solution work?

Hi Rui,

if you go to my youtube channel you will also find a converter.
It convert mp4 to anything you want.
What you want to have as i understand now is a converter.
You want to convert a AVI movie into a MP4 movie.
Go to my youtube channel and look for it.
It is a video where i convert a mp4 into a mp3.
The basic is the same for AVI to MP4 or anything else.

Hi Rui,
Here is the link to my converter video where i show people how to convert an mp4 into a mp3.
All you have to do is change the input to ffmpeg where you want mp4 as output.

Thank you Roger.
I’m having trouble making it work on Windows.
Trouble with the paths for the INPUT and/or OUTPUT files if they are on a path that contains any folder with spaces.
Even using the FolderItem.ShellPath, on Windows I don’t get the spaces escaped :frowning:
And, also, I’m getting a report telling me “Shell timed out”.
On a Mac, it all works fine.

Ok, watching your movie, I realised that the Windows paths must be enclosed between quotes.
But I’m still getting the “Shell timed out” errors and I get corrupted .mp4 files.

Tell me what do you have as intput?
I will create a video for you on a windows machine.
I never had that error like shell time out.
Can you show me the string you made for ffmpeg to convert your movie?

Hello, Roger.

I managed to solve it.
The time out issue was solved setting the TimeOut property of the Shell to -1
And the ffmpeg string ended up being this:

cmdFFMPEG = app_path+" -y -loop 1 -i """+obj.FolderItem.ShellPath+""" -vf ""scale=trunc(iw/2)*2:trunc(ih/2)*2"" -r 25 -crf 0 -t 4 -c:v libx264 -pix_fmt yuv420p """+movie_path+""""

Thank you so much, Roger. Your help was invaluable.

it is a pain to create that string in xojo :slight_smile:
in other programming langauges it is easier to pass a string.
but onces you know it, it is easy to do.
well, happy your problem is solved.