May 242013
 

centos-logoRecently I switched some servers from Debian to CentOS because of it’s better hardware vendor support. Apart from the smaller software catalog, especially yum downloads were annoyingly slow. At first I blamed yum’s fastestmirror plugin, however after reading the documentation I discovered that the “fastest” mirror is chosen based on the mirror’s latency not throughput. The mirror hosted by TU Wien (gd.tuwien.ac.at) offers the best latency in Vienna but provides only a throughput of about 200KBps.

Luckily, yum allows you to exclude mirrors matching a given pattern. To add such an exclusion, one has to edit the file “/etc/yum/pluginconf.d/fastestmirror.conf“. Add the following line to exclude all mirrors hosted in Austria:

exclude=.at

After updating the local repository (yum update) the download speed increased instantly. Stjepan also had this problem and solved it the same way.

Feb 272013
 

Most pre-released movies contain the so-called timecode. This timecode accurately defines the current playback position. It is expressed in the format hour:minute:second:frame – for example 10:04:43:03.

Sadly ffmbc, the broadcast version of FFmpegdoes not support the drawtext filter’s timecode feature.

There are Two Possible Workarounds

  1. You can use subtitles to simulate a timecode. You can find lots of examples on Google.
  2. Alternatively you can combine ffmbc and FFmpeg. This can either be done using pipes (stdout and stdin), a named pipe (mkfifo) or an ordinary temporary file. The big disadvantage is, that you have to render twice.

I personally prefere to combine ffmbc and FFmpeg using the temporary file approach. It allows you to use any exchange format (in contrast to the pipe option). Furthermore it’s super easy to implement and monitor.

Broadcast => Regular Video File

  • Use ffmbc to convert the input broadcast format to something FFmpeg understands in a temporary location
  • Burn in timecode using FFmpeg and convert to output format
  • Clean up temporary file

ffmbc-ffmpeg

Regular =>Broadcast Video File

  • Create a temporary file while adding the timecode to the input file using FFmpeg
  • Export a broadcast version using ffmbc
  • Clean up temporary file


ffmpeg-ffmbc

Dec 062012
 

qt_tools is a free command line for the Quicktime infrastructure in Mac OS. As it is only a wrapper all audio and video formats supported by Quicktime can be used. This also allows the usage of products like Flip4Mac in automated workflows.

The problem is, that it is not that easy to find the needed parameters in the man page. Furthermore encoder specific settings can not always be configured using parameters. To work around this problem configuration files can be used. The following example illustrates how a specific Flip4Mac configuration can be created.

As already explained we first have to create a configuration file for the desired operation. To do that the –dodialog parameter is used to show the exporter specific configuration interface. As soon as the dialog is closed the configuration is saved to /tmp/wmv.conf.

qt_export --exporter=ASF_,TELE --savesettings=/tmp/wmv.conf --dodialog

After that it can be used to encode a file. It it important to note that Quicktime requires an existing display (as noted in the man page) and therefore can not be used in remote contexts like a webserver.

qt_export --loadsettings=/tmp/wmv.conf /path/to/your/input/video.m4v /path/to/your/export/video.wmv
Dec 052012
 

SAMBA the open source SMB implementation got replace in Lion with SMBX. SMBX supports SMB2 which is was first used in Windows Vista and reduces the chattiness of the protocol. Additionally Samba 3 was release under the GPLv3 licence which prevent Apple from packaging it in a commercial package.

While there are several advantages the overall stability decreased. Two examples are given below:

  1. Several multifunction printers are not able to connect to the new SMBX service to deliver scanned images as they only support SMB1. A possible workaround is to use a FTP server like PureFTPd.
  2. A race condition can occur after booting the system that prevents any user  to log in. The message “NTLM domain not configured” is logged. A possible solution is discussed here.

BUT the most frustrating part about SMBX is that there is no official documentation. Furthermore it’s not using plaintext configuration files anymore.

To track down errors it’s essential to have a good error log. To enable logging the launchd configuration file com.apple.smbd.plist has to be modified. After identifying the problem based on the logs you have to solve it. There are two different places where the configuration is stored. The overall service configuration is stored in the plist file /Library/Preferences/com.apple.smbd.plist. The share point configuration in turn has been moved into the Directory Service!!!!! This can be accessed using the dscl utility. After that you have to navigator into the “folder” /Local/Default/Sharepoints.

dscl localhost
> cd Local/Default/SharePoints/
> ls #this will list all you share points
> read SharepointName #lists all the configured settings

It’s awful to see a great software like Samba to be thrown out based on licensing issues.

Nov 292012
 

In previous versions of OS X it was easily possible through rc.shutdown.local to run commands before shutdown. I have not been able to use it in Lion or Mountain Lion.

Thankfully even if you restart or shutdown using the Apple menu the UNIX commands are used. This can be misused by replacing the system supplied tools with a self-written proxy script that runs your commands and the executes the original executables.

The script at the bottom is such a proxy. It should be created in /sbin/shutdown_proxy.sh. Then the original shutdown and reboot executables must be renamed to contain the suffix “.old” (shutdown.old and reboot.old). To complete the installation shutdown-proxy has to be symlinked to shutdown and reboot.

Terminal installation instructions

  1. sudo nano /sbin/shutdown_proxy.sh #insert and adjust the code from below
  2. sudo chmod 755 /sbin/shutdown_proxy #make the file executable
  3. sudo mv /sbin/shutdown /sbin/shutdown.old #move the old file aside
  4. sudo mv /sbin/reboot /sbin/reboot.old
  5. sudo ln -s /sbin/shutdown_proxy.sh /sbin/shutdown #link the proxy
  6. sudo ln -s /sbin/shutdown_proxy.sh /sbin/reboot

