Jpg to avi

Is there a simple way to combine two .jpg files to .avi ?

Thx,

Frederik Pot

“How to combine two .jpg files to .avi” on Yaho returns penty entries.

So, I will say: Yes.

How with Xojo is a different matter. Redo that quest and watch what you get back.

At QuickTime intro (and some years later), one of the shared applications allows to do that (but not to avi). Now ?

Mac? Win? Linux?

Maybe my JPEGMovieMBS class helps?

FFMPEG might be a handle (command-line) tool that will help you out. You can use it in conjunction with Xojo with the help of Shell.

In the example below I have a copy of the FFmpeg app in the applications folder. Also, I have a two files “test.jpg” and “test.mp3” on my desktop.

' set the FolderItems
dim ffmpegApp as FolderItem = SpecialFolder.Applications.Child("ffmpeg")
dim imageFile as FolderItem = SpecialFolder.Desktop.Child("test.jpg")
dim outputFile as FolderItem = SpecialFolder.Desktop.Child("test.avi")
dim audioFile as FolderItem = SpecialFolder.Desktop.Child("test.mp3")

' Make sure the output file doesn't exist
If outputFile.exists then outputFile.delete

dim opt() as String

' point to the ffmpeg app
opt.Append ffmpegApp.ShellPath

' tell FFmpeg to loop the image
opt.Append "-loop 1"

' assign the first input. An image will be a video input
opt.Append "-i " + imageFile.ShellPath

' assign an audio input
opt.Append "-i " + audioFile.ShellPath

' set the output codec for the video stream
opt.Append "-c:v libx264"

' set the codec for the audio stream (copy means that the source audio will not be re-encoded but coppied from the original
opt.Append "-c:a copy"

' set the bitrate for the output audio stream. 192000 bps in this case
opt.Append "-b:a 192k"

' tell FFmpeg to stop the file when the shortest stream ends. Since the image is looped its lenght is infinite. So, you must add "-shortest" to the command string
opt.Append "-shortest"

' tell FFmpeg the path of the output file. This really can be anything. MP4 will work, too. FFmpeg will automatically add the right container data
opt.Append outputFile.ShellPath

' merge all entries listed above to one command line.
dim cmd as String
cmd = join( opt, " ")

' add a new shell instance and execute the commandline
dim sh as new shell
sh.Execute cmd

' read the result in case you have errors. But using the sh.Result is not required
TextArea1.Text = sh.Result

On this FFmpeg page it also explains how to create a slideshow, using multiple images. Inside the command line string, you can even resize the images to fill the screen, or assign crops. That is all explained on the FFmpeg doc pages.

With FFmpeg you can do so much. The sky is the limit…
(unless you are a Xojo developer for NASA, of course :wink: )

Hi,
Thank you all !
But it looks there is no simple solution. Christian thx for your reply , but i don’t have the knowledge to implement a class or plugin…
i ‘should’ know that,because i am programming for about 17 years now (realbasic,visual basic ,visual C++ etc) but still can’t do such a thing.
I was more thinking : read in a jpg picture and with some(‘boundary’) the next picture… I have a hex-editor …but most of the time it is hocus pocus for me .
To edwin: thx for the code… i already had expected that the FFmpeg would came up… poor me…(but thx).
In javascript i can do picture followup…at least i guess…

Again thx to all,

Frederik

Why do you work with a Hex-Editor? If you need an image sequence stored as a video. Just have a look at the link in my previous post.

[quote=334263:@Frederik Pot]To edwin: thx for the code… i already had expected that the FFmpeg would came up… poor me…(but thx).
In javascript i can do picture followup…at least i guess…[/quote]

If you download FFmpeg (you could also put it on your desktop, and make sure the FolderItem points to that), and copy / past the code into a new project, you could then try to tinker with it.
FFmpeg is really not that hard. At least, to get this thing you want. There are tons of things with FFmpeg that still puzzle me. But this, image-to-video thing is actually a very easy thing to do.

Christian’s documantation is usually pretty complete. And it includes examples for most of his plugins.

Install the plugin and try the example project.
This is a simple class and you only need our JPEG and Main plugins.