Convert JVC TOD to MPEG Video – tod2mpeg

If you own a JVC video recorder, you may have noticed that it stores it’s videos in TOD format. This is highly annoying as it’s not very useful if you want to view it on a simply device such as a Western Digital TV HD Media Player. The good news, is that there is a simple way to turn your TOD videos into MPEG videos using ffmpeg. It should also work for MOD files, but I haven’t testing it yet – please tell me if it works. I wrote a simple bash script to do this:

#!/bin/bash
video="$1"
newvideo="${video/%tod/mpg}"
ffmpeg -i "$1" -acodec copy -vcodec copy "$newvideo"
mv "$video" "$video.done"

You can download this script here –>tod2mpeg.zip

Run this script by putting the TOD video filename after the script name.

Eg: tod2mpeg mod123.tod

It will use ffmpeg to convert to mpeg and once completed will append “.done” to the end of the TOD filename. You should be left with a mpeg file of the same name. eg. mod123.mpeg.

You will notice a whole bunch of messages coming out of ffmpeg. Just ignore these.

I’ve also written a little wrapper perl script to enable me to run tod2mpeg on multiple files. Download this here –>tod2mpeg-multi.zip.¬†You will need to make sure that you already have the tod2mpeg script in your path somewhere (eg. ~/bin/ or /usr/local/bin).

You will need to pass a list of TOD files into this script like this:

ls *.tod | tod2mpeg-multi

Converting NUV (mythtv) video to AVI (DIVX) without transcoding

As you may or may not know I’m a big fan of mythtv (www.mythtv.org). However mythtv transcodes videos in NUV (nupple video) format which is quite useless to use on anything other than mythtv. In fact mythtv seems to be the sole user of nuv format these days.

I’ve played around with mythtv for some time and I think I’ve come up with the perfect workflow of how to convert nuv to dvix avi’s. And yes, I did try nuvexport and it didn’t work very well – most of the time the video and audio was out of sync.

Step 1
– Configure the mythtv transcoders to resize and convert to MPEG4 (DIVX).

Step 2
– Editing the video you want to convert/export removing all commericals etc.

Step 3
– Initiate a job in mythtv to transcode the video and cut the commericals out and transcode into nuv mpeg4. Now you should be left with a nuv file which is essentially a DIVX file already.

Step 4
– Use nuvexport and export the video out of mythtv as a nuv files. When I do this I usually remove the video from mythtv altogether when prompted. Some people might wonder why I wouldn’t just convert the file using nuvexport. I’ve found that it’s only successful about 10% of the time and most of the time it get’s the video and audio completely out of sync.

Step 5
– Run this script with the file name as the first argument.
#!/bin/bash
video="$1"
mencoder -ni -oac mp3lame -ovc copy -vf harddup -noskip -skiplimit 0 -o test.avi "$video"
mv "$video" "$video.done"
newvideo="${video/%nuv/avi}"
mencoder -forceidx -oac copy -ovc copy -aspect 16:9 -o "$newvideo" test.avi
rm test.avi

This script will re-encode the video using mencoder. You will note that I only transcode the audio and not the video – this is just copied. I found that this produced a avi file that couldn’t be fast forward. Therefore I quickly run mencoder over the file again and force the index to be rewritten. This seems to fix the problem and the avi is seekable again.

That’s it. You should now have a proper DIVX AVI file that you can use just about anywhere where dvix is supported.

Name change

Okay – it’s been a while since I made a post to my website, but I have revamped the site and will now be putting all of my snippets of technical knowledge on here. Therefore I’ve renames the blog to Matt’s Tech Blog – though if you can think of a better name, I welcome suggestions.