How to get a series of still frames (jpeg) from AWS DeepLens camera

If you’re experimenting with the AWS Deeplens camera, you may find that you want to get a series of sample, still images for experimentation purposes.

If you try to write python code that calls “awscam.getLastFrame()” and works on it in real-time (e.g. saving off numpy arrays or jpegs), you will quickly run into all kinds of memory corruption issues. The camera will also quickly run out of disk space.

A far easier approach is to save off the h264 stream from the camera for a while:

ssh aws_cam@192.168.1.187 cat /opt/awscam/out/ch1_out.h264 > out.h264

Once you feel you have enough video, you can ctrl-c it.

After that you can extract every frame, like so:

/d/software/mplayer/mplayer.exe -hardframedrop -vo jpeg out.h264

Alternately, add the “-sstep 1” argument to do a frame every second.

If you connect to the camera directly with mplayer, you will also see it struggles for a few seconds to catch up, and has corrupted video – the above technique skips all those frames.