Introduction: Wireless All Sky Camera

An all sky camera is a device designed to take pictures of the entire sky over a certain amount of time, usually to monitor meteor showers or other astronomical phenomena.

I built mine to monitor the northern lights. I live in the Yukon and we sometimes get beautiful aurora displays during the night. However, I also have a day time job and I need my 8 hours of sleep. I created this camera to record a movie of the entire night. That way, I can replay the movie in the morning and never miss any aurora night.

Step 1: Requirements and Materials

My requirements for this camera are the following:

  • needs to photograph most of the sky
  • needs high sensitivity to low light
  • should be weather proof
  • no wires should run to the house
  • needs to be autonomous
  • needs to create a movie from pictures and upload it to the internet
  • needs to start at dusk and stop at dawn

After thinking about it for a while, I decided that the device should include its own computer and send the pictures using wifi. As for the camera, I decided to use an astronomy camera that would be small enough and was powered over USB.

Here's the list of materials:

  • ASI224MC camera from ZWO (ASI120MC or MM works too and is cheaper)
  • wide angle lens Arecont 1.55 (It gives a wider field of view than the lens that comes with the camera)
  • Raspberry Pi 2 (or 3)
  • 64 GB micro SD card
  • Wifi module (no need if Raspberry Pi 3)
  • Short right angle USB cable
  • 4" ABS pipe with end caps
  • Acrylic dome

I thought about adding a dew heater but after a few month of testing, I never got any frost on the acrylic dome. This is possibly due to the heat produced by the raspberry pi itself.

Step 2: Wiring

In this instructable, I will assume that you already have raspbian installed on the SD card.

The wiring is relatively easy. Plug the USB cable to the camera on one side and the raspberry pi on the other. Plug the wireless dongle into one of the 3 remaining USB ports of the pi. Insert the micro SD card in its slot and plug the raspberry pi to its 5V adapter.

In order to keep things tidy, you can fix your camera and computer onto a plywood board like I did on the picture.

Step 3: Build the Enclosure

The enclosure is made of a 4" ABS pipe, a flat end cap and a threaded end cap with its lid.

The flat cap goes on top and is drilled to the diameter of the camera. The threaded cap goes at the bottom and a hole (for the extension cord) is drilled in the centre of the lid.

The acrylic dome can be fixed onto the top end using weather proof silicon. I used an acrylic ring but it makes things more complex than they need to be.

You can now fix the enclosure onto your deck, your roof or any other location with a good view of the sky.

Step 4: Software

Update: If you need to change the way the capture works, you might have to make changes to the C++ source and compile it on your Raspberry PI. To do this, follow PeterD192's detailed instructions in the comments.

Update 2 (Nov 11th 2016): I have set up a GitHub page with an install script to make things easier for everyone: If you use it, you shouldn't have to use any of the following instructions.

Original Instructions:

In order to capture images with the camera, we need to run a program in the terminal. ZWO provides an SDK in order for developers to communicate with the camera. Using this SDK, I modified one of their C++ example and compiled it for the raspberry pi. Here's a list of dependencies that need to be installed in order to get the program running.

  • OpenCV to capture the image of the sky (You can get a compiled version here)
  • Sunwait to calculate the civil twilight of your location. There is a compiled version in the archive. Make sure you copy it to your path:
    sudo cp ~/allsky/sunwait /usr/local/bin
  • Required dependencies:
    sudo apt-get update && sudo apt-get install libusb-dev libav-tools gawk lftp entr imagemagik

To make things easy, I have attached an archive. Extract it at /home/pi/allsky.

From the lib folder, you will need to run this in order to use the camera without being root:
sudo install asi.rules /lib/udev/rules.d

You will also need to add to your library:
sudo cp ~/allsky/lib/armv7/libASICamera2* /usr/local/lib

Another thing you will need to do in order to automate everything is to run the main program on startup of the pi. You can open ~/.config/lxsession/LXDE-pi/autostart and add this line:
@xterm -hold -e ~/allsky/

Remember to set your wifi connection in order for the pi to upload videos. contains all the parameters you might want to play with: GPS coordinate, white balance, exposure and gain.

Step 5: Collect Images

