Author |
Message |
paulsid
|
Posted: Tue Dec 08, 2009 1:55 am |
|
Joined: Thu Apr 03, 2008 11:42 pm
Posts: 114
Location:
Calgary, Canada
|
MythExport is a daemon for exporting and transcoding recordings from MythTV. It can be used as a replacement for myth2ipod, and (unlike myth2ipod) is still actively supported and maintained. This is a HOWTO guide to getting it working with R6.
Don't let the length of the instructions below faze you. The install is actually fairly straightforward. I assume no prior knowledge of myth2ipod and just a basic familiarity of Linux and MythTV. Most of the length is due to the stuff to copy/paste, plus my natural longwindedness.
A bit of background: I used myth2ipod quite a bit but since moving to R6 have been unable to get it to work. While researching problems with it in R5.5, I discovered MythExport as an alternative, but could never get it to work due to dependency problems. Then I managed to solve my myth2ipod issue so I left it. However, after failing to fix new myth2ipod problems in R6, on a total whim of frustration I typed in "pacman -S mythexport", fully expecting it to say "package not found". To my utter amazement, it did not, and instead asked me to confirm the install!! (A big THANK YOU to whoever (cecil?) decided to include this!)
After the stun wore I proceeded to try to get MythExport to work. Alas, it was not a simple matter, as R6's setup does not match what MythExport expects. Indeed, my first two cracks at it quickly turned into failure, and for a while I went back to trying to fix myth2ipod, without success. Eventually I tried again to fix MythExport and this time managed to get it working. Third time's the charm I guess!
NOTE: All file operations (creates, executes, etc.) should be done while logged in as mythtv, unless otherwise noted. - First, install the package along with two additional dependencies that are not in the PKGBUILD:
Code: sudo pacman -S mythexport perl-proc-daemon perl-proc-pid-file - Create some required directories and adjust the permissions on one of them:
Code: sudo mkdir -p /etc/mythtv/mythexport /var/run/mythtv sudo chown -R mythtv:mythtv /etc/mythtv - Normally, MythExport setup is done via a web interface, but I have been unable to get this to work under R6, which uses lighttpd and not Apache as MythExport seems to expect. The good news is we can do without it, but it'd be nice to get this working, if someone with more lighttpd experience can help?
- Create a configuration file called /etc/mythtv/mythexport/mythexport_settings.cfg using your favourite text editor. Here is mine (which I stole from the forum thread mentioned later), which should work for all non-touch iPods (if you have an iPhone or iPod Touch you may need a different configuration):
Code: dir=/myth/ipodfeed
[ipod] removeCommercials=0 extension= codec=mpeg4 sizeY=240 sizeX=320 aspect=4:3 videoBR=600000 threads= device=ipod podcastName=MythTV deletePeriod= audioBR=192000 ffmpegArgs=-y -acodec libfaac -ab 192000 -vcodec mpeg4 -b 600000 -mbd 2 -flags +4mv+aic -trellis 2 -cmp 2 -subcmp 2 -s 320x240 -deinterlace -aspect 4:3 audioChannels= deinterlace=1 - Unfortunately, the MythExport script has a lot of hardcoded values that have not been kept consistent, so we must create a symlink to the configuration file to ensure the daemon can always find it:
Code: ln /etc/mythtv/mythexport/mythexport_settings.cfg /etc/mythtv/mythexport/mythexport.cfg - To use the cgi that generates the actual RSS feed, edit /etc/lighttpd/lighttpd.conf and insert the lines below. I don't think it matters where so for consistency I put mine just below a similar-looking entry for pdf files that is roughly 130 lines in:
Code: $HTTP["url"] =~ "/mythexport/" { cgi.assign = ( ".cgi" => "/usr/bin/perl" ) } - As root, follow these steps to create the service scripts:
- Create a new service directory: mkdir /etc/sv/mythexport
- Create a script /etc/sv/mythexport/run with the following content:
Code: #!/bin/bash /usr/bin/mythexport-daemon PID=`pidof -o %PPID -x /usr/bin/mythexport-daemon` # Wait until daemon dies, else runit can't supervise us while [ "`pidof -o %PPID -x /usr/bin/mythexport-daemon`" == "$PID" ]; do sleep 2; done; - Create a script called /etc/sv/mythexport/finish with the following content:
Code: #!/bin/bash #runit only knows about the run script wrapper, so kill the daemon ourselves kill `pidof -o %PPID -x /usr/bin/mythexport-daemon` >/dev/null 2>&1 - Make the scripts executable: chmod 755 /etc/sv/mythexport/* [EDIT: Fixed folder]
- Add the service: add_service.sh mythexport
- Run mythtv-setup (Alt+S), select General, and go to the screen that lets you edit the job commands. Change the command for the Encode For iPod job to:
Code: mythexport_addjob starttime=%STARTTIME% chanid=%CHANID% config=ipod - The location MythExport expects you to use is /myth/archive. If this is acceptable, change the dir setting at the start of your mythexport.cfg. However, if, like me, you prefer a separate directory for your iPod files, you instead need to change the web symlink, and ensure your dir setting matches. In my config I used existing the ipodfeed folder:
Code: sudo rm /usr/share/mythtv/mythexport/video sudo ln -s /myth/ipodfeed /usr/share/mythtv/mythexport/video - [EDIT: added this step] Create a link to config.xml where MythExport expects to find it: [code]ln -s /home/mythtv/.mythtv/config.xml /srv/http/.mythtv/config.xml[code]
That should be it for the install. To verify the service is running, run ps -ef | grep mythexport and look for the runsv line and the daemon itself. If everything is working, you can now export via the usual job on any recording, using either mythfrontend or MythWeb. MythExport will log to /var/log/mythtv/mythexport.log. If you need to troubleshoot, stop the service ( sv stop mythexport) and then manually run the daemon in debug mode: [code]sudo mythexport-daemon --debug[/code]You can also run the mythexport_addjob script by hand if you have the recording's starttime and chanid. Note that the daemon waits a bit between polling the job database, so when you add a job processing may not start right away. If you have to do troubleshooting, you can avoid this by adding the job BEFORE rerunning the script, so it will be picked up immediately. The RSS feed of exported programs can be accessed from this URL, which you can enter into iTunes under Advanced->Subscribe to Podcast: [code]http://localhost/mythexport/mythexportRSS.cgi[/code] Lastly, once you are sure everything is working be sure to reboot to test that the daemon properly auto-starts! DISCLAIMER: I run R6 with the new (testing) mythtv 0.22 packages installed. In theory it should work exactly the same if you have the normal 0.21 installation though. References:
Last edited by paulsid on Tue Mar 02, 2010 12:07 pm, edited 1 time in total.
|
|
Top |
|
|
Martian
|
Posted: Mon Dec 21, 2009 10:29 pm |
|
Joined: Wed Feb 08, 2006 6:13 pm
Posts: 480
Location:
IN
|
Just got an iPod Touch for my wife for Christmas and was trying to get this going.
I got as far as you did but haven't figured out anything further. Unfortunately as you said your mythexport_settings.cfg isn't good for the Touch.
It's interesting that the Mythexport scripts seem to work yet you can't access the setup page through the web. I tried and tried but couldn't figure that one out. It appears that the scripts are there but the html or php files or whatever aren't.
Anyway just wondering if you or anyone else had made it any further with this or if anyone has any suggestions for a mythexport_settings.cfg that would be good for the iPhone / iPod Touch.
Martian
_________________ ABIT NF-M2 nView | Athlon 64 X2 3800+ | 2GB DDR2 800 | HDHomerun | GeForce 6150 (onboard) | WD 640 GB SATA HD | DVD-RW (sata) | StreamZap IR receiver with Logitech Harmony remote
Vizio 37" LCD HDTV (1080p)
|
|
Top |
|
|
paulsid
|
Posted: Tue Dec 22, 2009 11:28 am |
|
Joined: Thu Apr 03, 2008 11:42 pm
Posts: 114
Location:
Calgary, Canada
|
There may have been a Touch config buried somewhere in that big thread... if not the main thing would probably be the ffmpeg options, and you might be able to find those from another source or derive them. (IIRC the Touch has a widescreen resolution and might use a different format?)
Quote: It's interesting that the Mythexport scripts seem to work yet you can't access the setup page through the web. I tried and tried but couldn't figure that one out. It appears that the scripts are there but the html or php files or whatever aren't.
Well I've looked at the Ubuntu source package and there's nothing there we don't have. It's possible it might be something simple like we are just missing some perl libraries the scripts depend on... however I was not able to find a way to get lighttpd to give me proper debugging info. It oddly does not log anything when the scripts give 500 errors.
|
|
Top |
|
|
Martian
|
Posted: Tue Dec 22, 2009 12:27 pm |
|
Joined: Wed Feb 08, 2006 6:13 pm
Posts: 480
Location:
IN
|
I'm pretty much seeing the same things you are. Thanks for the reply!
Martian
_________________ ABIT NF-M2 nView | Athlon 64 X2 3800+ | 2GB DDR2 800 | HDHomerun | GeForce 6150 (onboard) | WD 640 GB SATA HD | DVD-RW (sata) | StreamZap IR receiver with Logitech Harmony remote
Vizio 37" LCD HDTV (1080p)
|
|
Top |
|
|
Martian
|
Posted: Wed Dec 23, 2009 2:40 pm |
|
Joined: Wed Feb 08, 2006 6:13 pm
Posts: 480
Location:
IN
|
Well I think I've managed to construct a working ffmpeg command line for the iPod Touch. Here it is if anyone is interested:
Code: dir=/myth/ipodfeed
[ipod] removeCommercials=0 extension= codec=libx264 sizeY=272 sizeX=480 aspect=16:9 videoBR=300000 threads= device=ipod podcastName=MythTV deletePeriod= audioBR=128000 ffmpegArgs=-y -acodec libfaac -ab 128000 -ar 48000 -ac 2 -vcodec libx264 -b 300000 -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -refs 1 -coder 0 -me_method umh -me_range 16 -subq 6 -partitions +parti4x4+parti8x8+partp8x8 -g 250 -keyint_min 25 -i_qfactor 0.71 -s 480x272 -deinterlace -aspect 16:9 audioChannels=2 deinterlace=1
I tried accessing the RSS feed in iTunes but nothing happened. Paulsid, were you able to get that to work?
I really want to be able to hit "Transcode to iPod" on the Myth box and have iTunes do the rest but right now it's not looking promising. I wish I knew more about CGI, Podcasts, and RSS feeds...
I can access the [MyHost]/mythexport/mythexportRSS.cgi page through my browser on my Windows machine but like all the other .cgi files from Mythexport it just gives me a blank white page and no errors. I was hoping maybe iTunes could make sense of it but so far no luck.
Martian
_________________ ABIT NF-M2 nView | Athlon 64 X2 3800+ | 2GB DDR2 800 | HDHomerun | GeForce 6150 (onboard) | WD 640 GB SATA HD | DVD-RW (sata) | StreamZap IR receiver with Logitech Harmony remote
Vizio 37" LCD HDTV (1080p)
|
|
Top |
|
|
paulsid
|
Posted: Wed Dec 23, 2009 3:27 pm |
|
Joined: Thu Apr 03, 2008 11:42 pm
Posts: 114
Location:
Calgary, Canada
|
Martian wrote: I really want to be able to hit "Transcode to iPod" on the Myth box and have iTunes do the rest but right now it's not looking promising. I wish I knew more about CGI, Podcasts, and RSS feeds...
I can access the [MyHost]/mythexport/mythexportRSS.cgi page through my browser on my Windows machine but like all the other .cgi files from Mythexport it just gives me a blank white page and no errors. I was hoping maybe iTunes could make sense of it but so far no luck.
Hmm, the mythexportRSS.cgi page worked for me with only the minor addition to lighttpd.conf (step 6). Maybe this is obvious, but have you restarted lighttpd (sudo sv restart lighttpd) or rebooted so it picks up the changes?
When you browse to that page you should be seeing a feed page titled MythCast, with the show titles and links to the exported media files. (Unless you are still using an older IE version that doesn't recognize RSS.) At that point clicking a link should start to download the file, and if that works then iTunes can pick it up. (I do have this working.)
I'll doublecheck my setup when I get home from work in a few hours and see if I can find anything else that might be causing this...
|
|
Top |
|
|
Martian
|
Posted: Wed Dec 23, 2009 6:01 pm |
|
Joined: Wed Feb 08, 2006 6:13 pm
Posts: 480
Location:
IN
|
EDIT: I think I got it!
Code: chown http:users /srv/http and now it appears to be working! EDIT2: I've found a way to get the .cgi scripts to display error info in the browser window. Edit your .cgi script and append a -w to #!/usr/bin/perl then add the following lines just below #!/usr/bin/perl -w like so: Code: #!/usr/bin/perl -w
use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use warnings; use strict;
Unfortunately I get the following error when I try to run setup.cgi:
Quote: Software error:
Can't locate HTML/Template.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.10.0 /usr/share/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl /usr/lib/perl5/current /usr/lib/perl5/site_perl/current .) at /data/srv/httpd/htdocs/mythexport/setup.cgi line 9. BEGIN failed--compilation aborted at /data/srv/httpd/htdocs/mythexport/setup.cgi line 9.
For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.
Martian
_________________ ABIT NF-M2 nView | Athlon 64 X2 3800+ | 2GB DDR2 800 | HDHomerun | GeForce 6150 (onboard) | WD 640 GB SATA HD | DVD-RW (sata) | StreamZap IR receiver with Logitech Harmony remote
Vizio 37" LCD HDTV (1080p)
|
|
Top |
|
|
Martian
|
Posted: Thu Dec 24, 2009 10:35 am |
|
Joined: Wed Feb 08, 2006 6:13 pm
Posts: 480
Location:
IN
|
I can now subscribe to my podcast and download shows!!!
iTunes did NOT like me using a redirection URL. I can to hardcode it with my non-standard port specified instead of using the redirection URL.
Martian
_________________ ABIT NF-M2 nView | Athlon 64 X2 3800+ | 2GB DDR2 800 | HDHomerun | GeForce 6150 (onboard) | WD 640 GB SATA HD | DVD-RW (sata) | StreamZap IR receiver with Logitech Harmony remote
Vizio 37" LCD HDTV (1080p)
|
|
Top |
|
|
paulsid
|
Posted: Thu Dec 24, 2009 12:06 pm |
|
Joined: Thu Apr 03, 2008 11:42 pm
Posts: 114
Location:
Calgary, Canada
|
Cool, glad you fixed your issue. It's a pity MythExport uses so many hardcoded values, but it's fairly new and I don't think is used very much outside of Ubuntu so that's to be expected.
Also thanks for the -w tip, that looks like it'll be very helpful in trying to get those pages working.
|
|
Top |
|
|
Martian
|
Posted: Mon Dec 28, 2009 9:32 pm |
|
Joined: Wed Feb 08, 2006 6:13 pm
Posts: 480
Location:
IN
|
Everything is working splendidly now, except for the fact that all of my transcoded shows have a very noticeable audio lag. I have tried adding both async 1 as well as async 30 to my ffmpeg line but no change from either.
I know this is started to drift off topic but would appreciate any advice / guidance / etc... anyone could offer. I'm so close but I just can't seem to squish this audio sync bug.
My source is OTA (via antennae) captured with an HDHomerun. The issue is in the encoded file as it is present in playback in VLC as well as on the iPod Touch.
Martian
_________________ ABIT NF-M2 nView | Athlon 64 X2 3800+ | 2GB DDR2 800 | HDHomerun | GeForce 6150 (onboard) | WD 640 GB SATA HD | DVD-RW (sata) | StreamZap IR receiver with Logitech Harmony remote
Vizio 37" LCD HDTV (1080p)
|
|
Top |
|
|
indolent
|
Posted: Thu Jan 28, 2010 8:58 pm |
|
Joined: Mon Feb 12, 2007 11:51 am
Posts: 9
|
Martian wrote: Everything is working splendidly now, except for the fact that all of my transcoded shows have a very noticeable audio lag. I have tried adding both async 1 as well as async 30 to my ffmpeg line but no change from either.
I know this is started to drift off topic but would appreciate any advice / guidance / etc... anyone could offer. I'm so close but I just can't seem to squish this audio sync bug.
My source is OTA (via antennae) captured with an HDHomerun. The issue is in the encoded file as it is present in playback in VLC as well as on the iPod Touch.
Martian
Great guide.
I also have the audio sync issue that Martian has. Anyone have any ideas?
|
|
Top |
|
|
Martian
|
Posted: Fri Jan 29, 2010 9:40 am |
|
Joined: Wed Feb 08, 2006 6:13 pm
Posts: 480
Location:
IN
|
indolent wrote: I also have the audio sync issue that Martian has. Anyone have any ideas?
I'm curious - Are you also using an HDHomerun as your source?
I never was able to sort this one out. I planned to try other codecs to see if they share the audio sync problem or if it's only H.264 but got burnt out on the issue and moved to other projects.
Do let me know if you have any success!
Martian
_________________ ABIT NF-M2 nView | Athlon 64 X2 3800+ | 2GB DDR2 800 | HDHomerun | GeForce 6150 (onboard) | WD 640 GB SATA HD | DVD-RW (sata) | StreamZap IR receiver with Logitech Harmony remote
Vizio 37" LCD HDTV (1080p)
|
|
Top |
|
|
ceenvee703
|
Posted: Sun Jan 31, 2010 7:59 pm |
|
Joined: Fri Apr 02, 2004 10:08 am
Posts: 1637
Location:
Virginia, USA
|
I thought I followed all the steps correctly but when I do the "run ps -ef | grep mythexport" to see if it's running, I get the following:
Code: [root@mbe ceenvee703]# ps -ef|grep mythexport root 5165 1 0 Jan05 ? 00:00:50 runsvdir -P /var/service log: ccess denied?runsv mythexport: fatal: unable to start ./run: access denied?runsv mythexport: fatal: unable to start ./finish: access denied?runsv mythexport: fatal: unable to start ./run: access denied?.runsv mythexport: fatal: unable to start ./finish: access denied?runsv mythexport: fatal: unable to start ./run: access denied?runsv mythexport: fatal: unable to start ./finish: access denied? root 13638 12704 0 20:56 pts/0 00:00:00 grep mythexport root 30022 5165 0 Jan29 ? 00:01:53 runsv mythexport
It looks like I screwed up the sv scripts, but I double checked and they're the same scripts (I copied/pasted them) and re-ran the chmod 755 with no luck.
Thanks for any leads.
|
|
Top |
|
|
paulsid
|
Posted: Sun Jan 31, 2010 11:43 pm |
|
Joined: Thu Apr 03, 2008 11:42 pm
Posts: 114
Location:
Calgary, Canada
|
ceenvee703 wrote: It looks like I screwed up the sv scripts, but I double checked and they're the same scripts (I copied/pasted them) and re-ran the chmod 755 with no luck.
Hmm, it looks like it's trying to run the daemon as a non-root user. Were you root when you ran add_service.sh? Check the ownership on the link /var/service/mythexport, which is created by the script. Also do ps -ef | grep "runsv mythexport" and see who owns the process, it should be root. If need be you can run remove_service.sh and then rerun add_service.sh as root.
That's all I can think of offhand...
|
|
Top |
|
|
ceenvee703
|
Posted: Mon Feb 01, 2010 7:13 am |
|
Joined: Fri Apr 02, 2004 10:08 am
Posts: 1637
Location:
Virginia, USA
|
I removed and then re-added as root, didn't help, still get those same errors with runsvdir.
Here's the ls for the mythexport service scripts
Code: [root@mbe ceenvee703]# ls -lah /etc/sv/mythexport total 20K drwxr-xr-x 3 root root 4.0K 2010-01-29 19:26 . drwxr-xr-x 47 root root 4.0K 2010-01-29 19:25 .. -rwxr-xr-x 1 root root 157 2010-01-31 21:01 finish -rwxr-xr-x 1 root root 237 2010-01-31 21:01 run drwx------ 2 root root 4.0K 2010-02-01 08:05 supervise
I did a ugo+x to see if that would help, and it didn't. I ran the daemon in debug mode as specified and it seems to OK, I think: Code: February 1 08:05:23 mbe /usr/bin/mythexport-daemon[16651]: Stopping Processing: 1265029523 February 1 08:05:30 mbe /usr/bin/mythexport-daemon[28549]: Starting Processing: 1265029530 February 1 08:08:31 mbe /usr/bin/mythexport-daemon[28549]: Caught SIGTERM: exiting gracefully February 1 08:08:31 mbe /usr/bin/mythexport-daemon[28549]: Stopping Processing: 1265029711 February 1 08:08:46 mbe /usr/bin/mythexport-daemon[28745]: Starting Processing: 1265029726 February 1 08:08:46 mbe /usr/bin/mythexport-daemon[28745]: query = select id, type, param from mythexport_job_queue order by id at line 607 in /usr/bin/mythexport-daemon February 1 08:09:46 mbe /usr/bin/mythexport-daemon[28745]: query = select id, type, param from mythexport_job_queue order by id at line 607 in /usr/bin/mythexport-daemon February 1 08:10:46 mbe /usr/bin/mythexport-daemon[28745]: query = select id, type, param from mythexport_job_queue order by id at line 607 in /usr/bin/mythexport-daemon
I'll see if I can actually transcode anything.
|
|
Top |
|
|