/sbin/shutdown_proxy.sh

#!/bin/bash
NAME="$0";
echo "Shutdown proxy executing"

# YOUR COMMANDS HERE

COMMAND="$NAME.old"
echo "Will run $COMMAND $@"

"$COMMAND" "$@"
Oct 222012
 

This time a client requested the ability to change the wireless network key of several dd-wrt Linksys WRT54GL routers at once.

Linksys WRT54G – CC BY-SA 3.0Wiki Commons

To simplify the process I wrote a small bash script that changes the WPA key of a given AP using only the web interface. This means no additional service (like SSH or Telnet) have to be enabled!

In the backend it uses curl to submit a specially crafted HTTP POST request to the router that applies the new key.

You can download change_wpa_key.sh under the WTFPL licence.

Sep 152012
 

Over the last few days I tried to automatically convert Avid OP-Atom MXF files to ProRes 422 HQ MOV files. At first this didn’t sound too hard but it took me several days to come up with an good solution.

So what’s the problem?

The problem is that Avid uses the so called Operational Pattern Atom. This pattern splits each audio channel and the video data into a separat MXF file. Additionally several audio and video MXF files are kept in the same folder without an easy way to match the corresponding files. After hours and hours I discovered mxfdump (based on MXFlib). This tool allows you to gather the UMID (unique material ID) and the data type (either audio or video) from a given file.

With this help I was able to find the associated media files – but the next problem arised immediately!

Another problem?

Sure! Avid uses a codec called DNxHD. My standard en/decoding tool ffmpeg is not able to handle it correctly. I was happy to discover a fork called ffmbc that is able to decode DNxHD and can encode ProRes HQ.

My solution

To create a good workflow I created a small script called MXFMuxer. It monitors a folder for incoming MXF files and builds up groups using their UMID. After that it validates them (for example if is there at least one audio and video file) and kicks in ffmbc to create a single ProRes 422 HQ MOV file.

Features

  • monitor a folder for incoming files
  • validate them to be sure they are OP Atom and we have a video file and one or two audio tracks
  • convert them to a single ProRes mov file
  • use all the available physical cores while converting (not handled by ffmbc)
  • can be daemonized and scheduled using launchd
  • uses ffmbc and MXFlib
  • delete or move the original MXF files
  • can be easily modified to generate previews for Archiware PresSTORE

Where can I get it?

That’s the best part of it! I have release it as a supplementary utility (see the utils folder) to PresSTORE Media Converter – you can freely download it at Google Code.

But be aware: It’s not that easy to install! You have to compile at least libx264, liblame, mxflib yourself. If you need help just leave a comment!

Aug 082012
 

Although Filemaker 9 and 10  aren’t supported on Lion and Mountain Lion anymore several of our customers still use it. As long as you upgrade from Snow Leopard everything is working as expected – even the “Open Remove” feature that is used to connect to a Filemaker Server.

The problem is, that whenever you try to reinstall Filemaker 9 Pro the required SSL Update fails to install. This happend because the OpenSSL used in this update is PPC only! After that you are still able to work on local FM databases but you are unable to connect to a remote server. The remote database list stays empty!

Luckily this problem can be easily fixed.

As far as I can tell the Filemaker application uses an SSL encrypted connection to transmit it’s data (or at least the database list 😉 ). To fix the encyption you only have to replace the certificate stored in the application bundle:

  • /…/FileMaker Pro.app/Contents/MacOS/root.pem
  • /…/FileMaker Pro.app/Contents/MacOS/server.pem

The following solutions are possible:

Obtain the certificates from a newer installation

The needed certificates are also installed by newer Filemaker versions. Just install the trail version or obtain the certificates from a different machine. To do that open the application bundle and copy the root.pem and server.pem files. To finish the surgery replace the original files (see above) in the Filemaker 9 bundle.

Download my files

To shorten the process I have uploaded my test certificates. You can also use them.

Aug 012012
 

The following problem can be reproduced on all Mac OS X Lion clients:

When you set your Adobe After Effects CS5.5 render output path to a folder on an NFS volume shared by an Windows 2008 R2 server the render process stalls. After that the machine has to be hard reset!

While doing some server and network protocol performance tests we discovered the described problem. We also set up a dedicated Windows NFS test server and a Mac OS Lion client to verify it. Other NFS servers are working as expected.

It looks like that After Effect tries to set a lock on the render destination file. During that something (??) goes wrong and the process stalls. After that the NFS kernel extension is still dead locked (??) and you need to hard reset your Mac.

To work around this issue the “sync” mount command line option can be used! This causes a big performance loss but at least it allows you to render to the NFS volume.

mkdir mountpoint
mount -t nfs -o sync server:/sharepoint mountpoint

Further details about the sync/async operation can be found in the exports man page.

Aug 012012
 

Sometimes it is necessary to throttle the throughput of a specific service like AFP or HTTP. This is possible with the help of ipfw‘s pipe feature on Mac OS X.

The following example slows the in- and outgoing AFP traffic down to 100KByte/s.

ipfw pipe 1 config bw 100KByte/s # configure the speed limit
ipfw add 1 pipe 1 src-port 548 # monitor out-
ipfw add 2 pipe 1 dst-port 548 # ... and incoming traffic

It is also possible to only slow down some hosts. To do that the rules have to be adapted. This example throttles only AFP traffic from and to the host 192.168.0.10.

ipfw pipe 1 config bw 100KByte/s
ipfw add 1 pipe 1 ip from any to 192.168.0.10 src-port 548
ipfw add 2 pipe 1 ip from 192.168.0.10 to any dst-port 548

PS: To reset a (possible broken) ruleset use the flush command

ipfw flush