Now that the raspberry pi is ready, you can plug your all sky camera. The startup script should call which in turn calls the binary file named "capture". It will determine if it's day time or night time. In case it's night time, the capture will start and take a picture every 5 seconds (or whatever value you set in At the end of the night, the capture will stop and avconv will stitch them together and upload a video to your website using FTP.

Step 6: Watch Your Time Lapse Videos

The video produced by avconv should weigh between 30 and 50 mb depending on the length of the night (here in the Yukon, we can get from 18 hours to 0 hours of night time) and should be viewable on any web browser.

In the event that you find something interesting in the video, you can access the individual images on the raspberry pi. They will be in a folder named after yesterday's date.

Here's a page showing my own videos with almost all night archived starting January 18th 2016. Some have beautiful northern light, others have clouds, snow or rain.


apo77 made it! (author)2017-05-24

Hi Thomas,

My Allsky cam is working fine and can save images, creating mp4, uploading image to my webpage. But... it can not properly work for a whole day, sometime 2 hrs, sometime 4-6 hrs, then stop working. The Raspbian system still working for web browsing, or can manually restart the

Tried to swap cameras, use Lan or wifi for image uploading, replaced MicroSD cards, replaced USB power supplies, disable the screen off and power saving process, also tried to stop the image resize process but all no success to make the allsky process run for longer than 12 hours.

I discovered the process is running smoother at daytime period (no image saving and uploading). As the uploading to FTP file size is quite large (~600kb when lens is coved, ASI120 MM/MC) for my ADSL internet service, i tried to reduce the image quality to cut the file size to improve the uploading speed. However, even i modified the quality values from 95% to 50% but the uploading file size stills no change (~600kb when lens is coved). May be this is normal for a totally dark image.

Any suggestion to me for my trouble shooting? Thanks in advanced.


ThomasJ1 made it! (author)ThomasJ12017-05-24

Hi Raymond,

Regarding the file size, I have an ASI224MC and it's rare for me to upload files larger than 250kb. That's when I have lots of features on the image (clouds or aurora). For a black image that should be much less. What are your settings? Can you paste the content of

Try decreasing the size of the image before upload instead of decreasing the quality. Also make sure to use JPG instead of PNG to cut the size even more.

This is what I use for example in convert "$1" -resize 962x720 -gravity East -chop 2x0 "$1-resize.jpg";

Regarding the instability, I had the same kind of problem when my SD card started to fail. Like any computer, when there is a power cut or an improper shutdown, some blocks of memory can get corrupted during a write operation and lead to an unstable operating system. You said you swapped the micro SD so we can probably rule that out.

When you say it stops working, does it crash? Is there any message in the console?


apo77 made it! (author)apo772017-05-25

Hi Thomas,

Thanks for the reply. I use the default setting and using same script as yours for image resizing. Also tried to use size reduced images for FTP upload. Just changed the FTP address to my site. I will show the contents of my when back to home tonight.

There is no error message in the command console and no crash. Desktop and console are normal except the allsky process is stopped but it stills showing 7-8% cpu usage for capture process in the task monitor.

I started with "capture" only last night (without saving image and uploading process) after dinner and found it can run until the timelapse conversion is done at morning.


Below is the script of the all



echo "Starting allsky camera..."

cd /home/pi/allsky


# Set upload to false if you don't want to upload the latest image to your website


# Set -help to 1 for full list of arguments

# Set -nodisplay to 1 on Raspbian Lite and other OS without Desktop environments

ls "$FILENAME" | entr ./ "$FILENAME" "$UPLOAD" & \

./capture \

-gain 150 \

-exposure 5000000 \

-filename "$FILENAME" \

-latitude "22.27N" \

-longitude "114.08E" \

-wbr 53 \

-wbb 80 \

-textx20 \

-fontcolor255 255 255 \

-time 1 \

-help 0 \

-nodisplay 0 \

-timelapse 1

ThomasJ1 made it! (author)ThomasJ12017-05-25

Hi Raymond, the fact that capture is still running is a good sign. That means the issue comes from one of the scripts.

Just to make sure though, is your time set correctly on your Pi? I see from your GPS info that you are in Hong Kong. There's a binary called sunwait that return the civil twilight for your given GPS coordinates. Let's say that the civil twilight at sunrise happens at 5:30am, then the capture will stop capturing images at 5:30am but it will continue running in the background until it's dark again. So it's important that your Pi clock is set correctly.

Can you also run a session where you are just saving images but not uploading? If it runs fine, we'll know it probably breaks during upload.

Also, you could try adding -width 640 and -height 480 to reduce your image size by 4 and see if it works better.

apo77 made it! (author)apo772017-05-25

Hi Thomas,

Yes, have double checked the system time is correctly setup. Tried to set for local image saving only, can't pass for 10 hrs. Tried reduce the image size to 70% before current saving and FTP upload, can't pass for 10 hrs. The most longest working mode is to allow capture image only (this process is continue running even at day time but no current image saving and FTP upload), it can pass 12 hrs until the is triggered. I will disable the timelapse to see if it can run longer.

I will find heatsinks or cooling fan for the pi3 board to see if it can get some improvement. Will also find a faster MicroSD card for it (now using Sandisk 60/90Ms Ultra). BTW, what kind of MicroSD card you are using? Thanks again!


ThomasJ1 made it! (author)ThomasJ12017-05-26

Hi Raymond,

I have a 64GB Samsung evo. It works great. The heat sink is a good idea. Here in the Yukon the nights are cold so I never worried about overheating but it may be a problem in your location. Especially if it is enclosed in a small container. You should check the temperature when it's running:

Also, since your image file is fairly large, I would increase the delay between images to give some time for the Pi to write the camera sensor data on file. You can use the option -delay 1000 to have a 1 second delay between shots (the default is 10ms).

apo77 made it! (author)apo772017-05-30

Hi Thomas, i can't find any other solution to fix my case. Bought faster Samsung 128G EVO+ 90/100MB/s card, can't fix. Added 3 heat sinks and cooling fans, can't fix. Bought another Pi3 board, can't fix. Replaced with bigger DC supply, can't fix.. may be Pi3 hardware is not designed for me. Will stop the work and to watch any other users report similar issue and able to fix it. Thank you.


ThomasJ1 made it! (author)ThomasJ12017-05-31

Hey Raymond, That's a really strange issue. I just received some Pi 3 and I compiled the code successfully. I runs without issues. Have you tried to add the -delay 1000 option? It is an option that will wait between shots (in ms). I use it for really short exposure. You should also try the -nodisplay 1 option. It saves the images but doesn't show a preview. It would be less CPU intensive. I'll let you know if I get similar behavior reported by users.

apo77 made it! (author)apo772017-06-02

Hi Thomas, already tried to increase wait time to 1000ms before and no big difference. Will follow your advise to try the nodisplay option.

I just checked the system log (/var/log) and found there are so many unknown connection and cron jobs were executed at the background. I just switched off the ssh and vnc sevice to see if it can kill some unknown tasks and let the cam process to run more smoothly.

ThomasJ1 made it! (author)ThomasJ12017-06-02

Oh you're running VNC... I had reports about image artifacts and instability when running VNC. Try without VNC and -nodisplay 1. That should help debugging the issue.

apo77 made it! (author)apo772017-06-05

Hi Thomas,

Problem fixed!! No more process breakdown now after the removal of unwanted process and set nodisplay=1.

Now checking your codes capture.cpp and trying to find solution to let the Allsky cam for capture image.jpg (auto exposure mode) at day time and save long exposure images and timelapse for night hours only. However i may not have enough skill to handle it.

Still waiting if you have free time to add day time capturing feature for this great tools. Thanks!


ThomasJ1 made it! (author)ThomasJ12017-06-05

Hi Raymond,

Glad you got it sorted out. I haven't used the auto exposure option yet. An alternative to that could be to change the content of this function like so:

elseif (result == "DAY") {
asiExposure = 50000; // 50 ms for example
ASISetControlValue(CamNum, ASI_EXPOSURE, asiExposure, ASI_FALSE);
cvSaveImage( fileName, pRgb );

I haven't tested it but that would take images at 50ms during the day. That's not auto exposure but that a quick way of getting it to work.

You'll have to run: make capture again to compile the new code.

apo77 made it! (author)apo772017-06-05

Hi Thomas,

Tried to append your scripts under the line } else if (result == "DAY") {

asiExposure = 50000; // 50 ms for example
ASISetControlValue(CamNum, ASI_EXPOSURE, asiExposure, ASI_FALSE);
cvSaveImage( fileName, pRgb );

It can capture 1 short image but then program window quit away.


jeremy_jackson made it! (author)2017-05-28

Hi Thomas,

Installed on Raspbian Jessie Pixal 4-20-2017 and when I launch via ./capture the program exits with Gtk warning ** cannot open display.

I am running via ssh and set nodisplay=1

Thanks for any help!


jeremy_jackson made it! (author)jeremy_jackson2017-05-28

FWIW when I hook a monitor up, a terminal opens and it appears to work.

I hope I am not doing something stupid...

ThomasJ1 made it! (author)ThomasJ12017-05-28

Hey Jeremy,

What happens if you run ./ instead of capture? Also, if it works with the monitor, that's a good start. I have the same version of Raspbian. I will try the -nodisplay 1 option. Also, please note the - before the option and the absence of "equal" sign between the option and the value.

jeremy_jackson made it! (author)jeremy_jackson2017-05-29

Just as I suspected it was something stupid..I was not running allsky but starting capture...I am new to Linux...thanks for the help Thomas.

obrien28 made it! (author)2017-05-12

Hi Thomas,

I recently put together an all sky camera using the ASI120MC-S which is the USB3 version of the camera (couldn't get 2.0 when I bought it) it mostly works but I'm having a lot of trouble with image artifacts, basically a grey band in the bottom of the image, link attached, this seems to alternate every other image leading to a nauseating flicker effect. The second issue is that most nights I have to kill the process after it stops working and restart it from scratch, I run the all script headless by passing it into nohup ./ > /dev/null 2>&1 & maybe that is the issue but I can't imagine why. These two issues have made an otherwise good camera setup somewhat unusable. Any suggestions? Logs I can check? I can provide my script file setup if need.

Thanks, Liam

Grey band:

ThomasJ1 made it! (author)ThomasJ12017-05-12

Hi Liam,

One thing that comes to mind is that the ./allsky script may be running twice on the Raspberry Pi.

The install script creates an autostart script that launches automatically. You can disable that behavior by removing the following line from /home/pi/.config/lxsession/LXDE-pi/autostart:

@xterm -hold -e /home/pi/allsky/ starts a few processes such as: entr and capture. Run ps -aux to make sure that there are no duplicates. If there are, you can kill them from the terminal or restart the Pi after removing the autostart line and start manually with nohup.

Let me know how it goes.


obrien28 made it! (author)obrien282017-05-21

Hi Thomas,

I just wanted to follow up with you about the banding issue, it is still happening and makes a good portion of the image unusable. Any hints or suggestions? Have you tested the software with the USB3 version of the ASI120MC (which I have). Thanks

Grey band:

ThomasJ1 made it! (author)ThomasJ12017-05-22

Hey Liam,

I don't think you would need the firmware upgrade with the USB3 version of the ASI120MC. Most users reported a segmentation fault with the USB2 version and the firmware upgrade fixed it.

I would suggest updating to the latest SDK:

There might be something specific to the USB3 version in their latest release.

I haven't tested the USB3 version myself. I would try to use the camera with oacapture and make sure it works in order to rule out any camera or Raspberry Pi issue:

Let me know if you make any progress on that issue.


obrien28 made it! (author)obrien282017-05-22


TL;DR Update your lib/ and libASICamera2.a to version V0.6.0414, either armV6 or 7 depending on your Pi.

Yes! Updating to the new SDK files seemed to fix the banding issue, time will tell if it still locks up the Pi, does your script or the ZWO lib do any logging? It would help if I had a place to look to try and pinpoint where things are going wrong. Also, it might be worth updating the library files on the github repo, everything else seems to work fine so it must just fix things for the USB3 cameras. Thanks!

ThomasJ1 made it! (author)ThomasJ12017-05-23

Only the headers of the libraries are editable so I don't think I could add logging there. It might be worth looking at dmesg or syslog to see if there's anything there.

ThomasJ1 made it! (author)ThomasJ12017-05-23

Thanks Liam for the feedback. I updated the readme and I will update the repo once I get home. I'm glad it fixes the issue for the USB3 version of the ASI120.

obrien28 made it! (author)obrien282017-05-12

Yeah, I thought that may have been it in the beginning but I removed that line from the terminal config, now I just run the script directly, still getting freeze ups and the banding towards the bottom of the image.

FrankieBUSN made it! (author)2017-03-30

Sorry if this is a duplicate post. It doesn't seem to be showing up. Is there a way to set the exposure to automatic instead of a fixed exposure so that it can run night and day?

ThomasJ1 made it! (author)ThomasJ12017-03-30

Hi Frankie, the documentation of the SDK mentions the auto exposure indeed but this hasn't been implemented in the current version of my code. Here are the available options:

ASI_AUTO_MAX_GAIN,//maximum gain when auto adjust

ASI_AUTO_MAX_EXP,//maximum exposure time when auto adjust,unit is second

ASI_AUTO_MAX_BRIGHTNESS,//target brightness when auto adjust

I will probably try to include those in the future when I get a bit more time to focus on the code. In the meantime, If you are familiar with C++ development, you can modify capture.cpp to include these options.

telescopator made it! (author)2017-03-03

Hi Thomas,

Merci pour vos explications et réponse rapide,thanks for your explanations and fast answer,I think I would go with the ASI224MC ...Which should be still a challenge for me...

Perhaps should I contact you again if in trouble ?

Anyway thanks for the good job already done ;-)!

ThomasJ1 made it! (author)ThomasJ12017-03-03

Please don't hesitate to ask questions if you're having issues during the installation. I'm glad to help.

Also, I forgot to mention that if you want to keep cost down, you can use an ASI120MC-S which is significantly cheaper than the ASI224MC. Maybe a bit less sensitive but if you only use it as an allsky camera, I don't think it would make much difference.

telescopator made it! (author)2017-03-03


I am a new french member and I have discovered this pages as I was trying to find informations on building an all sky camera...I couldn't find better here ;-)!

After decades as amateur astronomer I am more a telescope builder than a computer handyman...So I am hoping just sticking to your explainations to make the system work...

Sorry if the following question should be a silly one but to reduce cost I would like to replace the ASI224MC camera with a GP224C (which is a Altair GPCAM2 IMX224 colour camera...with same low noise sensor...)

The question is : do I have to change anything on the programming side if I switch to this different camera ?This woul be a big trouble for me...

Thank you for your advice and for sharing all this valuable information with us ;-)!

ThomasJ1 made it! (author)ThomasJ12017-03-03

Hi Telescopator,

I'm also french and a telescope builder ;)

Long story short: I don't think you'll be able to swap the cameras because the code is based on the Software Development Kit provided by ZWO. So basically, in the code, there are functions such as: ASICameraInfo or ASIGetControlValue... which means that it will only make sense when you are trying to talk to a camera made by ZWO.

However, I'm not saying the GP224C can't work with the Raspberry Pi. In order to get it to work, you would need to ask Altair Astro for their SDK and modify capture.cpp. Unfortunately, I don't own an Altair Camera so I can't tell you for sure it would work 100%.

I hope that makes sense.


cheekygeek made it! (author)2017-02-28

Thanks for sharing this great instructable. I have a couple of questions:

1) would it be possible to make this using the new WiFi/BlueTooth Raspberry Pi Zero W? See:

