Monday, November 21, 2011

ffmpeg, joining video files

A few multimedia containers (MPEG-1, MPEG-2 PS, DV) allow to join video files by merely concatenating them.
Hence you may concatenate your multimedia files by first transcoding them to these privileged formats, then using the humble cat command (or the equally humble copy under Windows), and finally transcoding back to your format of choice.
ffmpeg -i input1.avi -sameq intermediate1.mpg
ffmpeg -i input2.avi -sameq intermediate2.mpg
cat intermediate1.mpg intermediate2.mpg > intermediate_all.mpg
ffmpeg -i intermediate_all.mpg -sameq output.avi
Notice that you should either use -sameq or set a reasonably high bitrate for your intermediate and output files, if you want to preserve video quality.
Also notice that you may avoid the huge intermediate files by taking advantage of named pipes, should your platform support it:
mkfifo intermediate1.mpg
mkfifo intermediate2.mpg
ffmpeg -i input1.avi -sameq -y intermediate1.mpg < /dev/null &
ffmpeg -i input2.avi -sameq -y intermediate2.mpg < /dev/null &
cat intermediate1.mpg intermediate2.mpg |\
ffmpeg -f mpeg -i - -sameq -vcodec mpeg4 -acodec libmp3lame output.avi
Similarly, the yuv4mpegpipe format, and the raw video, raw audio codecs also allow concatenation, and the transcoding step is almost lossless. When using multiple yuv4mpegpipe(s), the first line needs to be discarded from all but the first stream. This can be accomplished by piping through tail as seen below. Note that when piping through tail you must use command grouping, { ;}, to background properly.
For example, let’s say we want to join two FLV files into an output.flv file:
mkfifo temp1.a
mkfifo temp1.v
mkfifo temp2.a
mkfifo temp2.v
mkfifo all.a
mkfifo all.v
ffmpeg -i input1.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp1.a < /dev/null &
ffmpeg -i input2.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp2.a < /dev/null &
ffmpeg -i input1.flv -an -f yuv4mpegpipe - > temp1.v < /dev/null &
{ ffmpeg -i input2.flv -an -f yuv4mpegpipe - < /dev/null | tail -n +2 > temp2.v ; } &
cat temp1.a temp2.a > all.a &
cat temp1.v temp2.v > all.v &
ffmpeg -f u16le -acodec pcm_s16le -ac 2 -ar 44100 -i all.a \
       -f yuv4mpegpipe -i all.v \
       -sameq -y output.flv
rm temp[12].[av] all.[av]

Thursday, November 17, 2011

redhat install notes

install a package
rpm –ivh packagename
upgrade a package
rpm –Uvh packagename

create a tar file
tar –cvf myfiles.tar mydir/
(add z if you are dealing with or creating .tgz (.tar.gz) files)

standard install from source
tar –xvzf Apackage.tar.gz
cd Apackage
make install

Wednesday, November 16, 2011

removing bad characters from file names

this will clean bad characters (such as \1b and \1f and \7f's) from a file and convert them to underscores

for file in *
mv “$file” $(echo “$file” | sed ‘s/[^A-Za-z0-9_.]/_/g’)

svn password snafu workaround

sometimes svn will emit the following message when trying to do a write:

svn gnome keyring is locked and we are non-interactive

the workaround is to change the default config to use local svn if you are not using svn+ssh to access the svn database.

this is done by altering the default client config file in the ~/.subversion directory.

Change to add the line in the auth stanza:

to get it to use the "old" way.  The current config which is shown in the config file is password-stores=gnome-keyring,kwallet.  This is actually compiled in and is the default behavior.

There is apparently no path to actually "unlock" the gnome keyring for subversion if it has not been unlocked and that credential set, so it will emit the error message forever and is a bug.  This is just a document of the workaround.

Monday, November 14, 2011

two gtk menu examples

menu factory and menu program for small examples

to compile:

g++ main.cpp -Os -s `pkg-config gtk+-2.0 --cflags` `pkg-config gtk+-2.0 --libs`

create itemfactory as a .c file or you will get a huge list of deprecated error messages

here is tree example for GTK 2.0

svnserve init / startup script for ubuntu

One needs to create a script in /etc/init.d to ensure that svnserve is started at boot time.

A script with start, stop and restart (and optionally status) can be created, but a simple script which just starts the server will suffice.

#! /bin/sh
# svnserve
# start svn server


case $COMMAND in
svnserve -d -r /home/jws/svnserver/repository
killall svnserve

the script can be installed into the init.d with the following:

update-rc.d svnserve defaults

Multiple repositories on same server:

make a directory called "repositories"
place all repositories in that directory.

start svnserv with that directory, rather than a pointer to a single repository.

Each repository is independent, with a separate url.


svn://host/local is one base repo.
svn://host/globalmt is the other base repo

migrate cvs to svn:

cvs2svn can be installed on Ubuntu with apt-get

with a directly addressable copy of the cvs repository data, one can run the cvs2svn and produce an svn repository file structure with the migrated data.

cvs2svn -s <svn repo name> /cvs/cvsroot/modulename

Wednesday, November 9, 2011

microsoft xp file sharing

This addresses problems when a system is taken out of a domain and it is placed on a workgroup type network.  A number of settings won't be correct and have to be changed to share files on the machine.

turn on simple file sharing:
open folder options, make sure simple file sharing is on.

make sure restricted anonymous access is off (if need be)

thunderbird profiles

start->run->%appdata%  ... thunderbird->profiles