Converting Videos and Creating Timelapse from Photographs in Linux

in #linux6 years ago

I've been building a secure entry and logging system for our new local makerspace, and I realized it would be nice to have a timelapse of all the check ins and check outs.

Remembering there is a tool that is related to mplayer, the tool I used for my Tardis, I tried it out. Works out really nice!

First get the tool onto your machine:

sudo apt install mencoder

Next, we need some parameters:

  • o - filename to output
  • oac - copy: copy do not re-encode audio
  • oac - mp3lame: MP3 with LAME.
  • ovc - libavcodec (video codec)
  • ovc:- x264: H.264 codec
  • lavcopts - MPEG-1 video
  • of - output container format

To convert from one format to another you would do:

mencoder input.mp4 -o converted.mp4 -ovc x264

Another example

mencoder input.mov -o output.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg1video -of mpeg

I have found, however, other tools produce more widely compatible files.

But that is not the issue today, we want to convert frames into timelapse. Turns out that is easy too:

mencoder mf://*.JPG -mf fps=5:type=jpg -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o output.avi

You will see something like this:

Flushing video frames.
Writing index...
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.

Video stream: 6271.630 kbit/s  (783953 B/s)  size: 109753533 bytes  140.000 secs  701 frames

That's because I didn't set the frame aspect info - not necessary

To test it, of course, you can run it through mplayer:

mplayer output.avi

Sort:  

I never knew about this. Will give it a try. I kind of get what you are doing, but I don't exactly understand the use case. Do you only take photos on checkout and checkin and you are trying to create a timelapse from that?

Yes the member checks in and out with a QR code so we also take a photo so we can log if it actually was the member

Ok makes sense thanks. Are you gonna do any facial recognition stuff or does someone manually go over the footage? I looked at some AWS facial rekognition service some time ago ,but it was pretty expensive: https://aws.amazon.com/rekognition/ looks really powerful though.

I’ve thought about trying the google tensor stuff but with machine learning so far I’ve only detected it’s a face, not who it belongs to :)

Congratulations @makerhacks! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on any badge to view your own Board of Honor on SteemitBoard.

To support your work, I also upvoted your post!
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

Upvote this notification to help all Steemit users. Learn why here!

Do not miss the last announcement from @steemitboard!

Coin Marketplace

STEEM 0.27
TRX 0.12
JST 0.031
BTC 57654.82
ETH 2888.30
USDT 1.00
SBD 3.60