accelerate lame mp3 conversion 30. Apr 2011
If you have to handle a large number of audio files with the lame mp3 encoder you will want to accelerate the conversion process. Since lame doesn’t natively support multithreading, I decided to use GNU parallel. First I tried the default setting:
ls | parallel lame -V0 {} ../Output/{}
This spawns 9 processes and gave me an acceleration of 1.5x. Then I tried using more processes to see if I could further accelerate the process:
ls | parallel -j 12 lame -V0 {} ../Output/{}
This gave me an acceleration of 1.7x, which is quite nice. I guess you’ll just have to play around to find the “magic value”.
download videos from vimeo 17. Apr 2011
Check out this shell script for downloading videos from Vimeo.
download the daily show 17. Apr 2011
Check out this shell script for downloading episodes of The Daily Show.
dumping an rtsp mp4 stream 15. Apr 2011
One way to dump an rtsp mp4 stream on Linux or Mac OS X is to use VLC:
cvlc --sout=file/mp4:video.mp4 --rtsp-tcp rtsp://stream.mp4
An alternative is to use MPlayer:
mplayer -dumpfile video.mp4 -dumpstream rtsp://stream.mp4
For this to work you’ll need to have it compiled with Live555 suport. You can also try your luck with openRTSP:
openRTSP -4 rtsp://stream.mp4 > video.mp4
If you install Live555 via MacPorts then you won’t find the binary in your regular path, instead it’s nested in the library folder:
/opt/local/lib/live/testProgs/openRTSP
windows deployment with sfx stubs 28. Mar 2011
Event though you are working on a Unix or Unix-like system you might still sometimes have to reach out to Microsoft world. This is fine as long as long as you have full access to the system you want to administer, but often you are dependent on some other Person to carry out a deployment. Maybe this person is not so computer savvy, so you would be interested in making the process as easy as possible. Ideally it would be a one-click task.
If you were to carry the deployment out yourself you might just create an ordinary compressed archive. If you are dependent on some other person to carry out the deployment this approach might fail for at least two reasons. First, the machine might not have a proper extraction program installed. Second, the person might be overwhelmed by the user interface of the extraction program. As a more robust alternative you can create self-extracting windows achives with a .exe extension. On Mac OS X or Linux it might not be completely obvious how to acomplish this.
Let’s say we have a directory named foobar which contains setup.exe and a bunch of other files. One possibility is to use the sfx stub from UnZip.
First you download and extract the Windows installer.
wget ftp://ftp.info-zip.org/pub/infozip/win32/unz600xn.exe
unzip -d unz600dn unz600xn.exe
Then create a regular archive of your data and concatenate the stub and the archive to form the self-extracting archive.
zip -r archive foobar
cat unz600dn/unzipsfx.exe archive.zip > archive.exe
Alternatively you can use the sfx stub from 7-Zip. This has the advantage that you can specify a binary that is to be executed after the extraction.
First you need to create a config.txt with the configuration data
;!@Install@!UTF-8!
RunProgram="foobar\setup.exe"
;!@InstallEnd@!
Next you need to install 7-Zip. On Mac OS X you’d install p7zip with MacPorts.
sudo port install p7zip
Then download and extract the 7-Zip extras.
wget http://downloads.sourceforge.net/sevenzip/7z920_extra.7z
7z x -o7z920_extra 7z920_extra.7z
Next create a regular archive of your data and concatenate the stub, the configuration file and the archive to form the self-extracting archive.
7z a archive foobar
cat 7z920_extra/7zS.sfx config.txt archive.7z > setup.exe
You might want to check out the advanced options the configuration file.