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?

ivarec
  • 2,414
  • 2
  • 28
  • 50

1 Answers1

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

Vahid Nasehi
  • 445
  • 5
  • 9
  • 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 http://www.dll-file-download.com/dll-files/?classid=19&id=16612&pathid=0. I'll experiment further, if someone got it working I am interested to hear. – Arnold Mar 07 '12 at 17:25
  • 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: http://glscene.svn.sourceforge.net/viewvc/glscene/branches/GLScene_1_2_0/Source/FFmpeg/ – Vahid Nasehi Mar 07 '12 at 20:15
  • Well, avcodec needs ctypes and that needs successive more files which I can't find on sourceforge. Something seems to be missing, any ideas? – Arnold Mar 07 '12 at 20:48
  • Goto http://www.gtk.org/download/win32.php then download required package. If you are not sure, download all-in-one bundle from http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip – Vahid Nasehi Mar 08 '12 at 00:25
  • 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. – Arnold Mar 08 '12 at 18:24
  • @Arnold: I already use it without any problem. It has more than required modules, so I removed some DLLs also. ;) – Vahid Nasehi Mar 08 '12 at 21:11