2) I'm curious about substituting cameras. Rather than time lapse still shots, is there a camera that could do the same with video (to capture meteors/fireballs, for example)?

3) What are the attributes one looks for in a good camera for an all-sky system? If color is not important, does one mostly look at sensor size/ LUX sensitivity /signal-to-noise ratio?

ThomasJ1 made it! (author)ThomasJ12017-02-28

The problem you'll encounter with the new Pi zero W is that there's no USB ports on it and you need to connect the camera somehow. I would chose a Pi 3 since it's more powerful, has more RAM and has onboard wifi.

A lot of meteor survay cameras are using NTSC/PAL video format. Most of them use a high sensitivity camera such as the Sony Super HAD II. You will then need to convert the analog signal to digital. In that case you might be able to get away with the USB ports and use the Pi zero.

You mentioned three of the attributes that are crucial to this kind of camera. the larger the pixels, the more signal to noise ratio you will get.

Also for a larger resolution, you'll need a larger sensor... and then in turn a larger lens, which can get costly if you want one with a fast aperture (1.4 or 1.8)

Keep in mind also that a large sensor produces more data and the Raspberry Pi needs to keep up with it.

For meteor, I think a standard Sony Super HAD II 768(H)×494(V) would be enough.

astronomyandrea made it! (author)2017-02-18

