Tag Archives: video

Video Conversion Script for ffmpeg

Once and a while I have to convert a video made with Cheese, a .webm, or one made by my camera, .mov to an MP4 which takes up the least amount of space (as of 2017) and seems to be supported across a lot of devices.

The script is both a script to run and a reminder as to the syntax that ffmpeg expects as I seem to occasionally forget and wanted a snippet on line as a quick go to for reference.

In this one scaling is applied via the -s option and the bandwidth via the -b option is limited as well. Plus it allows you to choose the filename for the output file.

If ffmpeg -i %1 %1.mp4 is used for example it would take the input file and convert to mp4, tacking on the mp4 extension with no scaling and bandwidth limiting.

#! /bin/bash
#ffmpeg -i input.wmv -s 480x320 -b 1000k output.mp4
ffmpeg -i %1 -s 480x320 -b 1000k %2

Better Yet Do It Batchwise

For example, with a for loop, this code will simply go through the directory and convert all .webm’s to .mp4’s and it is set up to do scaling too if needed using -s hd480. It also keeps the same filename by changes the extension to the appropriate one for the output file.

#!/bin/bash

for a in ./*.webm; do
#  ffmpeg -i "$a" -qscale:a 0 "${a[@]/%webm/mp4}"
  ffmpeg -i "$a" -s hd480 -qscale:a 0 "${a[@]/%webm/mp4}"
done

 

avconv replaces ffmpeg for Video/Audio Conversion

Recently I wanted to convert an AVI file to an m4v on Linux Mint 17.3. I tried to use ffmpeg, it’s not there. I can’t isntall it…hmmm. So I did some digging, it has been replaced by avconv. To get avconv….

sudo apt-get install libav-tools

To use

Online, I read that there are some syntax differences between ffmpeg and avconv, so I was reluctant to just symlink pointing ffmpeg to avconv and have scripts break.

But I did a quick test taking a good guess…

avconv -i timelapse-wx-station-4-08-to-7-12-2016.avi timelapse-wx-station-4-08-to-7-12-2016.m4v

…and, it worked. Got me a much smaller file than the AVI and worked it’s magic in a short minute or two.

Video of Weather Station from April 8,2016 to July 12,2016

This was what I was testing out with the conversion. Video taken by using fswebcam to gather a still shot of my weather station once per hour on the Raspberry Pi. Once per day the shots are rolled up into an AVI video and stored in a tmp folder which is mounted in RAM. Well the RAM folder does fill up after a while and I copied the file off and saved it on my desktop. This video shows the weather changing from spring to summer.

Resources

http://askubuntu.com/questions/432542/is-ffmpeg-missing-from-the-official-repositories-in-14-04

 

Kombucha with SCOBY

Kombucha SCOBY Timelapse Video

I ran a webcam pointed at a fermentation of Kombucha capturing frames using fswebcam running on a Raspberry Pi server. It ran for a few weeks.

You can see the Kombucha SCOBY’s forming in the video. The setup is behind the PC monitor with a desk lamp and camera pointing towards the back of the desk. This gives fairly steady ambient lighting. I grew a dozen SCOBY’s for the Summer Fermentation Class that was held on June 29th 2015.

SCOBY Timelapse Video AVI Format 8 frames/sec

The video should be viewable most of the time unless I am servicing the Raspberry Pi or I pulled the plug on it during a nasty storm.