ADAM'S WEB PRESENCE

21 July 2007

Concatenating AVI files

Filed under: Nerd Notes — adam @ 6:10 pm

Here’s a small but useful shell script to concatenate any number of AVI files. It works great on Ubuntu and should also work on other UNIX-based systems as long as you have mencoder installed.

To use it, just put the name of each file on the command line in order and they will be all joined together into one big file called joined.avi

#!/bin/sh

# catavi - Script to concatenate multiple AVI files.
# by Adam Pierce http://www.doctort.org/adam
#
# Note: The AVI files must be of the same format (eg. same codec, frame size etc).
#
# This script is freeware. You can use it, copy it, change it, whatever.

TEMPFILE=/tmp/avitmp

cat "$@" > $TEMPFILE

mencoder -forceidx -oac copy -ovc copy $TEMPFILE -o joined.avi

rm $TEMPFILE

Usage example:

./catavi movie-part1.avi movie-part2.avi


18 July 2007

NCURSES Weirdness on Linux Console

Filed under: Nerd Notes — adam @ 5:15 pm

I’ve been writing an application using ncurses under Linux. Everything was going fine until I tried to run it on the Linux console (all my testing had been in an xterm). Suddenly all my borders and fields were all over the place and stuff was not being rendered correctly.

After a lot of research, I found that there are some problems with the Linux TERM settings. To cut a long story short, there is a real simple fix. you just need to print a certain magic escape code and the problem goes away.

So as the first line of my program, I put this:

cout << "\\033c";

In C, that would be:

printf("\\033c");

You can even do it from a script:

echo -ne "\\033c"

It took a lot of Googling to figure that out. I’m not sure exactly why it works but there you go.

For the record, I am using Debian “stable” with kernel 2.6.18.


Powered by WordPress