Hi Thomas. Sorry. I couldn't edit via terminal, so i opened the file with text editor. Tried to add some entry like gamma value, in the way shown below ( and honestly other ways), but nothing... What should i do?

Anyway last night i caught many meteors with 35'' exposure time, so i'm also trying to modify the code in order to automatically process master dark frames and contain noise.



echo "Starting allsky camera"

cd /home/pi/allsky













ls "$FILENAME-full.jpg" | entr ./ "$FILENAME" & ./capture "$WIDTH" "$HEIGHT" "$BIN" "$MODE" "$GAIN" "$EXPOSURE" "$FILENAME" "$LATITUDE" "$LONGITUDE" "$WBR" "$WBB" "$GAMMA"

ThomasJ1 made it! (author)ThomasJ12017-02-20

Hi Andrea, I think you're using an old version of the code. There was no setting for gamma at the time. I will release a new version probably tomorrow which fixes a few things reported by users. You should check it out. I'll give you heads up when it's published.

astronomyandrea made it! (author)2017-02-16

Hi Thomas, it's a week i'm using profitably our software. Great.

To be honest i have two more questions, if i can.

First, which is the right syntax in order to add to other arguments like gamma, delay, brightness, timestamp ecc. ?. I tried but didn't succeed.

Second, how could frame rate be modified in the timelapse section?. I think default value is 25 fps, isnt it?.

