Difference between revisions of "Mythnuv2mkv"

From MythTV Official Wiki
Jump to: navigation, search
(Usage details: Update options)
(Installation: update instructions)
Line 6: Line 6:
=== Installation ===
=== Installation ===
Download mythnuv2mkv.sh from http://web.aanet.com.au/~auric/?q=node/6
See http://web.aanet.com.au/~auric/?q=node/6 for further details, dependencies and download.
(See Required Applications)
=== Usage details ===
=== Usage details ===

Revision as of 00:54, 11 May 2009


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.


See http://web.aanet.com.au/~auric/?q=node/6 for further details, dependencies and download.

Usage details

mythnuv2mkv.sh [--jobid=%JOBID%] [--contype=avi|mkv|mp4] [--quality=low|med|high|480|576|720|1080] [--pass=one|two] [--denoise=ON|OFF] [--deblock=ON|OFF] [--deleterec=ON|OFF] [--crop=ON|OFF] [--deinterlace=ON|OFF|SOURCENAME] [--invtelecine=ON|OFF] [--outputchecks=notype] [[--chapterduration=mins] | [--chapterfile=file]] [--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

Options --quality --pass --contype --denoise --deblock --deleterec --crop -deinterlace --invtelecine --copydir Only affects videos that appear after the option. e.g

  • mythnuv2mkv.sh --chanid=1232 --starttime=20071231235900 --contype=avi --chanid=1235 --starttime=20071231205900
    • This will convert --chanid=1232 --starttime=20071231235900 to mkv (the default) and --chanid=1235 --starttime=20071231205900 to avi.
  • 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

  • --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 (--contype=avi,xvid will use xvid instead of divx)
    • mkv - Video h.264 Audio aac (--contype=mkv,ogg will use ogg Audio)
    • mp4 - Video h.264 Audio aac
  • --quality=low|med|high|480|576|720|1080 (default med) Mostly affects resolution.
    • low - 448x336(4:3) or 592x336(16:9)
    • med - 512x384(4:3) or 624x352(16:9)
    • high - 528x400(4:3) or 656x368(16:9)
    • 480 - 640x480(4:3) or 848x480(16:9)
    • 576 - 768x576(4:3) or 1024x576(16:9)
    • 720 - 1280x720(16:9) (You probably need VDAPU to play this)
    • 1080 - 1920x1088(16:9) (You probably need VDAPU to play this)
  • --pass=one|two (default two)
    • One or Two pass encoding
  • --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, a MythVideo db entry created and a coverfile file created if one was not available at imdb.
  • --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. Also enables stop/pause/resume of job.
  • --denoise=[ON|OFF] (default OFF)
    • Include hqdn3d denoise filter.
  • --deblock=[ON|OFF] (default OFF)
    • Include pp7 deblock filter.
  • --deleterec=[ON|OFF] (default OFF)
    • Delete the recording after successful transcode. (Actually just sets high priority autoexpire and moves to Deleted group.)
  • --crop=[ON|OFF] (default ON)
    • Crop 8 pixels of each side.
  • --deinterlace==[ON|OFF|SOURCENAME] (default ON)
    • Include pp=fd deinterlace filter.
    • SOURCENAME is ON for that source. Can have multiple. e.g. DEINTERLACE="Cabel,FTA1"
  • --invtelecine=[ON|OFF] (default OFF)
    • Include pullup inverse telecine filter.
    • Note/ This filter will not be added if a deinterlace filter has been added.
    • Disable a output check. Set to one or many of the checks. e.g. OUTPUTCHECKS="NOSIZERATIO,NOSCAN"
  • ---chapterduration=mins
    • Add chapter marks to mkv/mp4 files every mins minutes.
  • ---chapterfile=file
    • Add chapter marks to mkv/mp4 as per chapter file. See mkvmerge or MP4Box manual for chapter file format.
    • (spaces not supported in chapter file name)
  • 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_Jobs like
    • Description: mythnuv2mkv Med Qual Copy
    • Job: PATH/mythnuv2mkv.sh --jobid=%JOBID% --quality=med --copydir=/mythvideodirectory --chanid=%CHANID% --starttime=%STARTTIME%
  2. Record program
  3. Run the user job on recording.
    • Highlight recording
    • Press I (Global Info key)
    • Select Job Options
    • Select mythnuv2mkv Med Qual Copy job

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" to get chanid and starttime
  3. 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


Moves a MythVideo file from one directory to another updating MythVideo db entry. http://web.aanet.com.au/~auric/?q=node/5 Useful for moving files created by mythnuv2mkv in the --copydir=directory to a more structured location.
mvvideo.sh MythVideoFile /newdirectory