Jump to content
Electronics-Lab.com Community

Time Lapse Photography using UVC camera and SD Card -- Ameba Arduino


MENG XI

Recommended Posts

Realtek's ameba dev. board is capable of USB OTG and SDIO thus making it possible to take photo with a UVC camera and store it in a SD card via SDIO. Here, combining these 2 function, one can easily create a Time Lapse Photography with merely an arduino size MCU. Here is a tutorial about it,

 

Preparation

  • Ameba x 1
  • SD card or MicroSD card x 1
  • SD sniffer x 1 (optional)
  • Logitech C170 web cam x 1
  • Micro USB OTG adapter x 1

Example

In this example, we use UVC to take photos and save to SD card at regular time, which is similar to time lapse photography.
Open the sample code in "File" -> "Examples" -> "AmebaSdFatFs" -> "time_lapse_photography"
In the sample code, we start the UVC at first, then initialize SD FAT FS. In loop(), use UVC to capture photo every three seconds, and the captured photos are numbered in 0001.jpeg, 0002.jpeg, 0003.jpeg, ...
1
There are some tools to turn these photos to a video. We use ffmpeg here: https://ffmpeg.org/
In Windows OS environment, type the command in the directory of all UVC photos:
ffmpeg -framerate 30 -i %04d.jpeg -vf fps=30 -pix_fmt yuv420p output.mp4

 

The explanation of the arguments in the command:
-framrate: By specifying this argument, you tell ffmpeg to use the time handled by framerate to be the timeline. Here we use 30, which means in 30 photos are displayed per second.
-i: use this argument to specify input file name. We use "%04d.jpeg" to tell ffmpeg to read the files from 0000.jpeg, 0001.jpeg, 0002.jpeg, ...
fps: the framerate of output video, we use 30 frames per second here.
The last argument is the output file name.

Demo video:

Code reference

The sample code is comprised of two parts: use UVC to capture photo, and write file to SD card.
The UVC part please refer to previous "UVC – Use UVC To Send Image" example.
And SD part please refer tp the "SDIO – Edit Files In SD Card" example
Link to comment
Share on other sites


Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
  • Create New...