Thanks a lot, i appreciate,


ThomasJ1 made it! (author)ThomasJ12017-02-17

Hi Andrea,

if you open, you will see a few arguments already there. You can add your own at the end, 1 per line, as long as you remember to end the line with a back slash (\). Then save the file and run it: ./

For the frame rate, you'll have to open and modifiy the value "25" in this line:

avconv -y -f image2 -r 25

Replace 25 by the desired frame rate, then save the file. You can run ./ again but you'll have to first remove the files with a number (0001, 0002, etc) because the script will recreate them.

Let me know how it works.

Hofi77 made it! (author)2017-02-09

Hi Thomas!

here the errors:

pi@AllSkyCam:~/allsky $ avconv -y -f image2 -r 25 -i current/%04d.jpg -vcodec libx264 -b:v 2000k current/allsky.mp4

avconv version 11.8-6:11.8-1~deb8u1+rpi1, Copyright (c) 2000-2016 the Libav developers

built on Oct 8 2016 02:37:00 with gcc 4.9.2 (Raspbian 4.9.2-10)

[mjpeg @ 0xa84de0] invalid id 5

[mjpeg @ 0xa84de0] Picture size 57225x64989 is invalid

[mjpeg @ 0xa84de0] mjpeg: unsupported coding type (cf)

