I want to make a timelapse with my Pi, but rather than storing thousands of images on my small SD card and then spend hours mencoder
'ing the result, I'd like to pipe the raspistill -tl
output (if possible) into mencoder, and get the resulting compressed video when I stop the process.
Since I plan to take 1 picture every 5s, I figure there's plenty of time to append that image to the mencoder video between shots.
Is is possible?
I tried a simple script but have an error:
$ raspistill -a 12 -tl 1000 -t 10800000 -o - | mencoder - -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -o timelapse.avi -mf type=jpeg:fps=30
MEncoder SVN-r37379 (C) 2000-2015 MPlayer Team
Reading from stdin...
success: format: 0 data: 0x0 - 0x0
libavformat version 56.25.101 (internal)
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
I suppose a list of JPG is not exactly what mencoder gets from the input. Any guru here to help me?
edit
With a separate command invocation:
raspistill -a 12 -tl 1000 -t 10000 -o - > test.raw # takes 10 images across 10 s
mencoder test.raw -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -o timelapse.avi -mf type=jpeg:fps=30
This produces a valid video, so there's something in the pipe that doesn't work correctly.
I suppose a list of JPG is not exactly what mencoder gets from the input
. I suppose you're right. Try piping it to a file to see what you're getting (e.g.raspistill -a 12 -tl 1000 -t 10800000 -o - > output
. Then open the output file and see what's there. I don't think it will solve anything, but it may help you figure out what's happening. If piping output doesn't work you could try having it save to the SD, feed the image tomencoder
, and delete it. Sorry I'm not a guru!cat test.raw | mencoder - -nosound ... -o timelapse.avi
should also fail. However, if that's the case I'm not sure there's anything you can do about it.-cache 1024
as an argument tomencoder
(or perhaps a larger number). This is supposed to solve the same error withmplayer
.mencoder
also accepts the cache option and your comment about the buffer made me think this just might work. Sorry my Pi is giving me trouble otherwise I'd try it myself first.