Creating a Motion JPEG frame by frame with variable frame-rate
Asked Answered
T

1

4

I'm analyzing a number of solutions to the problem that I have in hand: I'm receiving images from a device and I need to make a video file out of it. However, the images arrive with a somewhat random delay between them and I'm looking for the best way to encode this. I have to create this video frame by frame, and after each frame I must have a new video file with the new frame, replacing the old video file.

I was thinking of fixating the frame-rate a little "faster" than the minimum delay that I might get and just repeat the last frame until a new one arrives, but I guess that this solution is not optimal.

Also, this project is made with Delphi (no, I cannot change that) and I need means to turn these frames into a video file after each frame. I was thinking about using mencoder as an external tool, but I'm reading the documentation and still haven't found an option to make it insert a frame in an already encoded Motion JPEG video file. As my images come in as JPEG, I thought that it would be reasonable to use Motion JPEG, but not even this is certain yet. Also, I don't know if mencoder can be used as a library. It would help a lot if it did.

What would you suggest?

Thermionic answered 6/3, 2012 at 12:48 Comment(0)
S
2

There are some media container formats that support variable frame rate, but I don't think MJPEG is good choice because of the storage overhead. I believe the best way would be to transcode JPEG frames to MP4 format using both I-frames and P-frames.

You can use FFMPEG Delphi/FP header files for the transcoding.

Edit:

The most up to date version of FFMPEG headers can be found at GLScene repository on SourceForge.net. To view the files you can use this link

Splenic answered 6/3, 2012 at 19:28 Comment(6)
Wow, something like this I desperately need as well. Look carefully at the version numbers of avformat-??.dll. From the link provided you get version 50 while the code specifies 52. Next you need to download swscale-0.dll which you can download from dll-file-download.com/dll-files/…. I'll experiment further, if someone got it working I am interested to hear.Crampton
Actually the most up to date version that I could find which matches the latest DLLs can be found at GLScene repository on SourceForge.net. The SVN view link is: glscene.svn.sourceforge.net/viewvc/glscene/branches/…Splenic
Well, avcodec needs ctypes and that needs successive more files which I can't find on sourceforge. Something seems to be missing, any ideas?Crampton
Goto gtk.org/download/win32.php then download required package. If you are not sure, download all-in-one bundle from ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/…Splenic
I'm afraid this is not gonna work. It does not contain the required functions like cTypes, cUtils etc. I give up for now. Thanks very much for your time and advice. I'll ask the same question in a more general way.Crampton
@Arnold: I already use it without any problem. It has more than required modules, so I removed some DLLs also. ;)Splenic

© 2022 - 2024 — McMap. All rights reserved.