[mjpeg @ 0xa84de0] invalid id 254

[mjpeg @ 0xa84de0] mjpeg: unsupported coding type (c7)

[mjpeg @ 0xa84de0] invalid id 173

[mjpeg @ 0xa84de0] Can not process SOS before SOF, skipping

[mjpeg @ 0xa84de0] mjpeg: unsupported coding type (c8)

[mjpeg @ 0xa84de0] palette not supported

[mjpeg @ 0xa84de0] Picture size 65112x47662 is invalid

Input #0, image2, from 'current/%04d.jpg':

Duration: 00:01:45.96, start: 0.000000, bitrate: N/A

Stream #0.0: Video: mjpeg, 25 fps, 25 tbn

Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (current/allsky.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

Output #0, mp4, to 'current/allsky.mp4':

Output file #0 does not contain any stream

pi@AllSkyCam:~/allsky $

ThomasJ1 made it! (author)ThomasJ12017-02-09

In your file, what's your filename? Does it end with jpg or png ?

The timelapse script assumes that you're using .jpg extensions. if your original filename is "image.png" and gets converted to "0001.jpg" you might get errors when reading the image with avconv.

To fix this, I would delete the 0001.jpg, 0002.jpg, etc images and replace .jpg by .png in the following scripts:

convert "$1" -resize 962x720 -gravity East -chop 2x0 "$1-resize.png";

gawk 'BEGIN{ a=1 }{ printf "mv -v ./current/%s current/%04d.png\n", $0, a++ }'


bash && avconv -y -f image2 -r 25 -i current/%04d.png .......

I have a new version of the code to fix this and I'll update the github repo it in a few days.

Let me know if that works for you.

Hofi77 made it! (author)2017-02-07

Hello Thomas!

Now it works but the mp4-file has 0 Bytes :(


ThomasJ1 made it! (author)ThomasJ12017-02-08

Hi Manuel,

was there any errors in the terminal window?

Make sure you remove all the files with a number (0001, 0002, 0003, etc) and the empty.mp4 (0 byte size) but keep all the images with a timestamp and run ./ again.

Look for errors in the terminal and paste them here if you find any.

Hofi77 made it! (author)Hofi772017-02-08

Hi Thomas!

Here the errors in the Terminal:

avconv version 11.8-6:11.8-1~deb8u1+rpi1, Copyright (c) 2000-2016 the Libav developers

built on Oct 8 2016 02:37:00 with gcc 4.9.2 (Raspbian 4.9.2-10)

[mjpeg @ 0xcaade0] Picture size 44542x23456 is invalid

[mjpeg @ 0xcaade0] invalid id 201

[mjpeg @ 0xcaade0] mjpeg: unsupported coding type (c7)

[mjpeg @ 0xcaade0] dqt: 16bit precision

[mjpeg @ 0xcaade0] invalid id 67

[mjpeg @ 0xcaade0] invalid id 36

[mjpeg @ 0xcaade0] Picture size 42221x35226 is invalid

Input #0, image2, from 'current/%04d.jpg':

Duration: 00:02:50.64, start: 0.000000, bitrate: N/A

Stream #0.0: Video: mjpeg, 25 fps, 25 tbn

Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (current/allsky-20170208.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

Output #0, mp4, to 'current/allsky-20170208.mp4':

Output file #0 does not contain any stream

Generating Timelapse

Greetings and thank you for your help :)


ThomasJ1 made it! (author)ThomasJ12017-02-09

Hey Manuel,

What camera do you use and what size are your images? I'm talking about the 0001.jpg.

For example, I have an ASI224 and my 0001.jpg is 962x720 in size. The reason I'm asking is because cameras don't have exactly the same sensor ratio and we might need to adjust the script.
Also, are the images valid? Can you open 0001.jpg?

Hofi77 made it! (author)Hofi772017-02-09

Hi Thomas!

i have the ASI120mm. I can open the 0001.jpg an it is 1280x960 in size.

ThomasJ1 made it! (author)ThomasJ12017-02-09

Ok so we'll try to run the command manually in the terminal in order to locate the error: from your allsky directory, type this:

avconv -y -f image2 -r 25 -i current/%04d.jpg -vcodec libx264 -b:v 2000k current/allsky.mp4

Let me know what errors you get.

astronomyandrea made it! (author)2017-02-06

Hello Thomas;great peace of software, but i have some issues with Raspi P3 and ASI 120MM. First how can i modify delay time without making new code?

Second: from command i get erroneous messages:

mv: ‘./current/0001.jpg’ and ‘current/0001.jpg’ are the same file

mv: ‘./current/0002.jpg’ and ‘current/0002.jpg’ are the same file

mv: ‘./current/0003.jpg’ and ‘current/0003.jpg’ are the same file

mv: ‘./current/0004.jpg’ and ‘current/0004.jpg’ are the same file

mv: ‘./current/0005.jpg’ and ‘current/0005.jpg’ are the same file

mv: ‘./current/0006.jpg’ and ‘current/0006.jpg’ are the same file

mv: ‘./current/0007.jpg’ and ‘current/0007.jpg’ are the same file

mv: ‘./current/0008.jpg’ and ‘current/0008.jpg’ are the same file

mv: ‘./current/0009.jpg’ and ‘current/0009.jpg’ are the same file

mv: ‘./current/0010.jpg’ and ‘current/0010.jpg’ are the same file

mv: ‘./current/0011.jpg’ and ‘current/0011.jpg’ are the same file

mv: ‘./current/0012.jpg’ and ‘current/0012.jpg’ are the same file

mv: ‘./current/0013.jpg’ and ‘current/0013.jpg’ are the same file

mv: ‘./current/0014.jpg’ and ‘current/0014.jpg’ are the same file

mv: ‘./current/0015.jpg’ and ‘current/0015.jpg’ are the same file

mv: ‘./current/0016.jpg’ and ‘current/0016.jpg’ are the same file

mv: ‘./current/0017.jpg’ and ‘current/0017.jpg’ are the same file

mv: ‘./current/0018.jpg’ and ‘current/0018.jpg’ are the same file

mv: ‘./current/0019.jpg’ and ‘current/0019.jpg’ are the same file

‘./current/OCB_Masera-20170206235308.jpg’ -> ‘current/0020.jpg’

‘./current/OCB_Masera-20170206235314.jpg’ -> ‘current/0021.jpg’

‘./current/allsky-20170205.mp4’ -> ‘current/0022.jpg’

‘./current/OCB_Masera-20170207000412.jpg’ -> ‘current/0023.jpg’

‘./current/OCB_Masera-20170207000417.jpg’ -> ‘current/0024.jpg’

‘./current/OCB_Masera-20170207000422.jpg’ -> ‘current/0025.jpg’

avconv version 11.8-6:11.8-1~deb8u1+rpi1, Copyright (c) 2000-2016 the Libav developers

built on Oct 8 2016 02:37:00 with gcc 4.9.2 (Raspbian 4.9.2-10)

Input #0, image2, from 'current/%04d.jpg':

Duration: 00:00:01.00, start: 0.000000, bitrate: N/A

Stream #0.0: Video: mjpeg, yuvj420p, 640x480 [PAR 1:1 DAR 4:3], 25 fps, 25 tbn

[libx264 @ 0x1d88e60] using SAR=1/1

[libx264 @ 0x1d88e60] using cpu capabilities: none!

[libx264 @ 0x1d88e60] profile High, level 3.0

[libx264 @ 0x1d88e60] 264 - core 142 r2431 a5831aa - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=2000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00

Output #0, mp4, to 'current/allsky-20170206.mp4':


encoder : Lavf56.1.0

Stream #0.0: Video: libx264, yuvj420p, 640x480 [PAR 1:1 DAR 4:3], q=-1--1, 2000 kb/s, 25 fps, 25 tbn, 25 tbc


encoder : Lavc56.1.0 libx264

Stream mapping:

Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))

