Play Recordings On Windows From MythWeb

From MythTV Official Wiki
Revision as of 03:51, 20 September 2006 by Mrsdonovan (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Introduction

Below are instructions on how users can browse the recordings via Mythweb on a Windows machine and with one click, have it play in VideoLan (VLC). Videos can also be played with one click from the MythWeb video listing, but it is necessary to modify code.

Notes

  • These instructions will not work through a firewall or over a slow < 5Mbps connection and assumes the computers are on the same LAN.
  • It just uses VLC to play the files, not the VLC server to stream the recordings.
  • These instructions only work on MythTV 0.20 (or greater)
  • These instructions won't work for slave backends (because of limitations with MythWeb) but the recordings can be shared.
  • Assumes Fedora Core

The instructions consist of three parts, first install and configure the necessary Windows applications, share the recordings directory via Samba, then modify Mythweb.

Time to implement

  • 1/2 hour for recordings and assumes access to MYSQL and setting up Samba via command line
  • or an hour for both recordings and videos and familiarity with symbolic links, editing php files

Installing Required Window Applications

First get and install these two applications on your Windows machine:

Now, with DSMyth, under the Start Menu -> MythTV Filters, run the "Configuration" program. It will bring up a screen called "MythTV DirectShow filter settings" which has a sidebar that has three tabs "MySQL database", "File associations" and "Network".

  • Note: The settings under "MySQL database" are not necessary for viewing recordings in Windows.

Under the "File Associations" tab, change the bottom "MythTV Urls:" to VLC by hitting "browse" finding the VLC executable or, if you installed it in the default directory, just paste in everything below:

"C:\Program Files\VideoLAN\VLC\vlc.exe" "%1"

You can also place the same link in the two slots above, but it is not necessary. Then hit OK.

  • Note: You can use the pre-defined mplayer2.exe, but it really sucks because it can't seek with out crashing, takes a long time to come-up and VLC has much better seek hotkeys (try CTRL-right arrow or ALT-right arrow or the forward/backward buttons on your mouse!)

DSMyth is used as a bridge application, when "myth:\\" links are clicked in a browser, DSmyth takes it and passes it along to VLC.

Configuring Linux Samba Shares

On your MythTV backend we are going to add a Samba share which will allow any Windows machine on the network to see all the recordings in the recordings directory on a read-only basis. First make sure the Samba and Lisa daemons are running and will start automatically on bootup:

# /sbin/chkconfig lisa on
# /sbin/service lisa start
# /sbin/chkconfig smb on
# /sbin/service smb start

Now, you could edit "/etc/exports" file and add a line to it like "/video/recordings/ *(r,async,all_squash)" (and restart samba) but it is easier to use the graphical interface of KDE. From the start menu, go to Control Panel -> Internet & Network -> Samba Configuration. You can then click the "Administrator Mode", enter the Root password, and setup the "Base Settings", i.e. Workgroup, Netbios name (leave as default) and the description. Then click on "File Sharing" above in the sidebar and go into "Administrator Mode" again, and "Add" the directory that contains all the MythTV recordings, for example "/video/recordings". Set the share to "visible" but not "writable" to avoid having recordings deleted.

  • Note: If you can't see anything under the "Samba Configuration" or "File Sharing", check if the processes are running:
# ps -A | grep lisa
# ps -A | grep smb

You should also have set the hostname for the machine at this point by

# hostname MyMythBackend

and replace "MyMythBackend" with whatever you want.

  • Note: One of the benefits of having Samba running is that you can now access MythWeb with the hostname, for example http://MyMythBackend/mythweb

Now check if your Windows machine can see the recordings directory because there is little point in continuing if it can't. (Give it a few minutes, finding new shares can be slow as it discovers clients, figures out who is the master, etc.)

Modifying Mythweb to View Recordings

The next step is to pass to VLC a URL from Mythweb that it can then use to play the recording off the samba share.

This would have been dead easy through the MythWeb interface because you can modify the value needed under the MythWeb settings page (Click the icon next to the weather icon) -> "MythTV global defaults" -> "Video URL", but it doesn't work (as of v0.20). Once you hit "Save" any required backward slashes "\" are replaced with "/" forward slashes which windows and VLC won't recognize. In other words, what you need is something like:

myth:\\MyMythBackend\recordings

but hitting save changes it to

myth://MyMythBackend/recordings

The only way is to modify the field directly in the database from a terminal window:

# mysql -u root mythconverg
(enter the password)
mysql> UPDATE `settings` SET `data` = 'myth:\\\\MyMythBackend/recordings/', `hostname` = NULL WHERE `value` = 'WebVideo_URL' AND `data` =  AND `hostname` IS NULL LIMIT 1 ;
  • Note the multiple backslashes are required, and yes there are forward and back slashes in there but VLC figures it out.

Now if you go back into MythWeb settings page -> MythTV global defaults, you should see the value you modified directly. If you hit the recordings page and hold you mouse over a thumbnail, you should see in the status bar a link like:

myth:\\MyMythbackend/recordings/1043_20060919140000.mpg

and if you click on it, it should bring up VLC and start playing the recording.

Troubleshooting

There are lots of things that can go wrong and the best way to fix it is to track backwards.

  • Can you see the samba share on your windows machine?
  • Is the directory and file in the place you expect, i.e. \\MyMythbackend\recordings\<etc>
  • Can you open that file over the share manually with VLC?
  • Is the path being generated by MythWeb correct?

Modifying MythWeb to View Videos

If you have videos you want to view directly through MythWeb, you can also share it via samba and modify MythWeb to create the correct links, but it requires modifying two files (assuming you use the default skin): First, modify

  • /mythweb/modules/video/handler.php

Change the line at the very bottom which starts with:

$this-url = root . implode (...)

with

$this->url = root . preg_replace('#^'.$mythvideo_dir.'/?#', , $this->filename);

Then modify

  • /mythweb/modules/video/tmpl/default/video.php

around line 80, change both links from:

echo '<a href="'.$show->url.'"> (...)

and a few lines down:

<td><?php echo '<a href="'.$show->url.'"> (...)

to:

(...)href="myth:\\\\MyMythBackend\\videos'.$show->url.'"(...)

Then in your videos directory create a symbolic link called MythWeb back to the videos directory, i.e.

#cd /mymedia/videos
#ln -s /mymedia/videos mythweb

Now when you visit the video section of MythWeb, the link should be correct and bring up the movie in VLC when clicked on. The link should look something like this:

myth:\\MyMythBackend\videos/mythweb/myfavoritemovie.avi

(I'm sure there is a way to modify handler.php to get rid of "mythweb", but it was simpler just to put in a symbolic link.)

Troubleshooting

  • Again, make sure you can get to the video share directly first.
  • Then make sure the URL you put in the video.php file is correct.
  • Check the symbolic link, it's a bit of a hack.