5

During the day I take pictures from the camera every minute. I would like to make a video from the images. 1 day -> 1 video

I use mencoder to do that at the end of the day like this: mencoder "mf://*.jpg" -mf fps=25:type=jpg -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:vbitrate=7000 -vf scale=1024:768 -oac copy -o movie.avi It works fine, BUT:

The problem is that i need to do it on Raspberry Pi (700MHz ARM) and it takes him about an hour to make the video from 1500 photos taken during the day (it works at about 0.5 fps).

Is there any way how to make the video "continuously" - how to pass each picture to the mencoder right after it is taken - and stop making the video every day at midnight? It would then just take a picture, process it for a 2-3 seconds and wait for another minute to do it again.

Thanks.

user2193024
  • 51
  • 1
  • 2
  • Do you need to use mencoder or can you use ffmpeg? (I have a fully tested ffmpeg solution) – Jean Mar 20 '13 at 22:58
  • I could use ffmpeg, no problem. How can i do it using ffmpeg? Thank you. – user2193024 Mar 21 '13 at 07:33
  • Perfect. THen, I was able to answer your question. For `ffmpeg`. Maybe you can edit your post and update the title, so that other users interested with this topic can find it. – Jean Mar 21 '13 at 12:10

2 Answers2

1

This does not provide the answer for mencoder, but for ffmpeg as allowed in the comments.

Requirements:

  • All pictures must be consecutively numbered (i.e. picName1.png, picName2.png, etc.)
  • All pictures must be in the same folder.
  • You must have the latest version of ffmpeg since the options recently changed

To create your video use:

ffmpeg -r fps -f image2 -i '/path/to/your/picName%d.png' -qscale 0 '/path/to/your/new/video.avi'
  • Replace fps by the desired frame rate (10, 25, 30, etc) fps.
  • Replace /path/to/your/picName by the actual path, but leave the %d which tells ffmpeg to put a number there.
  • Replace /path/to/your/new/video.avi by your selected destination.

The video created this way will be of the highest quality. You can adapt the quality to match your video size requirements using the -q option.

See the man page for ffmpeg for more explanations.

Unfortunately, to my knowledge, there is no way to pass one picture every few minutes or so. I would suggest one of the solutions below:

  • Compile the video once a day, at midnight. You get it at 1 am.
  • Compile the video several time a day, if you need to look at it. That's a lot of wasted processing, since you process the whole lot each time.
  • Compile the video by chunks (every 2 hours for instance) and merge all videos at the end of the day.

If you don't need to look at the video during the day, then the first solution is the easiest.


Below is a quote from the man page:

For creating a video from many images:

ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi The syntax "foo-%03d.jpeg" specifies to use a decimal number composed of three digits padded with zeroes to express the sequence number. It is the same syntax supported by the C printf function, but only formats accepting a normal integer are suitable.

Jean
  • 7,623
  • 6
  • 43
  • 58
  • 1
    Well, I tried this. It takes all the pictures in the folder, makes video and exits (just like my mencoder example above). But is there a way how to add images very slowly - for example one image in 2 minutes - like I wrote above (last paragraph of my question)? – user2193024 Mar 21 '13 at 19:11
  • @user2193024 No, you can't. But why don't you make the video once a day at midnight? It would take one hour. You start it at midnight and get the video at 1 am. You can even generate previews during the day. – Jean Mar 21 '13 at 19:24
1

Why don't you just make a video from pictures every hour or so, and merge it with your existing video?

Merge videos with:

mencoder -oac copy -ovc copy -idx -o daily.avi this_hour.avi

You do this every hour or so, and then at the end of the day your daily.avi will be a merge of all the images.

lenooh
  • 10,364
  • 5
  • 58
  • 49