MythTV comes with a utility called mythtranscode which can decode nuv files into raw format for use with other applications. This command-line utility was not designed to be used by the end-user, but instead to be called by other applications or scripts. Programs like mkmovie ( http://www.icelus.org/) and nuvexport ( http://forevermore.net/myth/) are better suited for the end user. However, since mythtranscode can be a useful tool, directions on using it follow.
mythtranscode creates raw streams, which means that they do not contain any container information such as resolution, frame-rate, or audio sampling rate. In order to process the output, you must supply this information to the processing utility. mythtranscode provides the relevant information on STDOUT.
There are two modes in which mythtranscode can create raw streams. The first has no synchronization and assumes that the processing utility will read audio and video at a constant rate. This method is useful when a single application will be processing the raw output, such as mencoder or ffmpeg. The second method assumes that two separate applications will be processing the audio and video streams independently, and there is no rate control between them which means that the two programs don't coordinate their efforts to maintain synchronization.
First, start mythtranscode. You will need to determine the channel and the start time manually.
$ mythtranscode --chanid 1036 --starttime 2003-10-20T15:30:00 --profile \
autodetect --fifodir . &
When mythtranscode begins executing, it will create two FIFOs ("audout" and "vidout") in the directory specified (in this case ".", meaning the current directory) and will print out information about the video stream.
The next step is to start the processing application. The following assumes that the stream is NTSC 640x480 with 32Kbps audio.
To use mencoder you would enter a command like:
mencoder -audiofile audout -audio-demuxer 20 -rawaudio rate=32000 \
-rawvideo on:w=640:h=480:fps=29.97 -ovc lavc -oac mp3lame -o out.avi \
vidout
ffmpeg -f u16le -ar 32000 -ac 2 -i audout -f rawvideo -s 640x480 -r 29.97 \
-i vidout -vcodec mpeg4 -b 2000 -acodec mp3 -ab 128 out.avi
Or to play directly using mplayer (again 1.0PRE1 or later is needed):
mplayer -audiofile audout -audio-demuxer 20 -rawaudio rate=32000 \
-rawvideo on:w=640:h=480:fps=29.97 vidout
If you wanted to write the raw data to separate audio and video files for later processing, the following would work (note the use of --fifosync for rate-control):
$ mythtranscode --chanid 1036 --starttime 2003-10-20T15:30:00 \
--profile autodetect --fifodir . --fifosync &
$ cat audout > audio.raw &
$ cat vidout > video.yuv
MythTV is not dependent on any particular window manager. If you wish to
run a lightweight window manager, the configfiles/
directory has an
example of a .twmrc
and .fvwmrc
file you may use.
While MythTV allows you to set various GUI and capture resolutions, not all combinations make sense.
First, analog video signals have a defined vertical resolution. In NTSC, the video standard specifies that there are 525 vertical scan lines. Once the "extra" lines are removed (they're used to synchronize the video signal, and encode closed captioning data), you have 480 vertical lines.
In PAL, there are 625 "raw" lines of resolution, with a net of 576 vertical lines.
Horizontally, the maximum you can expect from a Bt8X8 chip is 720.
With this in mind, there are certain commonly accepted values for resolution. While other values may be accepted, they will cause scan lines to be repeated or dropped.
From "best" to "worst", in NTSC:
As you can see, the lower quality values are half of the better ones. 720x240 is possible, but isn't a good tradeoff relative to the number of vertical lines lost. In a PAL country, the you would use values like 720x576 or x288.
The higher resolutions will be more CPU intensive if you're using software
encoding (PVR-250/350 will have minimal host CPU impact even if you're using
720x480). If the CPU is overtaxed, frames will be dropped causing uneven
motion. You will likely see the best results at resolutions which average at
least 10% CPU idle time. You can use system tools such as top
or
sar
to check the CPU % idle while recording. If the CPU average
usage is consistently exceeding 90%, frames will need to be dropped during
peak times when more than 100% of the available CPU would be needed to
process all of the frames.
If you'd like to read more on this, go to the vcdhelp website at http://www.vcdhelp.com/forum/userguides/94382.php.
MythTV is designed to be run as dedicated full screen TV application but can also be run as a desktop application on a computer monitor. Here are a few consideration for configuring sizes to best suit you needs.
For output to a Television, common resolutions are 640x480, 800x600, and some rare devices support 1024x768. Generally, higher resolutions are better. However, you may find that you prefer the picture quality at one of the lower resolutions. Everything in MythTV is scalable and should 'fit' regardless of the resolution you choose.
Edit your X configuration file, usually "XF86Config-4", so that the the resolution you want to use is listed first in the lists under "Screen". If this resolution is higher than the resolutions supported by your output device, you will see a 'panning' effect where moving the mouse to the edge will scroll around a desktop area which is larger than the display size. If this happens, edit your X configuration file to match the display size then restart X.
In 0.10 and later, from "mythfrontend" go to Setup->Appearance. The default for the height and width is "0" - this will cause MythTV to automatically size itself to full screen.
If the MythTV GUI width and height are not 0, mythfrontend uses these GUI dimensions and is anchored to the upper left corner of the X Desktop. If the GUI X and/or Y are not 0, the upper left corner is positioned at the specified coordinates. If the "Run the frontend in a window" box is checked, the window will have a frame and can then be dragged to any position on the desktop.
/usr/local/share/mythtv/
. Make sure to use fonts large enough
to be read on a TV screen from a distance.
The full screen TV size is based on the X display size. For Xinerama, you can specify a screen in Setup->General. The TV picture will be stretched to fit the entire GUI area regardless of the capture resolutions used. However, during playback, the "W" key can to used to correct differences between 16:9 and 4:3.
Because picture edges can be ragged and screen edges aren't straight, Television is designed to project an image larger than the physical screen. This is called "overscan". Underscan is fitting the entire image inside the screen. Underscan is useful for computer monitors so that toolbars and scrollbars at the edges can be seen.
For best results, match the X display area as close as possible to the edges of the physical screen. This can only be adjusted by your tv-out device or by the settings for the television set. Many sets have these adjustments in a 'service mode'. If you cannot make these adjustments, there will be black borders around the edges of the X desktop, MythTV GUI and TV playback.
MythTV has settings for "Overscan" in Setup->Playback. These can not, and do not, cause the image to display beyond the edge of the X display area. The purpose of these settings are to cut off rough edges and to expand the image so that objects will appear to be the same size as a normal overscanned TV picture.
See the mysqldump manpage for more information.
$ mysqldump -u mythtv -pmythtv mythconverg -c > mythtv_backup.sql
To restore: (assuming that you've dropped the database)
$ mysql -u root
mysql>create database mythconverg;
mysql>exit
$ mysql -u mythtv -pmythtv mythconverg < mythtv_backup.sql
You may need to alter the MySQL permissions if this database is being shared with multiple systems. See the Modifying access to the MySQL database for multiple systems section for more information.
$ mysql -u root
mysql> drop database mythconverg;
mysql> quit
btaudio allows you to obtain the audio data from your tuner card directly over the PCI bus without using a sound card. This is useful if you would like to use multiple tuner cards in a system without adding a sound card for each one, or if your existing sound card is not capable of full-duplex operation.
In order to use btaudio, your tuner card will need certain hardware installed on it, and that hardware must be wired correctly. The chip that will allow you to use the btaudio module is the MSP34xx. However, having a MSP34xx is no guarantee that you will be able to use the btaudio module.
As of 2003-03-31, this is the current list of cards and their status: Works with btaudio:
The following cards do not work:
The following cards have been reported to work, but have issues:
Once btaudio loads, it should register additional /dev/dsp
and
/dev/mixer
devices. Typing $ dmesg
will let you know
what's going on.
If mythfilldatabase grabbed a channel which you do not want to include in your TV listings, you can remove the entries from the grabber configuration and the MySQL database. This often happens with premium channels; for example, HBO or Showtime may be available on your cable TV system, but is scrambled because you're not a subscriber to that channel. Since you can never watch it, you want to get rid of it.
If you are using the DataDirect service, login to your account at http://labs.zap2it.com/ to modify your lineup. Uncheck the boxes for any unwanted channels, and they will no longer be included in your download.
If you are using a grabber from XMLTV, comment out the channel from the
~/.mythtv/<sourcename>.xmltv
file by inserting the word "not
" (including the space) in front of the unwanted entry. This will prevent
xmltv from grabbing future listings.
Next, delete the unwanted item from the channel table so that it will not
appear in the EPG or when changing channels. To delete the data from the
database we need to perform some steps. First, assuming that HBO is channel
15, we need to find out the internal chanid
used by MySQL:
$ mysql -u root mythconverg
mysql> select chanid from channel where channum=15;
+--------+
| chanid |
+--------+
| 1015 |
+--------+
1 row in set (0.00 sec)
mysql> delete from channel where chanid = 1015;
Old program data will be removed over the course of a week. However, you may want to immediately delete any current program listings for the channel that has been removed:
$ mysql -u root mythconverg
mysql> delete from program where chanid = 1015;
You may want to use a central server to store your files.
On the host machine, (in this case, the hostname is "masterbackend") you'll
want to edit your /etc/exports
file and use something like:
/var/video (rw)
To export the /var/video
directory with read / write privileges.
On the "slave" machine, you'll want to edit the /etc/fstab
file and
add something like:
masterbackend:/var/video /var/video nfs rsize=8192,wsize=8192,soft,nfsvers=3
Then run # fstab -a
to re-read the file to mount the file system.
In this case, the source is a machine called "masterbackend" which is exporting the directory "/var/video", which we're mounting locally at "/var/video". The rsize and wsize options are used to increase the performance of NFS; soft mean that NFS will eventually timeout on an error, and the nfsvers is required for filesizes over 2GB.
Here's an example submitted to the mythtv-dev list by Pat Pflaum mailto:pat@netburp.com using fvwm:
$ cat > .xinitrc
fvwm &
mythfrontend
^D
$ cat > .fvwmrc
Style myth* NoTitle, NoHandles, Sticky, WindowListSkip, SloppyFocus, GrabFocus, BorderWidth 0
^D
$
The following also works with blackbox:
$ cat > .xinitrc
xset -dpms s off &
irxevent &
mythfrontend &
blackbox
Make sure that your .blackboxrc
file has:
session.screen0.focusNewWindows: True
session.screen0.focusModel: SloppyFocus
in it.
Here's a method for automatically starting mythbackend submitted by Mike Thomson ( mailto:linux@m-thomson.net) and Stu Tomlinson ( mailto:stu@nosnilmot.com).
Copy the files from the MythTV contrib
directory or from Mike's web
site (
http://m-thomson.net/mythtv/) as follows:
etc.rc.d.init.mythbackend
should be made executable and copied to
/etc/rc.d/init.d/
:
$ cd contrib
$ su
# chmod a+x etc.rc.d.init.d.mythbackend
# cp etc.rc.d.init.d.mythbackend /etc/rc.d/init.d/mythbackend
etc.sysconfig.mythbackend
should be copied to
/etc/sysconfig/
:
$ cd contrib
$ su
# cp etc.sysconfig.mythbackend /etc/sysconfig/mythbackend
Edit /etc/sysconfig/mythbackend
if you want to change the defaults
(the userid that should start mythbackend, location of the logfile and (if
required) the name and location of the mythbackend binary).
Use chkconfig to make sure the script is called when entering runlevels 3, 4 or 5:
$ su
# chkconfig --level 345 mythbackend on
# exit
$
By default, the log file for mythbackend will be written to
/var/tmp/mythbackend.log
. This has been tested and is known to work
on Mandrake and Red Hat, but many people prefer to place logs under
/var/log/
.
To do this, create a group called mythtv
(or anything you prefer)
and add your usual MythTV users to that group. If you changed the user that
starts mythbackend from the default of root you must perform this
step.
Create the directory /var/log/mythtv
and set its
permissions as follows:
$ su
# mkdir /var/log/mythtv
# chown root:mythtv /var/log/mythtv
# chmod 0775 /var/log/mythtv
# exit
$ ls -ld /var/log/mythtv
drwxrwxr-x 2 root mythtv 4096 Apr 28 21:58 /var/log/mythtv/
$
Mandrake adds one more twist in the form of the msec
utility,
which runs regularly and (at the default or any higher security level) sets
permissions on many files, including those under /var/log
.
To tell msec about the MythTV log files and their directory, you need to
edit the /etc/security/msec/perm.local
file to include the
following:
# /etc/security/msec/perm.local
# Local overrides to the msec program
#
# Full file path user.group permissions
/var/log/mythtv/ root.mythtv 775
/var/log/mythtv/* root.mythtv 664
A copy of the above has been included in the contrib/ directory. You may add it by typing:
$ cd contrib
$ su
# cat etc.security.msec.perm.local >> /etc/security/msec/perm.local
# exit
Finally run the msec
tool to check and implement your
changes.
$ su
# msec
# exit
$
msec
to add missing permissions to the files or directories you
created.
The portage file for MythTV has scripts that will allow you to run mythbackend at startup.
To run mythbackend as a daemon which starts at boot time:
# rc-update add mythbackend default
To stop mythbackend as a daemon:
# /etc/init.d/mythbackend stop
To obtain a list of options:
# /etc/init.d/mythbackend
MythTV is flexible in the way that you define multiple backend tuner configurations. The only hard-and-fast rule is that the Master backend must have a capture device defined, but shouldn't imply that the capture device in the Master backend must be the first capture card defined in the database.
One example of an advanced configuration is the round-robin scheme. Rather than defining all of the cards on the master, you could first go into setup on the master to define globals such as the general configuration and the channel lineup but not the host-specific configuration item like the capture card. In this example, we will use a 4 tuner configuration, where two slaves have one card each and the master has two.
Using this scheme, the master backend will not use both capture cards until one of the following happens:
The scheduler in MythTV checks whether an encoder is available; if a slave backend isn't running, its encoder isn't available, so the scheduler will look for the next available encoder. This makes MythTV very flexible; slave tuners can come and go, and as long as there are enough tuners for what you'd like to record it doesn't matter which tuner in particular is going to be used.
Using this round-robin scheme along with a shared storage directory like NFS and enabling the Master Backend Override setting will allow you to view content even if the slave backend that recorded a program is not available.
The transcoder re-encodes files from one MythTV format to another. The main purpose of the transcoder is to allow users with hardware encoders (PVR-250) or systems that can only record in RTjpeg due to performance reasons (multiple capture cards, slow system, etc) to create MPEG-4 streams to save space.
The transcoder can be used in two ways:
The second method can be used on files that have already been transcoded (or files which were are already in the correct format), so only the frames immediately following a cut section will be re-encoded, resulting in a very minimal loss of quality.
To enable automatic transcoding, do the following: start the setup program under the host-specific settings: set the Transcoder Auto-run checkbox
For either manual or automatic transcoding: start mythbackend start mythfrontend select setup, and the Transcoding recording profile. now select either RTjpeg or MPEG-4 (selecting any of the hardware encoders will result in the transcoder not working). set the other parameters as you'd like. For best performance, you should match the audio to the 'Default' profile. If you plan to only use the manual transcoder, you can choose to set the video to be the same as the default profile too (as long as it is MPEG-4 or RTjpeg)
Everything should now be setup properly. If you elected to use the Auto-Run feature, the transcoder will automatically launch after each recording is complete. The transcoder thread runs at a low priority, so it should not impact any critical tasks or other recordings.
If you want to manually transcode a program, simply press 'X' while watching a recording (you should have already finished marking all commercials). If you change your mind, hitting 'X' again will stop the transcoding.
Once the transcode is complete, mythbackend will replace the old file with the new as soon as it is no longer in use.
If you need to change the name of the computers used with MythTV you'll need to perform a sequence of steps. There are a number of pieces of information that MythTV keeps track of which are tied to the hostname of the box, so changing the hostname involves altering the name in the operating system and in the MySQL database. In the examples below, the old name of the system was "frontend1" and we're going to change it to "kidsroom".
1. Stop all backends. If you run mythbackend from a terminal session, press control-c. If your backends are started with an init script, you would do something like the following:
$ su
# /etc/init.d/mythbackend stop
2. Change the hostname.
For Red Hat and derived distributions, edit the
/etc/sysconfig/network
file. Look for
HOSTNAME=frontend1
and change this to
HOSTNAME=kidsroom
or whatever you'll be using. For other
distributions, refer to the documentation, such as the
hostname(1)man page.
To alter the hostname in the current session, run:
# hostname kidsroom
3. Dump the database.
$ mysqldump -u mythtv -pmythtv mythconverg -c > mythtv_backup.sql
4. Rename the host in the database. First, ensure that the new hostname you'll be using isn't already in the database.
$ grep kidsroom mythtv_backup.sql
Now we're actually going to change the name. The following should all be
typed on the same line:
$ cat mythtv_backup.sql | sed s/\'frontend1\'/\'kidsroom\'/ >> mythtv_restore.sql
If you don't feel comfortable using sed, you can open the
mythtv_backup.sql
file in a text editor and perform a global search
and replace. When saving the file, make sure you use the new name,
mythtv_restore.sql
or the rest of the steps below will fail.
5. Drop and recreate the database.
$ mysql -u root
mysql>drop database mythconverg;
mysql>create database mythconverg;
mysql>exit
6. Restore the database using your edited version.
$ mysql -u mythtv -pmythtv mythconverg < mythtv_restore.sql
If you are running slave backends or frontends, don't forget to re-enable access as detailed in Modifying access to the MySQL database for multiple systems.
7. Start the backends. If you use init scripts, do the following, otherwise start them from terminal consoles.
# /etc/init.d/mythbackend start
8. Quit and restart all frontends. Delete the mythtv_backup.sql
and mythtv_restore.sql
files.
No.
While it is true that the TiVo runs the Linux kernel, and TiVo has released their changes to the kernel under the GPL, the TiVo is not a general-purpose computer, and there is no programming information available for the custom hardware contained within a TiVo.
The ReplayTV runs VxWorks, a Real Time Operating System from Wind River Systems.
Yes, you may, assuming that your wireless connection has sufficient bandwidth to maintain the datarate between the frontend and the backend. 802.11b should be sufficient if the encoded bitrate of the content is less than the datarate of your wireless connection, which in the case of 802.11b would be approximately 4 Mbps. (The advertised rate of 11Mbps gives an actual throughput of 4 Mbps.) 802.11a and 802.11g, if operating in their high-speed modes, or proprietary 802.11b "Turbo" schemes should be adequate. Multiple wireless frontends, poor signal strength or other factors can severely impact the viewing experience on the frontend.
There are two answers to this question. The easiest thing to do is to simply burn the MythTV files onto the DVD and treat the DVD as if it were a hard drive. This will allow you to save the programs, but it's likely that they will not be playable in a DVD player because the disc will simply contain files and not any DVD structure. If you'd like to create a DVD that will play in a standard DVD player and your files have been recorded as MPEG-2 from a device supported by the IVTV driver, the first step you'll need to perform is to remux the file to make it DVD compliant. Next, you'll use dvdauthor, mkisofs to create the ISO image, and finally dvdrecord to burn that to a blank DVD-R.
The requirements for this procedure are mjpegtools (provides mplex) and dvdauthor (provides mpeg2desc and dvdauthor).
This script will perform the necessary steps. You'll need to pass it the .nuv file and a name for the new DVD project. You should end up with a directory which you can mkisofs into a ISO file then burn it.
#!/bin/sh
mkfifo aud0
mkfifo vid0
mkfifo dvdmpg
mpeg2desc -a0 < $1 > aud0 &
mpeg2desc -v0 < $1 > vid0 &
mplex -f 8 -V -o dvdmpg aud0 vid0 &
dvdauthor -o $2 -f dvdmpg
dvdauthor -o $2 -T
rm aud0
rm vid0
rm dvdmpg
It's also possible to pipe the output of mkisofs directly to cdrecord without any intermediate files being written to your hard drive. For example:
#!/bin/sh
TSIZE=`mkisofs -dvd-video -udf -q -print-size .`
mkisofs -dvd-video -udf -V "$1" . | nice -10 cdrecord speed=1 dev=1,1,0 \
driveropts=burnfree -dao -v tsize="$TSIZE"s -
DataDirect will use different information for your video sources and channels than was used by XMLTV. The following will clear your old information in a way that will allow your EPG and existing recording rules to continue to work as you'd expect.
The first step is to create a backup of your database using the instructions found in I'd like to save or restore my database.
NOTE: Examine the contents of the backup file to be sure that the backup succeeded before modifying your database.
NOTE: The MythTV DataDirect grabber requires wget version 1.9.1 or later. Verify that this is installed before modifying your database.
Next, start mysql and perform the following commands:
$ mysql -u root mythconverg
mysql>CREATE TABLE channel_copy SELECT * FROM channel;
mysql>exit
$
Run the MythTV setup program. When the setup program prompts "Would you like to clear all program/channel settings before starting configuration [no]" type "yes".
Complete the configuration as detailed in the section called Configuring the Zap2It.com DataDirect service. and in Video Sources.
Once you're done running setup, run mythfilldatabase to populate the database with new data.
To restore the channel icons, you will need to perform one of two steps. Both are dependant on the channel_copy table you created above.
If you're running MySQL v3, execute the following. Note that the select command is very long. You can press ENTER at the end of each line; the command won't be evaluated until you end the statement with a semicolon.
$ mysql -u root mythconverg
mysql>create table channel_temp
select c.chanid, c.channum, c.sourceid, c.callsign, c.name, cb.icon,
c.finetune, c.videofilters, c.xmltvid, c.contrast, c.brightness,
c.colour, c.freqid, c.recpriority, c.hue, c.tvformat,
c.commfree, c.visible, c.outputfilters
from channel c
left join channel_copy cb on (c.callsign = cb.callsign);
mysql>truncate channel;
mysql>insert channel select * from channel_temp;
mysql>drop table channel_temp;
mysql>drop table channel_copy;
mysql>exit
$
If you are running MySQL v4, it's a little simpler. The next command is one long string:
$ mysql -u root mythconverg
mysql>UPDATE channel,channel_copy SET channel.icon = channel_copy.icon
WHERE channel.callsign = channel_copy.callsign;
mysql>drop table channel_copy;
mysql>exit
$