Press ctrl-c to stop encoding

[mjpeg @ 0x1d83280] invalid id 254

Error while decoding stream #0:0

[mjpeg @ 0x1d83280] invalid id 254

Error while decoding stream #0:0

[mjpeg @ 0x1d83280] invalid id 254

Error while decoding stream #0:0

[mjpeg @ 0x1d83280] invalid id 254

Error while decoding stream #0:0

Thanks in advance Thomas.

ThomasJ1 made it! (author)ThomasJ12017-02-06


First, for the delay between images, you should try to add a -delay argument in The value is in milliseconds so if you want 2 seconds between images, you need -delay 2000

Then for the error "... are the same file". That would happen if there's already a file with the same name. To fix it, you should delete all files with a number (0001, 0002, 0003, etc) and keep the ones with a timestamp.

Make sure to remove any .mp4 file too because they would cause an error when generating the new video file.

Then you can run ./ again

This should work properly now.


Hofi77 made it! (author)2017-02-02

Hello Thomas!

I have a problem with timeshift
I've got the error "destination /current.1234.jpg is not a folder"
timeshift file is the original
thank you for your help


ThomasJ1 made it! (author)ThomasJ12017-02-02

Hey Manuel.

The convert and timelapse scripts need a little bit of tweaking since the last time I updated the binary. I will update them once I've tested my latest code.

current.1234.jpg is not a valid name. It needs to be current/1234.jpg

I'll need a little bit more info to debug this one. Can you paste the content of here?

Also, do you already have a "current" folder with all your images saved properly inside of it?

Hofi77 made it! (author)Hofi772017-02-02

Of course i mean current/1234.jpg. Sorry my mistake.
Yes I have the "current" folder (/home/pi/allsky/current) and all images are in that folder.

At the moment I am on the way. Please wait about 30 minutes then I can paste the content of

Thank you very much

About This Instructable




Bio: Most of the things I build usually relate to either astronomy, physics or woodworking in general.
More by ThomasJ1:Planets Photography GuideNewspaper StandSee Through Star Map
Add instructable to: