update the mac os x locate database 10. Mar 2011
By default there is no updatedb command on Mac OS X. The proper way to update the locate database is to call locate.updatedb. The directory in which the executable is located is however not in the default search path, but you can simply create a symbolic link with the proper name:
ln -s /usr/libexec/locate.updatedb ~/bin/updatedb
installing ssh-copy-id on mac os x 10. Mar 2011
By default ssh-copy-id is missing on Mac OS X, but since it’s just a simple bash script you can install it quickly from the official Portable OpenSSH CVS repository:
$ sudo bash -c "cvs -d anoncvs@anoncvs.mindrot.org:/cvs \
get -p openssh/contrib/ssh-copy-id > /usr/local/bin/ssh-copy-id"
$ sudo chmod +x /usr/local/bin/ssh-copy-id
generating a quicktime compliant mp4 23. Feb 2011
I recently went trough a rather nerve recking video reencoding session. I thought my experience might be useful so I decided to document it. Have fun with my protocol!
I recorded a live stream with rtmpdump:
$ rtmpdump --live --host 123.123.123.123 --tcUrl \
rtmp://123.123.123.123/foobar/ --app foobar/
--playpath live -o video.flv --swfUrl
http://www.domain.net/player.swf
The result was saved to a Flash video container with an h264 and an aac stream:
$ ffmpeg -i video.flv
Seems stream 0 codec frame rate differs from container frame rate:
2000.00 (2000/1) -> 25.00 (25/1)
Input #0, flv, from 'video.flv':
Duration: 14:23:34.72, start: 0.000000, bitrate: N/A
Stream #0.0: Video: h264 (Main), yuv420p, 512x288,
25 tbr, 1k tbn, 2k tbc
Stream #0.1: Audio: aac, 44100 Hz, stereo, s16
With 4968987448 Byte (~5 GB) it was quite large. I wanted to have the video in a well accepted format so I tried to use ffmpeg to copy the streams to an mp4 container:
$ ffmpeg -i video.flv -vcodec copy -acodec copy video.mp4
But after processing for a while it threw an error:
Application provided invalid, non monotonically increasing dts to
muxer in stream 1: 171621324 >= 171620310
This seems to be a known error, but I couldn’t find a working fix so I tried a complete reencoding:
$ ffmpeg -i video.flv -vcodec libx264 -crf 15 \
-vpre default -acodec libfaac -ab 128k video.mp4
The file was digested okay but when I tried opening the file in QuickTime Player 7 on Mac OS X I got an error:
An invalid public movie atom was found in the movie
I tried opening it with QuickTime Player X and saving it to a new MP4 container but I got the same error so I decided to give mencoder a spin instead:
$ mencoder -ovc copy -oac copy video.flv -o video.mp4
But it didn’t want to copy the audio stream:
Audio format 0x4134504d is incompatible with '-oac copy',
please try '-oac pcm' instead or use '-fafmttag' to override it.
So I tried copying the video stream, but reencoding the audio stream:
$ mencoder -ovc copy -of lavf -lavfopts format=mp4 \
-oac faac video.flv -o video.mp4
But this resulted in lots of Skipping frame! so tried my luck with HandBrake instead:
$ HandBrakeCLI --input video.flv --output video.mp4 --quality 20 \
--encoder x264 --ab 128 --large-file
The movie was digested okay, but when trying to open it in QuickTime Player 7 this resulted in an error:
The movie contains an incorrect duration
It seemed to me like the problem might be in the header so I trief my luck with MP4Box:
$ MP4Box -add input.mp4 output.mp4
But when trying to open it in QuickTime Player 7 I got an already seen error:
An invalid public movie atom was found in the movie
So I tried to remux with mp4creator:
$ mp4creator -extract=1 input.mp4 input.h264
$ mp4creator -extract=2 input.mp4 input.aac
$ mp4creator -create=input.h264 -create=input.aac -rate=25 output.mp4
But the process hung at the end. I decided to change my strategy and use Matroska as an intermediate format:
$ ffmpeg -i video.flv -vcodec libx264 -crf 15 -vpre default \
-acodec libfaac -ab 128k video.mkv
I installed Perian and used QTCoffee to remux the file:
$ muxmovie video.mkv -mp4 -o video.mp4
Which finally resulted in an MP4 file which was accepted by QuickTime Player 7 and could be edited and saved in QuickTime Player X. To my understanding all these problems were a result of the rather large file size, since they didn’t occur if I tried the steps with a smaller part the movie. The magic boundary seems to be 4 GB, but I didn’t verify that.
oh c'mon cupertino, just lick my ass! 20. Feb 2011
Note: Several Apple applications – namely iTunes, DVD Player, and Front Row, and applications that use QuickTime – prevent the collection of data through DTrace (either temporarily or permanently) in order to protect sensitive data. Therefore, you should not run those applications when performing systemwide data collection. (Quelle: Mac OS X Reference Library)
So don’t be surprised if QTCoffee and qt_tools don’t show anything on the radar!
so what actually is this destroot thing? 11. Feb 2011
When installing software via MacPorts there is an installation state called “destroot”.
---> Staging ruby into destroot
Since MacPorts is rather close-lipped by default I’ve always wondered what’s happening behind the scenes. It turns out some rather meaningful stuff is being done:
Understanding the destroot phase is critical to understanding MacPorts, because, unlike some port systems, MacPorts “stages” an installation into an intermediate location — not the final file destination. MacPorts uses the destroot phase to provide: a) Port uninstalls - a port’s files may be cleanly uninstalled because all files and directories are recorded during install. b) Multiple port versions may be installed on the same host, since a port’s files are not directly inserted into ${prefix} but rather hard-linked into ${prefix} from an intermediate location during a later activation phase. (Source: MacPorts)
Interestingly if you would delete one of the hard links, the data wouldn’t be gone:
If one of the hard links is removed with the POSIX unlink function (for example, with the UNIX ‘rm’ command), then the data are still accessible through any other hard link that remains. If all of the hard links are removed and no process has the file open, then the space occupied by the data is freed, allowing it to be reused in the future. (Source: Wikipedia)
I must admit I didn’t know this. In fact I’m often suprised how much I manage to acomplish on Unix systems even though my knowledge is quite shallow and fragmented.