Mythnuv2mkv

From MythTV Official Wiki
Revision as of 09:50, 29 September 2007 by Auric (talk | contribs) (Required Applications)

Jump to: navigation, search

mythnuv2mkv

mythnuv2mkv will convert MythTV nuv files to mkv, mp4 or avi files. It can be run as a MythTV User Job or at command line to convert MythTV recordings or stand alone files. The converted recordings can either replace the nuv one or be copied to another location. If this other location is under the MythVideoDir, imdb will be searched, a mythvideo db entry created and a coverfile file created if one was not available at imdb.

Installation

Download mythnuv2mkv.sh from http://web.aanet.com.au/auric/mythnuv2mkv.php
(See Required Applications)

Usage details

mythnuv2mkv.sh [--contype=avi|mkv|mp4] [--quality=low|med|high] [--pass=one|two] [-jobid=jobid] [--maxrunhours=int] [--findtitle=string] [--copydir=directory] "--chanid=chanid --starttime=starttime" | file ...

  • Must have either --chanid=chanid and --starttime=starttime or a plain filename. These can be mixed.
  • e.g. mythnuv2mkv.sh --chanid=1232 --starttime=20071231235900 video1 video2 --chanid=1235 --starttime=20071231205900
  • --contype=avi|mkv|mp4 (default, name of script. e.g. mythnuv2mkv.sh will default to mkv. mythnuv2avi.sh will default to avi)
    • (Note Videos staying in MythRecord will always default to avi)
    • avi - Video mpeg4 Audio mp3
    • mkv - Video h.264 Audio aac (--contype=mkv,ogg will use ogg Audio)
    • mp4 - Video h.264 Audio aac
  • --quality=low|med|high (default med)
  • --pass=one|two (default two)
    • --quality --pass and --contype can be passed as any argument and will only take effect on files after them.
    • e.g. mythnuv2mkv.sh videofile1 --chanid=2033 --starttime=20070704135700 --pass=one video3 --quality=low video4
      • videofile1 and chanid=2033/starttime=20070704135700 will be two pass med quality (defaults)
      • video3, one pass med quality
      • video4, one pass low quality
  • --maxrunhours=int (default process all files)
    • Stop processing files after int hours. (Will complete the current file it is processing.)
  • --findtitle="string"
    • Prints tile, chanid, starttime of programs matching string.
  • --copydir=directory
    • mkv/mp4/avi file will be created in directory. Source nuv will be retained. i.e you are copying the source rather than replacing it.
    • If the source was a CHANID/STARTIME it will be renamed to TITLE:S##E##:SUBTITLE. S##E## is the Season and Episode number. All punctuation characters are removed.
    • If directory is under MythVideoDir, imdb will be searched and a mythvideo db entry created.
  • --jobid=%JOBID%
    • Add this when run as a User Job. (Enables update status in the System Status Job Queue screen and the Job Queue Comments field in MythWeb)
  • Logs to /var/tmp/mythnuv2mkvPID.log and to database if "log MythTV events to database" is enabled in mythtv.
  • Cutlists are always honored.
  • Sending the mythnuv2mkv.sh process a USR1 signal will cause it to stop after completing the current file.
    • e.g. kill -s USR1 PID

Typical usage

Myth User Job

  1. Setup user job like
    • PATH/mythnuv2mkv.sh --jobid=%JOBID% --copydir /mythvideodirectory --chanid=%CHANID% --starttime=%STARTTIME%
  2. Record program
  3. Run user job on recording

This will convert nuv to mkv and copy it to /mythvideodirectory. If /mythvideodirectory is under MythVideoDir, imdb will be searched, a mythvideo db entry created and a coverfile file created if one was not available at imdb. This is what I do. Record things in Myth Recording and anything I want to keep, use this to convert to mkv and store in MythVideo. NOTE. System Status Job Queue screen and the Job Queue Comments field in MythWeb always report job Completed Successfully even if it actually failed. (If someome can tell me how to fix this, fantastic.)

Myth Video

  1. Record program
  2. mythrename.pl --link --format %T-%S --underscores --verbose (mythrename.pl is in the mythtv contrib directory)
  3. cp from your mythstore/show_names/"PROGRAM".nuv to your MythVideoDir directory.
  4. use video manager to add imdb details
    • nuv files work fine in MythVideo, but if you need to convert them to mkv/mp4/avi, or need to reduce their size
  5. run mythnuv2mkv.sh MythVideoDir/"PROGRAM".nuv

Myth Recording

  1. Record program
  2. run mythnuv2mkv.sh --findtitle="title name"
  3. get chanid and starttime
  4. run mythnuv2mkv.sh --chanid=chanid --starttime=starttime
  • NOTE You cannot edit a avi/mp4/mkv file in MythTV. So do all your editing in the nuv file before you convert to avi.
  • NOTE You cannot play a mkv/mp4 file in MythTV.
  • I would in general recommend leaving everything in Myth Recording as nuv.

Required Applications

  1. For all contypes
    1. mythtranscode
    2. perl
    3. mplayer http://www.mplayerhq.hu/design7/news.html
    4. mencoder http://www.mplayerhq.hu/design7/news.html
    5. wget http://www.gnu.org/software/wget/
    6. ImageMagick http://www.imagemagick.org/script/index.php
  2. For avi
    1. mp3lame http://www.mp3dev.org
  3. For mkv and mp4 contypes
    1. x264 http://www.videolan.org/developers/x264.html
    2. faac http://sourceforge.net/projects/faac/
    3. faad2 http://sourceforge.net/projects/faac/
  4. For mkv contype
    1. mkvtoolnix http://www.bunkus.org/videotools/mkvtoolnix/
  5. For mkv,ogg contype
    1. vorbis-tools http://www.vorbis.com/
  6. For mp4 contype
    1. MP4Box http://gpac.sourceforge.net/index.php