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.

This entry was posted in mythtv, Technology and tagged , , , , , , , , . Bookmark the permalink.

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

  1. Thomas H says:

    Neat – thanks! Would you mind sharing your actual transcoder settings for MPEG4?
    regards, Thomas

Leave a Reply

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