Nuvexport

From MythTV Official Wiki
Revision as of 21:19, 7 October 2006 by Pepsi max2k (talk | contribs) (Which Format To Use?)

Jump to: navigation, search

Important.png Note: The correct title of this article is nuvexport. It appears incorrectly here due to technical restrictions.


nuvexport can be used as an alternative to MythTV's inbuilt transcoding for recorded TV files. It is a script designed to export mythtv nuv and mpeg-nuv files to other formats, including xvid, svcd, dvd and others. Please see the official nuvexport page for more info.

A somewhat comprehensive separate wiki by Christopher Friend on the usage of nuvexport can be found here (currently being moved to this page - 07/10/06).

If you're looking for the Xvid codec, check here.


Installing Nuvexport

nuvexport can only be installed on Linux systems. To be of any use, you'll probably want MythTV installed first. You'll also need a copy of the FFMpeg, Transcode or mencoder transcoding programs. FFMpeg and Transcode should be available as packages for your Linux distrobution, and mencoder is available as part of MPlayer.

In addition you will need copies of various codec files. Personally I use a lot of XviD, and this should also be readily available as a package.

Finally, you need a copy of nuvexport. The latest copy can be found at http://forevermore.net/files/nuvexport/. For a quick install, just download the tar.bz2 source file, unzip, browse to the newly created directory and enter "make install".

Fedora Core 4 dependencies

  • id3lib: Can be installed from Fedora extras: yum install id3lib

nuvexport can be installed as RPM from http://forevermore.net/files/nuvexport like this:

rpm -Uvh http://forevermore.net/files/nuvexport/nuvexport-0.3-0.20060729.svn.noarch.rpm

Fedora Core 2 dependencies

  • mjpegtools: provides mpeg2enc and mp2enc
  • perl-Time-Hi Res provides perl's Time::Hi Res module

Debian dependencies

  • mjpegtools: provides mpeg2enc and mp2enc
  • ffmpeg: provides ffmpeg
  • perl: provides perl's Time::Hi Res module
  • libdate-manip-perl: provides Date::Manip

Ubuntu dependencies

Mostly as Debian, but the default ffmpeg package doesn't come with xvid or mp3 exporting enabled. It may be necessary to build ffmpeg from source.

There is no id3lib package for Ubuntu, so this will also have to be built from source.


Nuvexport Manual

The following is my (Christopher Friend aka. pepsi_max2k) attempt at an nuvexport manual, previously found here but now under constant attack by spambots.

It was started not long after I first got into Linux & MythTV and therefore is aimed at the complete Linux novice. Most of the information I just tried to figure out for myself. I've tried to explain various things like transcode programs and video formats but I can't guarantee it's all correct.

Feel free to modify, update, improve and expand the current information, but please try to keep the target audience the same - someone who really does need telling not to add the quote marks around text. This way, most users can ignore what they already know, and the novice user won't get frustrated by half explained commands. Thanks.


Starting Nuvexport

Nuvexport is run via the command line. Open your regular command prompt and then all you need to do is type

nuvexport

If you want to change any of the basic running options then you can add flags after the main program name when you start it, but I'll discuss these later.

Regardless of what flags you use (if any), nuvexport will then begin and start reading MythTV's database to get information on your programs. This is shown by the text "Loading MythTV recording info." with a percentage mark underneathe. Once this reaches 100% you will be shown a new screen that informs you which encoder MythTV is using (see below) by the following line:

Using transcode for exporting.

In this case, it's using Transcode to, well, transcode files. If you use FFMpeg or MEncoder, the printout should change appropriately.

Directly below this printout you will be given a list of encoding options and asked to choose one.


Transcode Or FFMpeg

Just starting nuvexport with the command:

nuvexport

will start nuvexport in it's default mode, using FFMpeg to encode files.

