find: Creating MPEG Alias Softlinks to JVC Everio TOD MOD Files

My JVC camcorders record in MOD and TOD file formats, which are non-standard video formats that cannot be directly played on most computers or networked media players.  This post describes how to use the Linux 'find' command to create an MPEG alias to the TOD or MOD file so that the video can be played without post-processing.

My home video collection exceeds 1,500 files representing about one terabyte of storage.  I am unwilling to dutifully follow JVC's recommendation of using their bundled software to convert their non-standard file formats to MPEG for playback on my media player.  While the JVC Everio hard disk drive camcorder records excellent high-definition video, their choice of file formats is very unfortunate.  Luckily, the VNC media player can be configured to play TOD and MOD files directly on a Mac or PC.  However, the situation is more difficult if you keep your video files on a NAS device and want to stream the video to your television.

This approach has been tested on a Netgear ReadyNas NV+ device, but should work with any storage device using Linux such as Synology, Qnap and Buffalo Technology.  Playback has been tested networked media players such as Patriot Box Office (now called Core) and Micca EP950.

How it Works

For each file with the TOD or MOD file extension, create a softlink with an "mpg" file extension that points to the original file.

A softlink is preferred to a hardlink to avoid duplicating files during copying.  The softlink is a small text file (in the 10s of bytes range) that points to the target file.  A hardlink is actually be another name for the target file (it references the same inode as the target), resulting in the entire file being moved when I backup the videos to another hard disk drive.

The softlink filename will be the target's filename with ".mpg" appended.

Find Command

find . -type f -name *.TOD -execdir ln -s {} {}.mpg \;

The above command works if the find version supports the execdir directive.  It won't work on the ReadyNas NV+, which uses the older find version 4.1.7.

For creating backup copies of the home videos, it is important that the mpg links are pointing to the TOD files using relative paths.  While it is possible to replace the execdir directive with the plain exec and the '.' with the full path to the current directory, this will create symlinks with absolute paths that are device specific.  For example, the directory '/c/Videos' is only valid on the ReadyNas, not the backup hard disk drive.  A more complex command is needed.

find . -type f -name *.TOD -exec sh -c ' \
dir=$(dirname {}) ;\
base=$(basename {}) ;\
echo $dir - $base ; \
cd $dir ;\
pwd ;\
ln -s $base $base.mpg' \;

The echo and pwd commands above are for debugging, to confirm that the correct paths are being used.  I also create the dir and base variables for clarity.  The above command can be condensed into something more cryptic by removing the debugging and variable statements.

The above command replicates the execdir directive for older versions of find found in appliances like NAS devices.

Synology Update

The same softlink approach works on Synology DS1512+ NAS connected to a Patriot Box Office player. In addition to the .mpg extension, a .m2ts works equally well. (ToDo reminder: Add a synology task to automatically create softlinks for new TOD files.)

December 15th, 2012 Posted by Jon Jaroker Filed in: Bash

Be the first to comment. Leave a comment

Your email address will not be published. Required fields are marked *