GMythStream
From GMythWiki
GMythStream (GMS) is a transcoder server developed in python. It makes live transcode of mythtv content and stream via HTTP.
Contents |
How to Install
Install from repository
Add this line to /etc/apt/source.list:
Ubuntu Feisty:
- deb http://hallysonluiz.com/mythtv feisty extras
Ubuntu Gutsy:
- deb http://www.renatofilho.com/apt gutsy main
and install gms packages:
- # apt-get update
- # apt-get upgrade
- # apt-get install gms gstreamer0.10-indt-mythtvsrc gstreamer0.10-indt-nuvdemux gstreamer0.10-ffmpeg
Also install the other gstreamer plugins, since some transcode requests could need different formats.
- # apt-get install gstreamer0.10-plugins-bad, gstreamer0.10-plugins-base, gstreamer0.10-plugins-good, gstreamer0.10-plugins-ugly
Some people faced conflicts between fluendo mpeg demux and other plugins. So, we recomend to remove this package:
- # apt-get remove gstreamer0.10-fluendo-mpegdemux
Install manually
There is a GMS Howto explaining how to install GMS manually, but we already have debian packages to make this installation easier. These packages were tested in the Feisty distribution and can be downloaded from gmyth sourceforge download area. Just download the following files:
- gms_0.3-indt2_i386.deb: The gmythstreamer server package;
- gstreamer0.10-ffmpeg_0.10.2-cvs20070814_i386.deb: The ffmpeg gstreamer plugins. This release has some fixes in the encoders needed.
- gstreamer0.10-indt-mythtvsrc_0.10.2-svn20070914_i386.deb: The mythtv gstreamer plugin. GMS accesses mythtv livetv and recorded programs through this plugin.
- gstreamer0.10-indt-nuvdemux_0.10.2-svn20070914_i386.deb: The nuv demux format gstreamer plugin needed only when using analog cards.
- gmencoder_0.1-indt2_i386.deb: The gmencoder application used as the transcoder engine.
- gmyth_0.4_i386.deb: The gmyth library used by mythtv gstreamer plugin to access mythtv data.
How to start/stop GMythStream
GMythStream is installed as a daemon. To start/stop:
- # /etc/init.d/gmsd start
- # /etc/init.d/gmsd stop
The logs are saved at /var/log/gms.log
How to test GMythStream
We see GMythStream as four step processes: list content, read data, transcode data, stream data. We can test step by step if things are ok:
1. List content
GMyth has one sample applications called gmyth-ls (install package gmyth-utils). gmyth-ls accesses mythtv (mysql) database to retrieve channel list and recorded programs list.
To list the recorded programs:
- gmyth-ls --hostname "mythtv_ip" --port "mythtv_port" --username "mysql_user" --password "mysql_passwd"
To list the livetv channels just add the --channels option in the line above.
The Mythtv default settings are mythtv_port=6543, mysql_user=mythtv, mysql_passwd=mythtv.
If gmyth-ls fails, it is because it could not connect to mythtv mysql database. Check if the mysql database has permission to be accessed from another machine.
2. Read data
Another sample aplication at gmyth-utils package is gmyth-cat. It accesses mythtv backend through mythtv protocol to read video data (livetv, recordings) and snapshots.
To read a recorded program:
- gmyth-cat --hostname "mythtv_ip" --port "mythtv_port" --filename "file_name" > /tmp/recording.avi
To read a livetv channel:
- gmyth-cat --hostname "mythtv_ip" --port "mythtv_port" --channel "channel_num" > /tmp/channel.avi
Try to play the output files recording.avi and channel.avi with mplayer: "mplayer /tmp/channel.avi"
If gmyth-cat fails, it is because it could not connect to the mythtv backend. Check if the backend is running and if the ip addresses at mythtv-setup are correct.
3. Transcode data
GMythStream uses gmencoder and mencoder apps to run transcoding. We recommend gmencoder. Although it is more complicated to install, it has given better results.
To transcode a mythtv recorded program:
- gmencoder -i myth://"mythtv_ip":"mythtv_port"/"filename" -o file:///tmp/recording.avi
To transcode a livetv channel:
- gmencoder -i myth://"mythtv_ip":"mythtv_port"/livetv?channel="channel_num" -o file:///tmp/channel.avi
Try to play the output files recording.avi and channel.avi with mplayer: "mplayer /tmp/channel.avi".
If gmencoder fails, it is probably because some gstreamer plugins are not installed or their versions have problems. Make sure these packages are installed with the correct version:
- gstreamer0.10-indt-mythtvsrc -> Release (0.10.2-svn20070914)
- gstreamer0.10-indt-nuvdemux -> Release (0.10.2-svn20070914)
- gstreamer0.10-ffmpeg -> Release (0.10.2-cvs20070814)
4. Stream data
Now it is time to test the GMythStream as a whole. Make sure the mythtv backend and the gms daemon are running (/etc/init.d/gmsd start).
To request transcode and play a mythtv recorded program with mplayer:
- mplayer "http://<gms_ip>:<gms_port>/transcode.do?transcoder=gmencoder&type=myth&uri=<mysql_user>:<mysql_passwd>@<mythtv_ip>:<mythtv_port>/<file_name>"
To request transcode and play a mythtv livetv channel with mplayer:
- mplayer "http://<gms_ip>:<gms_port>/transcode.do?transcoder=gmencoder&type=myth&uri=<mysql_user>:<mysql_passwd>@<mythtv_ip>:<mythtv_port>/livetv?channel=<chan_num>"
<gms_ip> is the gmythstream ip address
<gms_port> is the gmythstream port. By default: 40000.
<mysql_user> the username to access mythtv mysql database. By default: mythtv
<mysql_passwd> the passwd to access mythtv mysql database. By default: mythtv
<mythtv_ip> the mythtv backend ip address
<mythtv_port> the mythtv backend port. By default: 6543
<file_name> the recorded program file name. You can get this from gmyth-ls.
<chan_num> the channel number. You can get this from gmyth-ls.
PS: You have to maintain the quotes: mplayer "...". Note that gms does not need to run at the same machine as mythtv backend :).
If you install mplayer in the N800, this line also works. You can also type this (huge) url in the platform media player.
If steps 1, 2 and 3 works, but 4 does not work, check if gms is running. If it is ok, please, send the gms log file (/var/log/gms.log) to the gmyth-devel mainling list.