One of the biggest decisions to make when running nuvexport is whether you really want to use FFMpeg, or if you want to use Transcode, or MEncoder instead as the base transcoder program. Basically nuvexport doesn't transcode anything itself, just provides easy access to other programs and their options which themselves perform the actual transcoding.

Firstly, in order to use either FFMpeg or Transcode, they both need to be installed beforehand. You'll most likely be able to do this through your OS's package manager, or download them from the internet.

Note: If you're installing from an RPM package then the options you'll be given on which format to encode to? during the running of nuvexport may differ depending on how the package has been put together. If you find that some things such as DivX/VCD/SVCD encoding options have the “(disabled)” text next to them then you'll not be able to use them due to the currently installed version of either FFMpeg or Transcode (whichever you're using) not supporting them. The only option you have is to either find another copy of the program's package, or try to compile the program from source code and install it yourself.

Note 2: Some of the options will be disabled regardless as I'm sure I read somewhere that the PSP and iPod encoding had not been fully implemented yet.


FFMpeg

FFMpeg is the default program used for transcoding files with nuvexport. This means that if you just type “nuvexport” at the command line then it will be using FFMpeg. You can also use the “--ffmpeg” flag at the same time (eg. type “nuvexport –ffmpeg” to explicitly define the use of the program. Either way, it does the same thing.

Depending on the options your installed version of FFMpeg has enabled (see note above), you'll be able to transcode to the following formats:

  • XviD
  • SVCD
  • VCD
  • DVCD
  • DVD
  • DivX
  • ASF
  • MP3
  • PSP
  • iPod
  • MPEG2->MPEG2 cut only
  • .nuv and .sql

Advantages of using FFMpeg?

  • Firstly it'll give you more options for an encoding format than Transcode will, namely that you can export to DivX.
  • It's also known to be quicker than Transcode when encoding files, I'm guessing around 1/4 of the time.

Disadvantages?

  • Transcode produces slightly higher quality results while encoding files, especially with Xvid. I can't say how much difference there is, but it's probably best if you check for yourself. Some users report that using ffmpeg produces “smear” in the video while Transcode does not.


Transcode

As with FFMpeg, Transcode is also used for transcoding files with nuvexport. As it is not the default encoder for use with nuvexport you'll have to use the “--transcode” flag when you run nuvexport (eg. type “nuvexport –transcode”) to explicitly define the use of the program.

Like FFMpeg, Transcode will give you the option of using various different types of formats to encode a file to. As you'll see, Transcode's options are all available in FFMpeg, though FFMpeg has a few more.

  • XviD
  • SVCD
  • VCD
  • DVCD
  • DVD
  • MPEG2->MPEG2 cut only
  • .nuv and .sql

Advantages of using Transcode:

  • Transcode produces better quality results when using XviD, though may produce very slightly larger files as a result.

Disadvantages:

  • Transcode takes longer to encode files than FFMpeg, roughly speaking it takes 4 to 5 times longer to encode a video than the actual length of the video (ie. a 1 hour video will take 4 to 5 hours). Using single pass without noise reduction should speed things up alot with very minor loss of quality.
  • Transcode will give you less options of encoding formats than FFMpeg will. The most noticable abscentee is probably DivX, though Xvid is a very similar alternative.


What To Use

This one's simple. Transcode if you want quality, FFMpeg if you want speed or DivX. Unless of course something's dissabled in either version and you have to use the other.


Debug Mode

As well as using Transcode of FFMpeg, you can also make nuvexport run in debug mode by using the "--debug" flag. This causes nuvexport to go through it's normal running procedure until it gets to actually transcoding the video, at which point it doesn't actually trancscode anything but instead prints out all the commands that it would normally use to encode a video.

As I mentioned earlier, nuvexport doesn't encode anything itself, it just provides easy access to other programs and their options which perform the actual encoding. The commands for running these programs are what will eventually be printed out in the debug mode.

The debug output is useful if the program is causing errors or doing something you don't think it should, and you want to check to see what is causing these problems. Running the output commands individually and changing any you think you need to could help you to solve or problem solve the errors.

At least, that's how it's meant to work, but if you know/understand how to run Transcode or the like from the command line then you're too bright for this place, and gawd knows how you run the things on their own...

For an example, I'm going to use the following article originally from the nuvexport project page at https://svn.forevermore.net/nuvexport/wiki/debug.


nuvexport's --debug mode is basically a quick way to get it to print out the commands it would normally run, instead of running them. It's then up to you to run the commands and look for errors.

Please be aware that mythtranscode's fifodir code does not work on stale fifo's, so if there is a mkdir call for a fifodir, you also need to make sure that there isn't one already created with that name.

For example, take the following sample --debug output:

system call:
mkdir -m 0755 /tmp/fifodir_28703/
forking:
/bin/nice -n19 mythtranscode --showprogress -p autodetect \
-c 1110 -s 2005-02-23-15-59-00 -f "/tmp/fifodir_28703/" --honorcutlist 2>&1
forking:
/bin/nice -n19 ffmpeg -f rawvideo -s 640x480 -r 29.97 \
  -i /tmp/fifodir_28703/vidout -f yuv4mpegpipe - 2> /dev/null \
| /bin/nice -n19 yuvdenoise -r 16 -b 12,10,-12,-10 2> /dev/null \
| /bin/nice -n19 ffmpeg -hq -threads 2 -y -f s16le -ar 44100 -ac 2 \
  -i /tmp/fifodir_28703/audout -f yuv4mpegpipe -s 640x480 -aspect 1.333 \
  -r 29.97 -i - -aspect 1.333 -r 29.97 -deinterlace -croptop 10 -cropbottom 10 \
  -cropleft 12 -cropright 12 -padleft 2 -padright 2 -s 620x464  -vcodec xvid \
  -b 960 -qmin 6 -qmax 31 -minrate 32 -maxrate 1920 -bt 32 -bufsize 65535 \
  -lumi_mask 0.05 -dark_mask 0.02 -scplx_mask 0.5 -4mv -part -acodec mp3 \
  -ab 128 -f avi "./Good Eats - Tomatoes.avi" 2>&1

because there is a mkdir in there, you'll need to first run something like:

rm -rf /tmp/fifodir_28703/
mkdir -m 0755 /tmp/fifodir_28703/

Then, you'd run:

/bin/nice -n19 mythtranscode --showprogress -p autodetect \
 -c 1110 -s 2005-02-23-15-59-00 -f "/tmp/fifodir_28703/" --honorcutlist 2>&1

Notice how the --debug output said "forking" -- this means that nuvexport intends to run things simultaneously, so you'll need to open another console window to run the next command:

/bin/nice -n19 ffmpeg -f rawvideo -s 640x480 -r 29.97 \
  -i /tmp/fifodir_28703/vidout -f yuv4mpegpipe - 2> /dev/null \
| /bin/nice -n19 yuvdenoise -r 16 -b 12,10,-12,-10 2> /dev/null \
| /bin/nice -n19 ffmpeg -hq -threads 2 -y -f s16le -ar 44100 -ac 2 \
  -i /tmp/fifodir_28703/audout -f yuv4mpegpipe -s 640x480 -aspect 1.333 \
  -r 29.97 -i - -aspect 1.333 -r 29.97 -deinterlace -croptop 10 -cropbottom 10 \
  -cropleft 12 -cropright 12 -padleft 2 -padright 2 -s 620x464  -vcodec xvid \
  -b 960 -qmin 6 -qmax 31 -minrate 32 -maxrate 1920 -bt 32 -bufsize 65535 \
  -lumi_mask 0.05 -dark_mask 0.02 -scplx_mask 0.5 -4mv -part -acodec mp3 \
  -ab 128 -f avi "./Good Eats - Tomatoes.avi" 2>&1

You need to do this because this command (ffmpeg) is actually interacting with the data that mythtranscode outputs.

From here, you basically have to watch the output from both programs to see if you notice errors. Something will usually happen fairly soon (usually ffmpeg complaining about a missing codec, bad file format, etc.). If you don't understand the error, then post the info to the mythtv mailing list, or come ask someone for help in the irc channel.


Note for multipass files: You'll see debug printout virtually identical to above, but twice - for the first and final passes. Just run the code as above, eg. rm dir, mkdir, 1st fork code for First Pass in one window, 2nd fork code for First Pass in another. Wait til they both finish, then do it all again (inc. rm dir, mkdir) but use the forked code from the Final Pass instead.


Which Format To Use?

After starting nuvexport, the first main printout you should see is the following:

Using ffmpeg for exporting.
What would you like to do?
  1. Export to XviD
  2. Export to SVCD
  3. Export to VCD
  4. Export to DVCD (VCD with 48kHz audio for making DVDs)
  5. Export to DVD
  6. Export to DivX
  7. Export to ASF
  8. Export to MP3
  9. Export to PSP (disabled)
 10. Export to iPod (disabled)
 11. MPEG2->MPEG2 cut only
 12. Export to .nuv and .sql
  q. Quit
Choose a function:

As mentioned in the previous section, the first line refers to the encoder program you are using with nuvexport.

The remaining options - which will vary based on the encoder you are using (FFMpeg, Transcode or Mencoder) and the versions of these you have installed (some will have options shown as disabled, note PSP and iPod are currently always dissabled) - ask you to choose a format that you wish to encode your video to. The remaining option is to quit the running of nuvexport.

Just type in the number or letter of your choice and you will be taken to the next screen. Note that you can only choose one option at a time.

On the whole, each format is quite different and used for a specific purpose, eg. transferring to DVD, CD, for use on a PC or creating an audio file. That said, I'll now go through the various formats available for both Transcode and ffmpeg, both of which make no difference on the format used (though as mentioned later, Transcode or Ffmpeg may produce better results with one than the other).

I'll discuss the advantages and disadvantages of each, as well as giving you a list of the further options you'll need to choose from before your recording finally starts to be re-encoded. The following sections of this manual go into greater detail on what these further options mean, what they do, how to use them, and whether you should actually use them or not.

Special note: you really only want to use DVD/CD formats if you're going to burn the resulting file to a DVD or CD, otherwise the compatibility and size of the file renders it pretty pointless.


XviD

http://www.xvid.org/

Using the XviD option will result in giving you an XviD AVI file.

XviD is basically an open-source alternative to the DivX codec, making them both very similar and also compatible with the same players (most DivX capable DVD players will play XviD files, and, if not already supported, the XviD codec can be downloaded to allow playback of the file in any of your normal Media Players on your PC). The resulting file will end in a .avi extension (a general contained format for many types of videos), the same as DivX files.

XviD will give you excellent compression while keeping a good quality file, you can easily create a file from a regular length feature film small enough to fit onto a single CD or put multiple ones on a DVD.

Advantages:

  • Good quality (can be better than DivX)
  • Small file size.
  • Good compatibility.
  • Can be burnt to CD/DVD.
  • Can be used for any length of video.

Disadvantages:

  • Not as widely used as DivX
  • Less compatible than DivX.

Options you'll get when running:

  1. Choose a show(s) (+ episode if applicable).
  2. Where to export file(s) to.
  3. Enable Myth cutlist?
  4. Enable noise reduction?
  5. Enable deinterlacing?
  6. Crop overscan?
  7. Audio bitrate.
  8. Variable bitrate (VBR)?
         * If yes to VBR, enable multipass?
               o If no to multipass, VBR Quality. 
  9. Video bitrate.
 10. Width.
 11. Height. 


SVCD

http://www.videohelp.com/svcd

This option will convert your .nuv video an SVCD compliaint MPEG file, allowing you to burn the file to an SVCD formatted CD disc. Basically an SVCD is just a better quality version of a VCD, allowing up to 60 minutes of video on a CD, and are widely compatible for use with PC's or standalone DVD and CD video players. See VCD section below for more info.

Advantages:

  • Great quality
  • Wide compatibility.
  • Can be burnt to CD.
  • Great for storing on a PC.

Disadvantages:

  • Do you really want to bother making one?
  • Less compatibility than VCD.
  • Only 60 minutes of video (less than VCD).

Options you'll get when running:

  1. Choose a show(s) (+ episode if applicable).
  2. Where to export file(s) to.
  3. Enable Myth cutlist?
  4. Enable noise reduction?
  5. Enable deinterlacing?
  6. Crop overscan?
  7. Audio bitrate.
  8. VBR Quality. 


VCD

http://www.videohelp.com/vcd

This option will convert your .nuv video a VCD compliaint MPEG file, allowing you to burn the file to a VCD formatted CD disc. A VCD can be seen as the video version of an audio CD. With audio CDs, instead of holding files in a directory format like on your PC, they hold a specialised version of the data for playback on all manner of CD players and this data can only be turned back into files by ripping the data off the disc and converting it into a commonly used format (you can kind of think of it as a “single entity” instead of multiple files). VCDs do much the same thing with videos so that they can be played on a wide variety of players. VCDs will allow you to add different subtitle tracks, audio tracks, video files and menus to a single CD, but you'll need to use a burning program capable of creating a VCD to do so. A VCD will hold up to 80 minutes of video on a single CD.

Advantages:

  • Widely compatible.
  • Can be burnt to CD.
  • Holds more video than an SVCD.

Disadvantages:

  • Worse quality than SVCD.
  • Only holds 80 minutes of video.

Options you'll get when running:

  1. Choose a show(s) (+ episode if applicable).
  2. Where to export file(s) to.
  3. Enable Myth cutlist?
  4. Enable noise reduction?
  5. Enable deinterlacing?
  6. Crop overscan? 


DVCD

The nuvexport mentions this as “a VCD with 48kHz audio for making DVDs”, though the only difference from a VCD that I can find is that it allows adding more video to a single CD, up to 99 minutes.

Advantages:

  • Widely compatible.
  • Can be burnt to CD.
  • Holds more video than an VCD or SVCD.

Disadvantages:

  • Worse quality than SVCD.
  • Only holds 90 minutes of video.

Options you'll get when running:

  1. Choose a show(s) (+ episode if applicable).
  2. Where to export file(s) to.
  3. Enable Myth cutlist?
  4. Enable noise reduction?
  5. Enable deinterlacing?
  6. Crop overscan? 


DVD

http://www.videohelp.com/dvd

The current format king for video disks. Hopefully you know what theses are, a video DVD disc can hold up to two hours of great quality video or around 4 and a half gigabytes of data.

Using this option in nuvexport will give you a DVD-Video file that you can use to create a DVD video disc, capable of playing on any PC or standalone DVD player. Obviously, you can choose to use a DVD-R, DVD-RW, or any of these +, +- , -+== *% whatever types of DVD discs there are, I've still not got my head round it.

Advantages:

  • Great quality.
  • Will play in any DVD player.

Disadvantages:

  • Will only burn to a DVD.
  • Large file size, bad for keeping on a PC.

Options you'll get when running:

  1. Choose a show(s) (+ episode if applicable).
  2. Where to export file(s) to.
  3. Enable Myth cutlist?
  4. Enable noise reduction?
  5. Enable deinterlacing?
  6. Crop overscan?
  7. Audio bitrate.
  8. Max. VRB bitrate.
  9. VBR quality.


DivX

http://www.divx.com/

Using this option will result in a DivX encoded AVI file.

Probably the most well known and well used format for video files stored on PCs, DivX is used due to it's great video quality compared to the small file sizes it creates from video (you can fit a 1 hour 40 minute feature film onto a single CD, 700MBs, in very good quality). DivX uses MPEG-4 compression to create a file contained within an AVI container, resulting in the file ending in .avi.

DivX is widely supported by many standalone DVD players and PCs. In recent times, open source codecs such as XviD have provided a good alternative to DivX files. Generally, if you want to store your files on your PC then either DivX or XviD should be your main choice.

Advantages:

  • Widely used/supported.
  • Small file size.
  • Good quality compared to size.

Disadvantages:

  • Can be worse quality than XviD.
  • Not as good quality as DVD/SVCD files.

Options you'll get when running:

  1. Choose a show(s) (+ episode if applicable).
  2. Where to export file(s) to.
  3. Enable Myth cutlist?
  4. Enable noise reduction?
  5. Enable deinterlacing?
  6. Crop overscan?
  7. Audio bitrate.
  8. Variable bitrate (VBR)?
         * If yes to VBR, enable multipass?
               o If no to multipass, VBR Quality. 
  9. Video bitrate.
 10. Width.
 11. Height. 


ASF

Options you'll get when running:

  1. Choose a show(s) (+ episode if applicable).
  2. Where to export file(s) to.
  3. Enable Myth cutlist?
  4. Enable noise reduction?
  5. Enable deinterlacing?
  6. Crop overscan?
  7. Audio bitrate.
  8. Variable bitrate (VBR)?
         * If yes to VBR, enable multipass?
               o If no to multipass, VBR Quality. 
  9. Video bitrate.
 10. Width.
 11. Height. 


MP3

MP3s are the most widely used format for storing audio files due to their small size and good quality. Choosing this option will convert the sound (not the video) from your .nuv video file into an MP3. Great if you just want to listen to the audio (like from a music video), pointless if you want some video.

Advantages:

  • A good quality audio file.
  • More control over audio format/quality than you get if creating a video.

Disadvantages:

  • No video.
  • You can always record the sound from a video file at a later date.


PSP

http://www.yourpsp.com

Currently I don't think this feature has been implemented in nuvexport, but if it were then you could expect it to give you a video file in a format capable of transferring to your Playstation Portable handheld games device, that is, MPEG-4.

Advantages:

  • If you want to transfer to a PSP, it's just what you need.

Disadvantages:

  • Pointless for anything else due to the PSP's low quality video file format and generally not widely supported.


iPod

http://www.apple.com/ipod/

Just like the PSP option, this is to create a file to transfer to a video capable iPod portable music player. I believe these are also MPEG-4 files.

Advantages:

  • Again, great if you want it on an iPod.

Disadvantages:

  • Same as with the PSP; pointless for anything else.


MPEG2 to MPEG2 cut.

This option will use a cutlist that you've created in MythTV with the edit recording option to cut out all the sections you've marked and save it in the same format as the original (not sure if it's still .nuv, or even if it overwrites the original .nuv file).

Obviously (well, it wasn't to me the 1st time :o) ) you need to have specified a cut list before hand for this option to work.

Advantages:

  • No loss of quality.
  • Gets rid of marked sections, freeing up hard drive space.

Disadvantages:

  • You can cut out sections alot more exactly with other programs pretty easily.
  • You probably want to convert it to a smaller format anyway, don't you?

Options you'll get when running:

  1. Choose a show(s) (+ episode if applicable).
  2. Where to export file(s) to. 


Export to .nuv and .sql

This option will create a new .nuv and accompanying .sql file with info on the recording that you can import into a seperate MythTV install on another system.

You'll be given the option to remove the recording from your current system if you wish, so make sure to answer No (the default) if you don't want to lose it.

Advantages:

  • Great if it's what you want to do.
  • Also good for added peace of mind when upgrading current systems.

Disadvantages:

  • Well... it's pointless if you don't need to do it.

Options you'll get when running:

  1. Choose a show(s) (+ episode if applicable).
  2. Delete from current system when finished?
  3. Where to export file(s) to.
  4. Create a new directory in which to store the files?