Difference between revisions of "User:Steveadeff"

From MythTV Official Wiki
Jump to: navigation, search
m
(Parent's Systems)
 
(121 intermediate revisions by 3 users not shown)
Line 2: Line 2:
  
 
== My Life ==
 
== My Life ==
I am as of March 2006 an electrical engineer for Parsons in Boston, MA. I help design manufacturing and lab facilities for pharmaceuticals.
+
Electric Power Engineer living in Boston, MA
 +
 
 +
I can be reached for mythtv purposes at adeffs_dot_mythtv_at_gmail_dot_com.
  
 
== My Myth Contributions ==
 
== My Myth Contributions ==
 
I don't really code, but I try to be active in bug and feature testing.
 
I don't really code, but I try to be active in bug and feature testing.
  
I developed a TV.com import perl script for adding archived shows to the Watch Recordings DB. I've received help from folks on the myth mailing lists in this project.
+
=== TVRage.com ===
 +
This project has been moved to [http://code.google.com/p/tvrageimport/ Google Code] to make managing it easier.
 +
 
 +
TVRage.com import perl script for adding archived shows to the MythTV Watch Recordings DB or the MythVideo? database (pre-0.22).
 +
 
 +
=== 6200changer.sh ===
 +
I wrote a script for handling my DCT-6200 cable boxes connected via firewire that changes the channel and uses firewire_tester to stabilize the connection before Myth tries to record. This has, over the last two years, allowed me to not fail in recording a single show.
 +
 
 +
To use, set it up in mythtv-setup as the channel change script. Give it the GUID of the box as shown in mythtv-setup. The script takes two variables, the first being the GUID (which is why you have to specify it) and the second is the channel number (which mythtv automatically feeds it at the end of the command you give it). The script then changes the channel on that GUID and runs firewire_tester. In running firewire_tester it requires that it show the connection is stable twice. If it iterates 10 times it will automatically re-tune the channel, and after 50 attempts total it will send Myth the "failed" result, otherwise it will send Myth the "success" result.
 +
 
 +
You can change the script to use another channel changer if you require.
 +
 
 +
<pre>#!/bin/bash
 +
#
 +
 
 +
GUID=`echo "$1"|sed -r "s/[A-Z]+/\L&/g"`
 +
CHANNEL=$2
 +
 
 +
NODE=`plugreport | grep $GUID | awk '{if (($1 == "Node")  && ($4 == "'"0x$GUID"'
 +
")) print $2}'`
 +
echo "Node: '$NODE'"
 +
echo "Changing to channel $CHANNEL"
 +
6200ch -v -s -g $GUID $CHANNEL
 +
#maybe a pause is needed?
 +
sleep 4
 +
 
 +
STABILIZE="1"
 +
COUNT=0
 +
TOTALCOUNT=0
 +
STABLECOUNT=0
 +
echo "Stabilizing Firewire Connection!..."
 +
#maybe an initial run followed by a verification run?
 +
 
 +
#initial run
 +
firewire_tester -B -r2 -n$NODE
  
*I recently updated it for TVRage.com importing, the new version is sort of "beta" status and can be found [http://www.jobs-khakis-chicks.com/MythTV/TVRageImport/ here] (tvragegrab).
+
#while [ "$STABILIZE" != "Broadcast Fix: Success (already stable)" ]
 +
while [ $STABLECOUNT -lt 2 ]
 +
do
 +
      STABILIZE=`firewire_tester -B -n$NODE|grep "already stable"`
 +
      if [[ "$STABILIZE" != "Broadcast Fix: Success (already stable)" ]]
 +
      then
 +
              echo "Not Stable! Attempt $COUNT"
 +
              ((COUNT+=1))
 +
              ((TOTALCOUNT+=1))
 +
              if [ $TOTALCOUNT -gt 50 ]
 +
              then
 +
                      echo "FAILED to Stabilize!!"
 +
                      exit 1
 +
              fi
 +
              if [ $COUNT -gt 10 ]
 +
              then
 +
                      6200ch -v -s -g $GUID $CHANNEL
 +
                      COUNT=0
 +
                      firewire_tester -B -r2 -n$NODE
 +
              fi
 +
      else
 +
              echo $STABILIZE
 +
              ((STABLECOUNT+=1))
 +
      fi
 +
done
 +
echo "Stable!"
 +
exit 0
 +
</pre>
  
 
= My Systems =
 
= My Systems =
  
I have Comcast cable here in Boston. I use QAM for my HD and have two DCT-6200 digital cable boxen. My area has heavy 5C DRM enabled making firewire capture pretty pointless. So I use one connected to a PVR-150 for recording all the channels I get and the other is connected directly to my TV for HD use. It is also connected to my remote frontend via firewire and can be used for capture, which I've started doing now. Eventually I hope to replace them with two better quality 1000bT switches so this is no longer an issue).
+
I've since moved on from MythTV after moving out of the 5br apartment I lived in with housemates and now use a TiVo Roamio.  
  
== Current Dedicated Back End ==
+
== Dedicated Back End ==
  
Running SVN, currently (and the last time I updated this...) fixes-95??
+
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16813157305 ASRock 970DE3/U3S3] AM3+ AMD 770 SATA 6Gb/s USB 3.0 ATX AMD Motherboard
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16819103961 AMD FX-8120] Zambezi 3.1GHz Socket AM3+ 125W Eight-Core Desktop Processor FD8120FRGUBOX
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16820148543 Crucial Ballistix sport 8GB] (2 x 4GB) 240-Pin DDR3 SDRAM DDR3 1333 (PC3 10600) Desktop Memory Model BLS2KIT4G3D1339DS1S00
 
* [http://www.newegg.com/product/product.asp?item=N82E16811219007 Norco RPC-810 4U Rackmount Chassis] (wonderful!!)
 
* [http://www.newegg.com/product/product.asp?item=N82E16811219007 Norco RPC-810 4U Rackmount Chassis] (wonderful!!)
* [http://www.pcstats.com/articleview.cfm?articleID=1652 MSI K8N Neo2 Platinum]
+
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16817139005&Tpk=CMPSU-650TX Corsair CMPSU-650TX 650W Power Supply]
* [http://www.newegg.com/Product/Product.asp?Item=N82E16819103535 AMD Athlon 64 3200+ 2000MHz HT Socket 939] Venice Core
+
* Maxtor 7L300R0 300GB System Drive
* 1024MB Corsair DDR400 RAM
+
* 6x500GB 7200RPM 8MB cache, SATA Recording Drives via Storage Groups
* [http://www.newegg.com/product/product.asp?item=N82E16817103932 Antec TruePower 2.0 TP2-550 EPS12V 550W Power Supply]
 
* Adaptec 2940U2W SCSI Controller Card
 
** [http://www.maxtor.com/portal/site/Maxtor/menuitem.5d2b41d3cef51dfe29dd10a191346068/?channelpath=/en_us/Support/Product%20Support/Enterprise%20Storage/Atlas%2010K%20Family/Atlas%2010K%20III%20Ultra320 Maxtor Atlas10K III] U320 18GB - System Drive
 
** 3x [http://www.seagate.com/support/disc/manuals/scsi/100109943d.pdf Seagate Cheatah 73LP] 73.4GB - Data Drives in RAID 5 Array
 
(I want to replace these with a single ~300GB ATA drive as its about equal on space but uses a lot less electricity and one less PCI slot...)
 
* Recordings Drive RAID 10
 
** 2x Maxtor 7L300R0 (ATA)
 
*** [http://www.newegg.com/Product/Product.asp?Item=N82E16816102007 Promise Ultra133 TX2 PCI IDE PCI Controller Card]
 
** 2x Maxtor 7L300S0 (SATA)
 
 
* Tuners
 
* Tuners
** 0x [http://www.pchdtv.com/ pcHDTV HD3000] (too many issues, want to get an HDHomeRun now...)
+
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16815706001 Ceton InfiniTV 4] - Quad-tuner Card, w/ CableCard
** 2x [http://www.newegg.com/Product/Product.asp?Item=N82E16815100134 Avermedia A180 HDTV Tuner]
+
 
** [http://www.newegg.com/Product/Product.asp?Item=N82E16815116620 Hauppauge WinTV-PVR-150 MCE] with a Motorola DCT-6200 Digital Cablebox controlled via firewire.
+
== Fileserver ==
 +
 
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16813188035 EVGA EVGA 113-YW-E115-TR] - LGA 775 NVIDIA nForce 730i HDMI ATX Intel Motherboard
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16819116072 Intel Pentium E5200 Wolfdale 2.5GHz] - LGA 775 65W Dual-Core Desktop Processor BX80571E5200
 +
* 2x1GB DDR2, 2x512MB DDR
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16817139006 CORSAIR CMPSU-750TX 750W ATX12V / EPS12V Power Supply]
 +
* 6x2TB SATA
 +
** TV Rips, HDTV conversions
 +
** Music
 +
** Movies
 +
 
 +
== Theater Room Frontend ==
 +
 
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16811129029  Antec Silver on Black Veris Fusion ] - 430 Micro ATX Media Center / HTPC Case with IR receiver
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16822148693 Seagate ST3802110ACE 80GB ] system drive
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16827136149 LG GH20NS15 SATA DVD Burner]
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16813138061 BIOSTAR N68PA-M2T TForce TF7050-M2] AM2 NVIDIA GeForce 7050PV HDMI Micro ATX AMD Motherboard
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16819103774 AMD Athlon 64 X2 4000+] Brisbane 2.1GHz Socket AM2 65W Dual-Core Processor ADO4000DDBOX
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16820134488 Kingston 2GB] (2 x 1GB) 240-Pin DDR2 SDRAM DDR2 800 (PC2 6400) Dual Channel Kit Desktop Memory Model KVR800D2K2/2GR
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16814121397 ASUS ENGT430/DI/1GD3(LP)] GeForce GT 430 (Fermi) 1GB 128-bit DDR3 PCI Express 2.0 x16
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16880121003 AVS Gear GP-IR01BK] Windows Vista Infrared MCE Black Remote Control
 +
 
 +
== Frontend Theater/Stereo Equipment ==
 +
* [http://www.samsung.com/us/video/tvs/PN60F5350AFXZA Samsung PN60F5350AFXZA] - 60" 1080p Plasma
 +
* [http://usa.denon.com/us/Product/Pages/ProductDetail.aspx?PCatId=AVSolutions%28DenonNA%29&CatId=AVReceivers%28DenonNA%29&Pid=AVR3806%28DenonNA%29 Denon AVR-3806] - being used as a Pre/Pro
 +
* [http://www.parasound.com/vintage/hca1205a.php Parasound HCA-1205A] - 5x120W Amp
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16882105669 Sony BDP-S390] Blu-ray Disc Player
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16812107800 Belkin PureAV PF-60] Power Center, Silver
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16880111030 Logitech Harmony 700] Universal Remote Control
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16882117403 Pioneer SP-FS51-LR] Floorstanding Speakers
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16882117404 Pioneer SP-C21] Center Channel
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16882117406 Pioneer SP-BS41-LR] 2CH Bookshelf Loudspeakers as surrounds
 +
Old Speakers:
 +
* Paradigm Reference Studio(v.2) [http://www.paradigm.com/en/reference/fronts-studio-studio40-model-2-13-1-27.paradigm 40's], Studio CC(v.2) and Titan's for surround
 +
 
 +
== Current Personal Bedroom Equipment ==
 +
* [http://www.universalremote.com/product_detail.php?model=55 Home Theater Master MX-500] Universal Remote Control
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16824236080 ASUS MT276HE] Black 27" 2ms(GTG) HDMI Widescreen LCD Monitor
 +
* [http://www.audioholics.com/reviews/speakers/satellite/energy-take-classic-review Energy Take 5] Speakers, White
 +
* [http://www.onecall.com/ProductDetails.aspx?id=34129 Panasonic SA-XR57] A/V Receiver
 +
* [http://www.oppodigital.com/dv981hd/dv981hd_index.html Oppo 981HD] DVD/SACD/DVD-A player
 +
 
 +
== Current Housemate Bedroom Equipment ==
 +
* [http://www.logitech.com/remotes/universal-remotes/devices/6621 Logitech Harmony 650] Universal Remote Control
 +
* [http://store.sony.com/webapp/wcs/stores/servlet/ProductDisplay?catalogId=10551&storeId=10151&langId=-1&partNumber=KDL32L4000 Sony KDL32L4000] Sony 32" LCD TV
 +
* [http://www.amazon.com/Denon-AVR-1909-7-1-Channel-Multizone-Receiver/dp/B001BKND5W/ref=cm_cr_pr_product_top Denon AVR-1909] Surround Receiver
 +
* [http://us.playstation.com/ps3/ PlayStation 3]
 +
* [http://www.paradigm.com/ Paradigm] Atom x2, Titan x2, CC-50
 +
 
 +
= Parent's Systems =
 +
I built a home Myth system for my parents, here's what they have.
 +
 
 +
== Combined Backend/Frontend ==
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16813188021 EVGA 112-CK-NF77-A1] - LGA 775 NVIDIA nForce e-7150/630i HDMI Micro ATX Intel Motherboard
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16819116036 Intel Pentium E2160 Allendale 1.8GHz] -  LGA 775 65W Dual-Core Processor Model BX80557E2160 (overclocked to 3.0GHz and counting!)
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16820145034 CORSAIR XMS2 2GB] - DDR2 SDRAM DDR2 800 (PC2 6400) Dual Channel Kit Desktop Memory Model TWIN2X2048-6400C4
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16827151175 SAMSUNG SH-S222A] - DVD Writer
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16814134100 ECS Silent Series NSGT220-1GQS-H GeForce GT 220]
 +
* 3x[http://www.newegg.com/Product/Product.aspx?Item=N82E16822152175 SAMSUNG EcoGreen F2 HD154UI] - 1.5TB 32MB Cache SATA 3.0Gb/s
 +
* 1x[http://www.newegg.com/Product/Product.aspx?Item=N82E16822144186 Maxtor MaXLine III 7L300S0] - 300GB 7200 RPM 16MB Cache SATA 1.5Gb/s
 +
* 2x[http://www.newegg.com/Product/Product.aspx?Item=N82E16815116030 Hauppauge HD PVR] - High Definition Personal Video Recorder 1212
 +
* 1x HDHomeRun with an HDTV Antenna
 +
 
 +
== Kitchen Frontend ==
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16883103297 Acer AspireRevo AR3700-U3002] - Nettop Intel Atom D525(1.80GHz) 2GB DDR3 250GB HDD Capacity NVIDIA ION graphics
 +
 
 +
== Master Bedroom Frontend ==
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16883103228 Acer AspireRevo AR1600-U910H] - Desktop PC Intel Atom 230(1.6GHz) 1GB DDR2 160GB HDD Capacity NVIDIA ION LE
 +
 
 +
== Office Frontend ==
 +
* [https://www.newegg.com/Product/Product.aspx?Item=N82E16856501007 LIVA 32GB 2GB DDR3L RAM installed 32GB eMMC Storage]
 +
 
 +
== Guest Bedroom Frontend ==
 +
* [https://www.newegg.com/Product/Product.aspx?Item=N82E16856501007 LIVA 32GB 2GB DDR3L RAM installed 32GB eMMC Storage]
 +
 
 +
== Spare (Old Personal Bedroom) Frontend ==
 +
 
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16856173001 Zotac MAG HD-ND01] Intel Atom 330 NVIDIA ION
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16822136391 Western Digital Scorpio Blue WD1600BEVT] 160GB 5400 RPM 8MB Cache 2.5" SATA 3.0Gb/s Internal Notebook Hard Drive
 +
* 2GB RAM
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16880121003 AVS Gear GP-IR01BK] Windows Vista Infrared MCE Black Remote Control
 +
 
 +
== Spare (Old Housemate Bedroom) Frontend ==
 +
As used by one of my housemates with his HDTV
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16856119016 Foxconn NT-330I-A-B-NA-A] Intel Atom 330 NVIDIA ION
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16822145255 HITACHI Travelstar 5K500.B] HTS545025B9A300  250GB 5400 RPM 8MB Cache 2.5" SATA 3.0Gb/s Notebook Hard Drive
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16820231155 G.SKILL 2GB] 200-Pin DDR2 SO-DIMM DDR2 800 (PC2 6400) Laptop Memory Model F2-6400CL5S-2GBSQ
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16880121003 AVS Gear GP-IR01BK] Windows Vista Infrared MCE Black Remote Control
 +
 
 +
== Spare (Kitchen) Frontend ==
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16856173005 Zotac ZBOX HD-ID11-U] Intel Atom D510 NM10 NVIDIA ION GPU
 +
* 2GB RAM (from MacBook upgrade)
 +
* 250GB HDD (from MacBook upgrade)
 +
* [http://www.newegg.com/Product/Product.aspx?Item=N82E16880101002 Rosewill Remote Control]
 +
 
 +
= System Customizations =
 +
== Frontend Auto login ==
 +
For those of us that want to run mythfrontend without a window manager, here is the information the dev's don't want you to see:
  
== Current Dedicated Front End ==
+
=== disable window manager ===
 +
From,
 +
http://ubuntuforums.org/showthread.php?p=10798400#post10798400
  
Running 0.20-fixes currently (and the last time I updated this...) fixes-11468?
+
assuming lightdm is being used,
 +
echo "manual" | sudo tee -a /etc/init/lightdm.override
  
* [http://www.newegg.com/Product/Product.asp?Item=N82E16811163052 Silverstone SST-LC16S-M Silver]
+
The splash screen can cause some problems, so I would suggest you to disable it. Edit the /etc/default/grub file and replace the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" with GRUB_CMDLINE_LINUX_DEFAULT="quiet". Then generate a new Grub2 config file,
* [http://www.newegg.com/Product/Product.asp?Item=N82E16813135175 ECS KN1 Extreme Socket 939 NVIDIA nForce4 Ultra ATX AMD Motherboard]
+
sudo update-grub
* [http://www.newegg.com/Product/Product.asp?Item=N82E16819103535 AMD Athlon 64 3200+ 2000MHz HT Socket 939] Winchester Core
 
* [http://www.newegg.com/product/product.asp?item=N82E16817103932 Antec TruePower 2.0 TP2-550 EPS12V 550W Power Supply]
 
* [http://www.newegg.com/Product/Product.asp?Item=N82E16820145450 1024MB Corsair DDR400 RAM]
 
* [http://www.newegg.com/Product/Product.asp?Item=N82E16814127090 MSI NX6200TC-TD128ELF GeForce 6200TC 128MB DDR 64-bit PCI Express x16 Low Profile Video Card] Running the Nvidia 9746 driver with '''Option "UseEvents" "True"''' and Xvideo Vsync enabled in nvidia-settings for awesome 1080p output.
 
* [http://www.newegg.com/product/product.asp?item=N82E16822148013 SEAGATE ST340014A 40GB] system drive
 
* 3x320GB SATA Visual Media (tv rips, HDTV conversions, HDTV movies, funny commercials, etc)
 
* 3x250GB ATA RAID5 array for Music and DVD Rips
 
  
== Current Bedroom Frontend ==
+
 +
=== .xinitrc ===
 +
When X starts it looks to the users home directory for the ''.xinitrc'' file. There are two options at this point for how to use .xinitrc, one will load a window manager, the other will not.
  
Since I stole components from my old desktop to build my dedicated backend/dedicated frontend pairing (and eventually my dedicated frontend), I used some old parts to make this, my bedroom frontend. This machine is usually off, I turn it on to play music or watch tv. Sadly, it doesn't quite have enough oomph to play HD in Myth even with XvMC, its also in a huge case, so I'm looking at getting a cheap miniATX mobo and decent looking miniATX case.
+
==== No Window Manager ====
 +
For no windowmanager, create/edit the user's ''.xinitrc'' and add,
  
* [http://www.ocworkbench.com/2002/ecs/k7s5aguide/ ECS K7S5A]
+
{{Code box|.xinitrc|
* AthlonXP 1600+ (my really really old desktop that was sitting in a box...)
+
<pre>
* [http://www.newegg.com/Product/Product.asp?Item=N82E16814121185 ASUS Geforce FX5200 V9520-X/TD/128 Low Profile]
+
xset -dpms s off
* [http://www.newegg.com/Product/Product.asp?Item=N82E16827131351 Plextor PX-716SA]
+
xsetroot -solid black
* Plextor something or other SCSI CDR...
+
mythfrontend -l /home/mythtv/mythfrontend.log
** Seagate Barracuda 7200 40GB
+
#mythtv-setup
* 160GB ATA random stuff drive (pr0n, etc ;-)
+
#xterm
 +
</pre>
 +
}}
  
 +
This will turn off dpms, turn the X default background color black and log to /home/mythtv/mythfrontend.log. These options can, obviously, all be changed.
  
{{inuse}}
+
Also included is an easy way to access mythtv-setup or xterm, just uncomment the appropriate line and comment out the mythfrontend line.
 +
 
 +
''Note that running mythfrontend without a window manager is not a supported configuration.  You may run into focus problems when trying to press buttons, enter text and generally use the system. These issues have mostly been fixed in the newer versions of MythTV and many users run this method successfully, especially with Mythbuntu''
 +
 
 +
== X11 Remote Keymapping (ie LIRC-less)==
 +
[https://ubuntuforums.org/showthread.php?t=1754719 ir-keytable or: How I Learned to Stop Worrying about the LIRC Kernel]
 +
 
 +
[http://manpages.ubuntu.com/manpages/trusty/man1/ir-keytable.1.html ir-keytable]
 +
 
 +
[http://madaboutbrighton.net/articles/2015/remote-control-media-player-without-lirc-using-ir-keymap Control your media player using your existing remote control]
 +
 
 +
[http://atterer.org/mythtv-xmbc-remote-control-without-lirc MythTV: Use All Buttons of Your Remote Control - Without LIRC]
  
 
= Encoding =
 
= Encoding =
I've become somewhat of a mencoder/BASH scripting guru through my many adventures using it and writing scripts. Hopefully, one day, MythArchive will allow for custom profiles with some of the better options/features of mencoder so that such scripts are no longer needed. But for now here are some of the scripts I've written for encoding...
+
I've become somewhat of a mencoder/BASH scripting guru through my many adventures using it and writing scripts.
  
 
== HR.HDTV script ==
 
== HR.HDTV script ==
Line 73: Line 239:
 
So what this script does is convert any 1080i or 720p recording to "HR.HDTV" which is basically a 960x544 resolution file with the original AC3 soundtrack. It will encode to the CD size standard of putting one hour of tv on a CD (ie 44minutes into 700MB, 22minutes into 350MB). It's also a good start to doing other conversions as the options can easily be changes to do things like encode to x264 at 1280x720(hint hint)...
 
So what this script does is convert any 1080i or 720p recording to "HR.HDTV" which is basically a 960x544 resolution file with the original AC3 soundtrack. It will encode to the CD size standard of putting one hour of tv on a CD (ie 44minutes into 700MB, 22minutes into 350MB). It's also a good start to doing other conversions as the options can easily be changes to do things like encode to x264 at 1280x720(hint hint)...
  
 +
You will need [http://www.kenschutte.com/perlcalc/ PerlCalc] for some math in the script...
 +
<pre>
 +
#!/bin/bash
 +
#
 +
# My script to create hr.hdtv encodes.
 +
#
 +
# This script will perform the following tasks:
 +
# 1. Analyze the original mpeg for
 +
#      a. play length
 +
#      b. audio size
 +
#      c. frame speed (60fps/30fps)
 +
# 2. Calculate final file size (350MB or 700MB)
 +
# 3. Calculate final video size based on final file
 +
#    size and audio size.
 +
# 4. Encode.
 +
#
 +
 +
#variables
 +
overheadbytes=16
 +
server_default=POT
 +
 +
#Functions
 +
#Video Length Calculation
 +
function VideoSizeCalc() {
 +
        audiosize=`pc $audiobitrate/1000*$totalseconds*0.1220703125/1024`
 +
        echo "Audio Size in MB = $audiosize"
 +
#      audiooverhead=`pc $totalseconds*1000/64`
 +
#      videooverhead=`pc 23.976*$totalseconds`
 +
#      totaloverhead=`pc $audiooverhead+$videooverhead`
 +
#      overheadsize=`pc $totaloverhead*$overheadbytes/1024**2`
 +
#      overheadsize=`echo `${overheadsize:0:4}``
 +
#      echo "(DD) Overhead = $overheadsize MB"
 +
        totalseconds=`echo $totalseconds|sed -e 's/\.[0-9]*//'`
 +
#      echo "(DD) Total Seconds = $totalseconds"
 +
        if [ $totalseconds -lt 1800 ]; then
 +
                totalsize=350
 +
        elif [ $totalseconds -lt 3600 ]; then
 +
                totalsize=700
 +
        else
 +
                echo "I don't know how to handle this length!"
 +
                exit 1
 +
        fi
 +
        echo "Total Size = $totalsize"
 +
#      videosize=`pc $totalsize-$overheadsize-$audiosize` #original formula
 +
        videosize=`pc $totalsize-$audiosize`    # new one since overhead doesn't
 +
 +
                                                #really matter its so small
 +
        videosize=`echo `${videosize:0:3}``
 +
        echo "Videosize = $videosize MB"
 +
}
 +
 +
 +
function FolderNameClean() {
 +
        input=$1
 +
        input=`echo "$input" | sed -e 's/.[Aa][Vv][Ii]//'`
 +
        input=`echo "$input".XviD-MythTV`
 +
        folder_name=$input
 +
}
 +
 +
#test for arguements
 +
if [[ -z "@ARGV" ]]; then
 +
        echo "first arguement is the original mpg"
 +
        echo "second arguement is the new folder name, will be used for filename"
 +
        exit
 +
else
 +
        #Reassign variables
 +
        if [[ ! -e $1 ]]; then
 +
                echo "no such input mpg!"
 +
                exit
 +
        else
 +
                original_name=$1
 +
        fi
 +
        folder_name=$2
 +
        FolderNameClean $2
 +
        file_name=`echo "$folder_name" | tr A-Z a-z`
 +
        # display arguments
 +
        echo "Original mpeg is: $original_name"
 +
        echo "Folder name will be: $folder_name"
 +
        echo "File name will be: $file_name"
 +
fi
 +
 +
#Grab input file information
 +
echo "Determining total file length..."
 +
totalseconds=`mencoder $original_name -ovc copy -nosound -o /dev/null -quiet 2>&1 | awk '/^Video stream:/{print $10+$10/$12}'`
 +
echo "total seconds = $totalseconds"
 +
audiobitrate=`mplayer -vo null -ao null -frames 0 -identify "$original_name" 2>/dev/null | grep "ID_AUDIO_BITRATE" | sed -e 's/ID_AUDIO_BITRATE=0//' | grep "ID_AUDIO_BITRATE" | sed -e 's/ID_AUDIO_BITRATE=//'`
 +
echo "audio bitrate = $audiobitrate"
 +
videowidth=`mplayer -vo null -ao null -frames 0 -identify "$original_name" 2>/dev/null | grep "ID_VIDEO_WIDTH" | sed -e 's/ID_VIDEO_WIDTH=//'`
 +
videoheight=`mplayer -vo null -ao null -frames 0 -identify "$original_name" 2>/dev/null | grep "ID_VIDEO_HEIGHT" | sed -e 's/ID_VIDEO_HEIGHT=//'`
 +
videofps=`mplayer -vo null -ao null -frames 0 -identify "$original_name" 2>/dev/null | grep "ID_VIDEO_FPS" | sed -e 's/ID_VIDEO_FPS=//'`
 +
videofps=`echo `${videofps:0:2}``
 +
echo "FPS: $videofps"
 +
aspect=`pc $videowidth/$videoheight`
 +
aspect=`echo "$aspect" | tr -s [:digit:]`
 +
echo "Aspect Ratio: $aspect"
 +
#Calculate Video size
 +
VideoSizeCalc
 +
sleep 10
 +
videosize=`pc $videosize*1024`
 +
echo "Videosize = $videosize"
 +
 +
if [[ -e "$original_name" ]]; then
 +
        echo start `date +%H:%M`>$file_name.runtime
 +
        if [[ "$videofps" -eq "59" ]]; then
 +
                nice -n 17 mencoder $original_name -oac copy -ovc xvid -vf decimate=2:1000:1600:.001,scale=960:544 -ofps 24000/1001 -xvidencopts pass=1:vhq=0:me_quality=5:turbo:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o /dev/null
 +
                #
 +
                nice -n 17 mencoder $original_name -oac copy -ovc xvid -vf decimate=2:1000:1600:.001,scale=960:544 -ofps 24000/1001 -xvidencopts pass=2:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o $file_name.avi
 +
        elif [[ "$videofps" -eq "29" ]]; then
 +
                nice -n 17 mencoder $original_name -oac copy -ovc xvid -vf pullup,softskip,scale=960:544 -ofps 24000/1001 -xvidencopts pass=1:vhq=0:me_quality=5:turbo:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o /dev/null
 +
                #
 +
                nice -n 17 mencoder $original_name -oac copy -ovc xvid -vf pullup,softskip,scale=960:544 -ofps 24000/1001 -xvidencopts pass=2:vhq=0:me_quality=5:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o $file_name.avi
 +
        fi
 +
        echo stop `date +%H:%M`>>$file_name.runtime
 +
        echo "Runtime"
 +
        more $file_name.runtime
 +
fi
 +
exit
 +
</pre>
 +
 +
== NeroAAC in linux ==
 +
'''NOTE:''' ''Nero recently released a version of their encoder that is linux native, but I haven't updated my script for it since I actually rarely use it now, I've been using dbPowerAmp at work...''
 +
 +
Recently [http://www.nero.com Nero] released their wonderful [http://www.nero.com/eng/nero-aac-codec.html AAC encoder] for "DOS" (command line app in windows). Since I'm a huge fan of AAC for compressed audio due to its quality I was hoping they'd release a linux version, but as it turns out their windows version was designed to work a-o-k in linux under [http://winehq.com WINE]!
 +
 +
The only caveats I've found is that you need to have the folder where you music ready for conversion is mapped as a drive in Wine. As well, the filenames cannot have any periods in them except for the one that designates the extension (ie ''this.song.is.good.flac'' is no good but ''this song is good.flac'' is fine), which is an issue I know how to solve with a simple perl rename, but have yet to tackle in the script... Other than that, your good to go.
 +
 +
So what I did, is I wrote a script that will convert any format mplayer supports, as well as APE to M4A. Right now I really only have it setup for WAV, FLAC and APE though, but its pretty easy to add other formats. For mplayer supported formats look at the FLAC functions, for formats that require another decoder to get to WAV look at the APE section. This script can also recursively enter folders, so you can rip a whole lot of CD's (using cdparanoia or [http://www.exactaudiocopy.de/ EAC] under [http://winehq.com WINE] of course!) into seperate folders and run this script from their root and it will go into each folder and convert! how handy!
 +
 +
[http://www.digitalradiotech.co.uk/nero_mpeg4_aac_encoder.htm This] site has some great info on the encoder, as well as how to encode directly to M4A when ripping with EAC.
 +
[http://wiki.hydrogenaudio.org/index.php?title=K3b_and_Nero_AAC_Guide This] is a good guide to do the same in K3B.
  
 +
This script has two command line options as of now. First it will allow you to delete the original after a successful encode using ''-e'', or you can specify a specific directory with ''-d''.
 +
 +
This script also has some defined options near the top,
 +
EncoderDir=~/.wine/drive_c/Program\ Files/Nero
 +
QualityLevel="0.8"
 +
 +
EncoderDir is obviously where your neroAACenc.exe file is, and Quality level is a numerical value for the recording quality setting. I don't like compressed audio and find that 0.8 is a good balance for my ears and my desire to keep file sizes down. This equates to about 300Kbps, which is rather large for even the MP3 format, so feel free to change this value for your needs.
 +
 +
For those that used the old Nero encoder with "Quality Levels", here's a quick conversion chart...
 +
 +
{| border=1 cellspacing=0 cellpadding=5
 +
|  Old Presets
 +
|  Quality Levels
 +
|-
 +
|      Tape
 +
|        -q=0.0
 +
|-
 +
|      Radio
 +
|        -q=0.1
 +
|-
 +
|      Internet
 +
|        -q=0.2
 +
|-
 +
|      Streaming
 +
|        -q=0.3
 +
|-
 +
|      Normal
 +
|        -q=0.5
 +
|-
 +
|      Extreme
 +
|        -q=0.6
 +
|-
 +
|      Audiophile
 +
|        -q=0.8
 +
|-
 +
|      Transcoding
 +
|        -q=1.0
 +
|}
 +
<pre>
 
  #!/bin/bash
 
  #!/bin/bash
 
  #
 
  #
# My script to create hr.hdtv encodes.
 
#
 
# This script will perform the following tasks:
 
# 1. Analyze the original mpeg for
 
#      a. play length
 
#      b. audio size
 
#      c. frame speed (60fps/30fps)
 
# 2. Calculate final file size (350MB or 700MB)
 
# 3. Calculate final video size based on final file
 
#    size and audio size.
 
# 4. Encode.
 
 
  #
 
  #
 +
IFS=$'\n'
 +
EncoderDir=~/.wine/drive_c/Program\ Files/Nero
 +
QualityLevel="0.8"
 +
CURRENTDIR=`pwd`
 +
directory=$CURRENTDIR
 +
 +
function Main() {
 +
 +
        until [ -z "$1" ]
 +
        do
 +
                echo "Processing parameter of: '$1'"
 +
 +
                if [ ${1:0:1} = '-' ]; then
 +
                        tmp=${1:1} # Strip off leading '-' . . .
 +
                        parameter=${tmp%%=*} # Extract name.
 +
                        if [ "$parameter" = "e" ]; then
 +
                                echo "Will erase originals upon successful encode!"
 +
                                opt_e=1
 +
                        fi
 +
                        if [ "$parameter" = "d" ]; then
 +
                                directory=$1
 +
                                echo "Directory taken from command line as: $dir
 +
                                ectory"
 +
                        fi
 +
 +
                fi
 +
 +
        shift
 +
        done
 +
        echo "Working directory: $directory"
 +
 +
for dir in $( find -type d )
 +
do
 +
        cd $dir
 +
        for file in $( find -maxdepth 1 -type f -name '*.flac' -printf '"%f"\n'|
 +
sort )
 +
        do
 +
                echo "FLAC format found! Converting \""$file"\"..."
 +
                rename 's/\.{2,}//' $file
 +
                file=`echo "$file"|sed 's/\.{2,}//'`
 +
                basename=`echo "$file"|sed 's/\..*//'`
 +
                basename=`echo "$basename"|sed 's/\"//'`
 
   
 
   
#variables
+
                RANDOM='time'
overheadbytes=16
+
                TEMPFILE=/dev/shm/neroaac-$RANDOM
server_default=POT
+
                DecodeMplayerSupported $basename.flac $TEMPFILE
 +
                EncodeToAAC $basename $TEMPFILE
 +
                rm -f $TEMPFILE
 +
                RemoveOriginal $basename flac
 +
                ls *flac
 +
        done
 
   
 
   
#Functions
+
         for file in $( find -maxdepth 1 -type f -name '*.wav' -printf '"%f"\n'|sort )
#Video Length Calculation
+
         do
function VideoSizeCalc() {
+
                echo "File "$file" already in Wave format, converting to AAC..."
         audiosize=`pc $audiobitrate/1000*$totalseconds*0.1220703125/1024`
+
                basename=`echo "$file"|sed 's/\..*//'`
         echo "Audio Size in MB = $audiosize"
+
                basename=`echo "$basename"|sed 's/\"//'`
#      audiooverhead=`pc $totalseconds*1000/64`
+
                EncodeToAAC $basename
#      videooverhead=`pc 23.976*$totalseconds`
+
                 RemoveOriginal $basename wav
#      totaloverhead=`pc $audiooverhead+$videooverhead`
+
                 ls *wav
#      overheadsize=`pc $totaloverhead*$overheadbytes/1024**2`
+
         done
#      overheadsize=`echo `${overheadsize:0:4}``
 
#      echo "(DD) Overhead = $overheadsize MB"
 
        totalseconds=`echo $totalseconds|sed -e 's/\.[0-9]*//'`
 
#      echo "(DD) Total Seconds = $totalseconds"
 
        if [ $totalseconds -lt 1800 ]; then
 
                 totalsize=350
 
        elif [ $totalseconds -lt 3600 ]; then
 
                 totalsize=700
 
         else
 
                echo "I don't know how to handle this length!"
 
                exit 1
 
        fi
 
        echo "Total Size = $totalsize"
 
#      videosize=`pc $totalsize-$overheadsize-$audiosize` #original formula
 
        videosize=`pc $totalsize-$audiosize`    # new one since overhead doesn't
 
 
   
 
   
                                                #really matter its so small
+
        for file in $( find -maxdepth 1 -type f -name '*.ape' -printf '"%f"\n'|sort )
         videosize=`echo `${videosize:0:3}``
+
         do
        echo "Videosize = $videosize MB"
+
                echo "APE format found! Converting \""$file"\"..."
 +
                basename=`echo "$file"|sed 's/\..*//'`
 +
                basename=`echo "$basename"|sed 's/\"//'`
 +
                RANDOM='time'
 +
                TEMPFILE=/dev/shm/neroaac-$RANDOM
 +
                DecodeAPE $basename.ape $TEMPFILE
 +
                EncodeToAAC $basename $TEMPFILE
 +
                rm -f $TEMPFILE
 +
                RemoveOriginal $basename ape
 +
                ls *ape
 +
        done
 +
cd $CURRENTDIR
 +
done
 +
        exit 0
 
  }
 
  }
 
   
 
   
 +
function DecodeAPE() {
 +
        inputfile=$1
 +
        outputfile=$2
 +
        nice -n 17 mac $inputfile $outputfile -d
 +
}
 
   
 
   
  function FolderNameClean() {
+
  function DecodeMplayerSupported() {
         input=$1
+
         inputfile=$1
         input=`echo "$input" | sed -e 's/.[Aa][Vv][Ii]//'`
+
         outputfile=$2
         input=`echo "$input".XviD-MythTV`
+
         nice -n 17 mplayer -vc null -vo null -ao pcm:file=$outputfile:fast "$inputfile"
        folder_name=$input
 
 
  }
 
  }
 
   
 
   
  #test for arguements
+
  function EncodeToAAC() {
if [[ -z "@ARGV" ]]; then
+
        filebase="$1"
         echo "first arguement is the original mpg"
+
        infile="$filebase".wav
         echo "second arguement is the new folder name, will be used for filename"
+
        outfile="$filebase".m4a
         exit
+
        if [ "$2" ]; then
else
+
                infile="$2"
         #Reassign variables
+
        fi
         if [[ ! -e $1 ]]; then
+
                 echo "no such input mpg!"
+
         echo "File base: $filebase"
                 exit
+
         echo "TEMPFILE: $2"
 +
         echo "Input File: $infile"
 +
        echo "Output File: $outfile"
 +
         nice -n 17 wine $EncoderDir/neroAacEnc.exe -q $QualityLevel -if "$infile" -of "$outfile"
 +
         if [ $? -eq 0 ]; then
 +
                 echo "Encode Success!"
 +
                 success=1
 +
#              mv tmp.m4a "$outfile"
 
         else
 
         else
                 original_name=$1
+
                 echo "Encode Failed!"
 +
                success=0
 +
#              rm -f "tmp.m4a"
 +
#              rm -f "tmp.m4a"
 
         fi
 
         fi
        folder_name=$2
+
  }
        FolderNameClean $2
 
        file_name=`echo "$folder_name" | tr A-Z a-z`
 
        # display arguments
 
        echo "Original mpeg is: $original_name"
 
        echo "Folder name will be: $folder_name"
 
        echo "File name will be: $file_name"
 
  fi
 
 
   
 
   
  #Grab input file information
+
  function DiscoverFormat {
echo "Determining total file length..."
+
        input=$1
totalseconds=`mencoder $original_name -ovc copy -nosound -o /dev/null -quiet 2>&1 | awk '/^Video stream:/{print $10+$10/$12}'`
 
echo "total seconds = $totalseconds"
 
audiobitrate=`mplayer -vo null -ao null -frames 0 -identify "$original_name" 2>/dev/null | grep "ID_AUDIO_BITRATE" | sed -e 's/ID_AUDIO_BITRATE=//'`
 
echo "audio bitrate = $audiobitrate"
 
videowidth=`mplayer -vo null -ao null -frames 0 -identify "$original_name" 2>/dev/null | grep "ID_VIDEO_WIDTH" | sed -e 's/ID_VIDEO_WIDTH=//'`
 
videoheight=`mplayer -vo null -ao null -frames 0 -identify "$original_name" 2>/dev/null | grep "ID_VIDEO_HEIGHT" | sed -e 's/ID_VIDEO_HEIGHT=//'`
 
videofps=`mplayer -vo null -ao null -frames 0 -identify "$original_name" 2>/dev/null | grep "ID_VIDEO_FPS" | sed -e 's/ID_VIDEO_FPS=//'`
 
videofps=`echo `${videofps:0:2}``
 
echo "FPS: $videofps"
 
aspect=`pc $videowidth/$videoheight`
 
aspect=`echo "$aspect" | tr -s [:digit:]`
 
echo "Aspect Ratio: $aspect"
 
#Calculate Video size
 
VideoSizeCalc
 
sleep 10
 
videosize=`pc $videosize*1024`
 
echo "Videosize = $videosize"
 
 
   
 
   
  if [[ -e "$original_name" ]]; then
+
   
         echo start `date +%H:%M`>$file_name.runtime
+
}
         if [[ "$videofps" -eq "59" ]]; then
+
                 nice -n 17 mencoder $original_name -oac copy -ovc xvid -vf decimate=2:1000:1600:.001,scale=960:544 -ofps 24000/1001 -xvidencopts pass=1:vhq=0:me_quality=5:turbo:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o /dev/null
+
function RemoveOriginal {
                #
+
        origfile=$1
                nice -n 17 mencoder $original_name -oac copy -ovc xvid -vf decimate=2:1000:1600:.001,scale=960:544 -ofps 24000/1001 -xvidencopts pass=2:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o $file_name.avi
+
         extension=$2
        elif [[ "$videofps" -eq "29" ]]; then
+
         if [ $opt_e -eq 1 ]; then
                nice -n 17 mencoder $original_name -oac copy -ovc xvid -vf decimate=2:1000:1600:.001,scale=960:544 -ofps 24000/1001 -xvidencopts pass=1:vhq=0:me_quality=5:turbo:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o /dev/null
+
                 if [ $success -eq 1 ]; then
                 #
+
                        echo "Removing Original file: $origfile.$extension"
                nice -n 17 mencoder $original_name -oac copy -ovc xvid -vf decimate=2:1000:1600:.001,scale=960:544 -ofps 24000/1001 -xvidencopts pass=2:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o $file_name.avi
+
                        rm -f $origfile.$extension
        elif [[ "$videofps" -eq "29" ]]; then
+
                 else
                nice -n 17 mencoder $original_name -oac copy -ovc xvid -vf pullup,softskip,scale=960:544 -ofps 24000/1001 -xvidencopts pass=1:vhq=0:me_quality=5:turbo:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o /dev/null
+
                        echo "Not Removing Original file!"
                #
+
                 fi
                 nice -n 17 mencoder $original_name -oac copy -ovc xvid -vf pullup,softskip,scale=960:544 -ofps 24000/1001 -xvidencopts pass=2:vhq=0:me_quality=5:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o $file_name.avi
 
 
         fi
 
         fi
        echo stop `date +%H:%M`>>$file_name.runtime
+
}
        echo "Runtime"
+
        more $file_name.runtime
+
Main $@
fi
+
</pre>
exit
+
 
 +
=Custom Schedules=
 +
Shouldn't be needed for 0.25 on
 +
==The Daily Show==
 +
<pre>program.title LIKE "%Daily Show%"
 +
AND HOUR(DATE_SUB(program.starttime, INTERVAL 2 HOUR)) > 20
 +
AND WEEKDAY(DATE_SUB(program.starttime, INTERVAL 2 HOUR)) < 4
 +
AND (WEEKDAY(DATE_SUB(program.starttime, INTERVAL 2 HOUR)) = 0
 +
OR program.previouslyshown = 0)</pre>
 +
 
 +
==Colbert Report==
 +
<pre>program.title LIKE "%Colbert Report%"
 +
AND (MINUTE(program.starttime) = 30 OR MINUTE(program.starttime) = 31)
 +
AND HOUR(DATE_SUB(program.starttime, INTERVAL 2 HOUR)) > 20
 +
AND WEEKDAY(DATE_SUB(program.starttime, INTERVAL 2 HOUR)) < 4
 +
AND (WEEKDAY(DATE_SUB(program.starttime, INTERVAL 2 HOUR)) = 0
 +
OR program.previouslyshown = 0)</pre>
  
  
 
[[Category:MythPeople]]
 
[[Category:MythPeople]]
 +
[[Category:User Systems]]

Latest revision as of 02:25, 19 April 2017

Me

My Life

Electric Power Engineer living in Boston, MA

I can be reached for mythtv purposes at adeffs_dot_mythtv_at_gmail_dot_com.

My Myth Contributions

I don't really code, but I try to be active in bug and feature testing.

TVRage.com

This project has been moved to Google Code to make managing it easier.

TVRage.com import perl script for adding archived shows to the MythTV Watch Recordings DB or the MythVideo? database (pre-0.22).

6200changer.sh

I wrote a script for handling my DCT-6200 cable boxes connected via firewire that changes the channel and uses firewire_tester to stabilize the connection before Myth tries to record. This has, over the last two years, allowed me to not fail in recording a single show.

To use, set it up in mythtv-setup as the channel change script. Give it the GUID of the box as shown in mythtv-setup. The script takes two variables, the first being the GUID (which is why you have to specify it) and the second is the channel number (which mythtv automatically feeds it at the end of the command you give it). The script then changes the channel on that GUID and runs firewire_tester. In running firewire_tester it requires that it show the connection is stable twice. If it iterates 10 times it will automatically re-tune the channel, and after 50 attempts total it will send Myth the "failed" result, otherwise it will send Myth the "success" result.

You can change the script to use another channel changer if you require.

#!/bin/bash
#

GUID=`echo "$1"|sed -r "s/[A-Z]+/\L&/g"`
CHANNEL=$2

NODE=`plugreport | grep $GUID | awk '{if (($1 == "Node")  && ($4 == "'"0x$GUID"'
")) print $2}'`
echo "Node: '$NODE'"
echo "Changing to channel $CHANNEL"
6200ch -v -s -g $GUID $CHANNEL
#maybe a pause is needed?
sleep 4

STABILIZE="1"
COUNT=0
TOTALCOUNT=0
STABLECOUNT=0
echo "Stabilizing Firewire Connection!..."
#maybe an initial run followed by a verification run?

#initial run
firewire_tester -B -r2 -n$NODE

#while [ "$STABILIZE" != "Broadcast Fix: Success (already stable)" ]
while [ $STABLECOUNT -lt 2 ]
do
       STABILIZE=`firewire_tester -B -n$NODE|grep "already stable"`
       if [[ "$STABILIZE" != "Broadcast Fix: Success (already stable)" ]]
       then
               echo "Not Stable! Attempt $COUNT"
               ((COUNT+=1))
               ((TOTALCOUNT+=1))
               if [ $TOTALCOUNT -gt 50 ]
               then
                       echo "FAILED to Stabilize!!"
                       exit 1
               fi
               if [ $COUNT -gt 10 ]
               then
                       6200ch -v -s -g $GUID $CHANNEL
                       COUNT=0
                       firewire_tester -B -r2 -n$NODE
               fi
       else
               echo $STABILIZE
               ((STABLECOUNT+=1))
       fi
done
echo "Stable!"
exit 0

My Systems

I've since moved on from MythTV after moving out of the 5br apartment I lived in with housemates and now use a TiVo Roamio.

Dedicated Back End

Fileserver

Theater Room Frontend

Frontend Theater/Stereo Equipment

Old Speakers:

  • Paradigm Reference Studio(v.2) 40's, Studio CC(v.2) and Titan's for surround

Current Personal Bedroom Equipment

Current Housemate Bedroom Equipment

Parent's Systems

I built a home Myth system for my parents, here's what they have.

Combined Backend/Frontend

Kitchen Frontend

Master Bedroom Frontend

Office Frontend

Guest Bedroom Frontend

Spare (Old Personal Bedroom) Frontend

Spare (Old Housemate Bedroom) Frontend

As used by one of my housemates with his HDTV

Spare (Kitchen) Frontend

System Customizations

Frontend Auto login

For those of us that want to run mythfrontend without a window manager, here is the information the dev's don't want you to see:

disable window manager

From, http://ubuntuforums.org/showthread.php?p=10798400#post10798400

assuming lightdm is being used,

echo "manual" | sudo tee -a /etc/init/lightdm.override

The splash screen can cause some problems, so I would suggest you to disable it. Edit the /etc/default/grub file and replace the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" with GRUB_CMDLINE_LINUX_DEFAULT="quiet". Then generate a new Grub2 config file,

sudo update-grub


.xinitrc

When X starts it looks to the users home directory for the .xinitrc file. There are two options at this point for how to use .xinitrc, one will load a window manager, the other will not.

No Window Manager

For no windowmanager, create/edit the user's .xinitrc and add,


Script.png .xinitrc

xset -dpms s off
xsetroot -solid black
mythfrontend -l /home/mythtv/mythfrontend.log
#mythtv-setup
#xterm

This will turn off dpms, turn the X default background color black and log to /home/mythtv/mythfrontend.log. These options can, obviously, all be changed.

Also included is an easy way to access mythtv-setup or xterm, just uncomment the appropriate line and comment out the mythfrontend line.

Note that running mythfrontend without a window manager is not a supported configuration. You may run into focus problems when trying to press buttons, enter text and generally use the system. These issues have mostly been fixed in the newer versions of MythTV and many users run this method successfully, especially with Mythbuntu

X11 Remote Keymapping (ie LIRC-less)

ir-keytable or: How I Learned to Stop Worrying about the LIRC Kernel

ir-keytable

Control your media player using your existing remote control

MythTV: Use All Buttons of Your Remote Control - Without LIRC

Encoding

I've become somewhat of a mencoder/BASH scripting guru through my many adventures using it and writing scripts.

HR.HDTV script

I wrote this script to create my own versions of what "the scene" calls HR.HDTV encodes. These look decent on HDTV's up to about 50". Beyond that I highly recommend using x264 at 720p encodes. It may take a lot more processing to get done, but if your TV is that big you'll thank me for recommending it.

So what this script does is convert any 1080i or 720p recording to "HR.HDTV" which is basically a 960x544 resolution file with the original AC3 soundtrack. It will encode to the CD size standard of putting one hour of tv on a CD (ie 44minutes into 700MB, 22minutes into 350MB). It's also a good start to doing other conversions as the options can easily be changes to do things like encode to x264 at 1280x720(hint hint)...

You will need PerlCalc for some math in the script...

#!/bin/bash
#
# My script to create hr.hdtv encodes.
#
# This script will perform the following tasks:
# 1. Analyze the original mpeg for
#       a. play length
#       b. audio size
#       c. frame speed (60fps/30fps)
# 2. Calculate final file size (350MB or 700MB)
# 3. Calculate final video size based on final file
#    size and audio size.
# 4. Encode.
#

#variables
overheadbytes=16
server_default=POT

#Functions
#Video Length Calculation
function VideoSizeCalc() {
        audiosize=`pc $audiobitrate/1000*$totalseconds*0.1220703125/1024`
        echo "Audio Size in MB = $audiosize"
#       audiooverhead=`pc $totalseconds*1000/64`
#       videooverhead=`pc 23.976*$totalseconds`
#       totaloverhead=`pc $audiooverhead+$videooverhead`
#       overheadsize=`pc $totaloverhead*$overheadbytes/1024**2`
#       overheadsize=`echo `${overheadsize:0:4}``
#       echo "(DD) Overhead = $overheadsize MB"
        totalseconds=`echo $totalseconds|sed -e 's/\.[0-9]*//'`
#       echo "(DD) Total Seconds = $totalseconds"
        if [ $totalseconds -lt 1800 ]; then
                totalsize=350
        elif [ $totalseconds -lt 3600 ]; then
                totalsize=700
        else
                echo "I don't know how to handle this length!"
                exit 1
        fi
        echo "Total Size = $totalsize"
#       videosize=`pc $totalsize-$overheadsize-$audiosize` #original formula
        videosize=`pc $totalsize-$audiosize`    # new one since overhead doesn't

                                                #really matter its so small
        videosize=`echo `${videosize:0:3}``
        echo "Videosize = $videosize MB"
}


function FolderNameClean() {
        input=$1
        input=`echo "$input" | sed -e 's/.[Aa][Vv][Ii]//'`
        input=`echo "$input".XviD-MythTV`
        folder_name=$input
}

#test for arguements
if [[ -z "@ARGV" ]]; then
        echo "first arguement is the original mpg"
        echo "second arguement is the new folder name, will be used for filename"
        exit
else
        #Reassign variables
        if [[ ! -e $1 ]]; then
                echo "no such input mpg!"
                exit
        else
                original_name=$1
        fi
        folder_name=$2
        FolderNameClean $2
        file_name=`echo "$folder_name" | tr A-Z a-z`
        # display arguments
        echo "Original mpeg is: $original_name"
        echo "Folder name will be: $folder_name"
        echo "File name will be: $file_name"
fi

#Grab input file information
echo "Determining total file length..."
totalseconds=`mencoder $original_name -ovc copy -nosound -o /dev/null -quiet 2>&1 | awk '/^Video stream:/{print $10+$10/$12}'`
echo "total seconds = $totalseconds"
audiobitrate=`mplayer -vo null -ao null -frames 0 -identify "$original_name" 2>/dev/null | grep "ID_AUDIO_BITRATE" | sed -e 's/ID_AUDIO_BITRATE=0//' | grep "ID_AUDIO_BITRATE" | sed -e 's/ID_AUDIO_BITRATE=//'`
echo "audio bitrate = $audiobitrate"
videowidth=`mplayer -vo null -ao null -frames 0 -identify "$original_name" 2>/dev/null | grep "ID_VIDEO_WIDTH" | sed -e 's/ID_VIDEO_WIDTH=//'`
videoheight=`mplayer -vo null -ao null -frames 0 -identify "$original_name" 2>/dev/null | grep "ID_VIDEO_HEIGHT" | sed -e 's/ID_VIDEO_HEIGHT=//'`
videofps=`mplayer -vo null -ao null -frames 0 -identify "$original_name" 2>/dev/null | grep "ID_VIDEO_FPS" | sed -e 's/ID_VIDEO_FPS=//'`
videofps=`echo `${videofps:0:2}``
echo "FPS: $videofps"
aspect=`pc $videowidth/$videoheight`
aspect=`echo "$aspect" | tr -s [:digit:]`
echo "Aspect Ratio: $aspect"
#Calculate Video size
VideoSizeCalc
sleep 10
videosize=`pc $videosize*1024`
echo "Videosize = $videosize"

if [[ -e "$original_name" ]]; then
        echo start `date +%H:%M`>$file_name.runtime
        if [[ "$videofps" -eq "59" ]]; then
                nice -n 17 mencoder $original_name -oac copy -ovc xvid -vf decimate=2:1000:1600:.001,scale=960:544 -ofps 24000/1001 -xvidencopts pass=1:vhq=0:me_quality=5:turbo:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o /dev/null
                #
                nice -n 17 mencoder $original_name -oac copy -ovc xvid -vf decimate=2:1000:1600:.001,scale=960:544 -ofps 24000/1001 -xvidencopts pass=2:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o $file_name.avi
        elif [[ "$videofps" -eq "29" ]]; then
                nice -n 17 mencoder $original_name -oac copy -ovc xvid -vf pullup,softskip,scale=960:544 -ofps 24000/1001 -xvidencopts pass=1:vhq=0:me_quality=5:turbo:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o /dev/null
                #
                nice -n 17 mencoder $original_name -oac copy -ovc xvid -vf pullup,softskip,scale=960:544 -ofps 24000/1001 -xvidencopts pass=2:vhq=0:me_quality=5:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o $file_name.avi
        fi
        echo stop `date +%H:%M`>>$file_name.runtime
        echo "Runtime"
        more $file_name.runtime
fi
exit

NeroAAC in linux

NOTE: Nero recently released a version of their encoder that is linux native, but I haven't updated my script for it since I actually rarely use it now, I've been using dbPowerAmp at work...

Recently Nero released their wonderful AAC encoder for "DOS" (command line app in windows). Since I'm a huge fan of AAC for compressed audio due to its quality I was hoping they'd release a linux version, but as it turns out their windows version was designed to work a-o-k in linux under WINE!

The only caveats I've found is that you need to have the folder where you music ready for conversion is mapped as a drive in Wine. As well, the filenames cannot have any periods in them except for the one that designates the extension (ie this.song.is.good.flac is no good but this song is good.flac is fine), which is an issue I know how to solve with a simple perl rename, but have yet to tackle in the script... Other than that, your good to go.

So what I did, is I wrote a script that will convert any format mplayer supports, as well as APE to M4A. Right now I really only have it setup for WAV, FLAC and APE though, but its pretty easy to add other formats. For mplayer supported formats look at the FLAC functions, for formats that require another decoder to get to WAV look at the APE section. This script can also recursively enter folders, so you can rip a whole lot of CD's (using cdparanoia or EAC under WINE of course!) into seperate folders and run this script from their root and it will go into each folder and convert! how handy!

This site has some great info on the encoder, as well as how to encode directly to M4A when ripping with EAC. This is a good guide to do the same in K3B.

This script has two command line options as of now. First it will allow you to delete the original after a successful encode using -e, or you can specify a specific directory with -d.

This script also has some defined options near the top, EncoderDir=~/.wine/drive_c/Program\ Files/Nero QualityLevel="0.8"

EncoderDir is obviously where your neroAACenc.exe file is, and Quality level is a numerical value for the recording quality setting. I don't like compressed audio and find that 0.8 is a good balance for my ears and my desire to keep file sizes down. This equates to about 300Kbps, which is rather large for even the MP3 format, so feel free to change this value for your needs.

For those that used the old Nero encoder with "Quality Levels", here's a quick conversion chart...

Old Presets Quality Levels
Tape -q=0.0
Radio -q=0.1
Internet -q=0.2
Streaming -q=0.3
Normal -q=0.5
Extreme -q=0.6
Audiophile -q=0.8
Transcoding -q=1.0
 #!/bin/bash
 #
 #
 IFS=$'\n'
 EncoderDir=~/.wine/drive_c/Program\ Files/Nero
 QualityLevel="0.8"
 CURRENTDIR=`pwd`
 directory=$CURRENTDIR
 
 function Main() {
 
         until [ -z "$1" ]
         do
                 echo "Processing parameter of: '$1'"
 
                 if [ ${1:0:1} = '-' ]; then
                         tmp=${1:1} # Strip off leading '-' . . .
                         parameter=${tmp%%=*} # Extract name.
                         if [ "$parameter" = "e" ]; then
                                 echo "Will erase originals upon successful encode!"
                                 opt_e=1
                         fi
                         if [ "$parameter" = "d" ]; then
                                 directory=$1
                                 echo "Directory taken from command line as: $dir
                                 ectory"
                         fi
 
                 fi
 
         shift
         done
         echo "Working directory: $directory"
 
 for dir in $( find -type d )
 do
         cd $dir
         for file in $( find -maxdepth 1 -type f -name '*.flac' -printf '"%f"\n'|
 sort )
         do
                 echo "FLAC format found! Converting \""$file"\"..."
                 rename 's/\.{2,}//' $file
                 file=`echo "$file"|sed 's/\.{2,}//'`
                 basename=`echo "$file"|sed 's/\..*//'`
                 basename=`echo "$basename"|sed 's/\"//'`
 
                 RANDOM='time'
                 TEMPFILE=/dev/shm/neroaac-$RANDOM
                 DecodeMplayerSupported $basename.flac $TEMPFILE
                 EncodeToAAC $basename $TEMPFILE
                 rm -f $TEMPFILE
                 RemoveOriginal $basename flac
                 ls *flac
         done
 
         for file in $( find -maxdepth 1 -type f -name '*.wav' -printf '"%f"\n'|sort )
         do
                 echo "File "$file" already in Wave format, converting to AAC..."
                 basename=`echo "$file"|sed 's/\..*//'`
                 basename=`echo "$basename"|sed 's/\"//'`
                 EncodeToAAC $basename
                 RemoveOriginal $basename wav
                 ls *wav
         done
 
         for file in $( find -maxdepth 1 -type f -name '*.ape' -printf '"%f"\n'|sort )
         do
                 echo "APE format found! Converting \""$file"\"..."
                 basename=`echo "$file"|sed 's/\..*//'`
                 basename=`echo "$basename"|sed 's/\"//'`
                 RANDOM='time'
                 TEMPFILE=/dev/shm/neroaac-$RANDOM
                 DecodeAPE $basename.ape $TEMPFILE
                 EncodeToAAC $basename $TEMPFILE
                 rm -f $TEMPFILE
                 RemoveOriginal $basename ape
                 ls *ape
         done
 cd $CURRENTDIR
 done
         exit 0
 }
 
 function DecodeAPE() {
         inputfile=$1
         outputfile=$2
         nice -n 17 mac $inputfile $outputfile -d
 }
 
 function DecodeMplayerSupported() {
         inputfile=$1
         outputfile=$2
         nice -n 17 mplayer -vc null -vo null -ao pcm:file=$outputfile:fast "$inputfile"
 }
 
 function EncodeToAAC() {
         filebase="$1"
         infile="$filebase".wav
         outfile="$filebase".m4a
         if [ "$2" ]; then
                 infile="$2"
         fi
 
         echo "File base: $filebase"
         echo "TEMPFILE: $2"
         echo "Input File: $infile"
         echo "Output File: $outfile"
         nice -n 17 wine $EncoderDir/neroAacEnc.exe -q $QualityLevel -if "$infile" -of "$outfile"
         if [ $? -eq 0 ]; then
                 echo "Encode Success!"
                 success=1
 #               mv tmp.m4a "$outfile"
         else
                 echo "Encode Failed!"
                 success=0
 #               rm -f "tmp.m4a"
 #               rm -f "tmp.m4a"
         fi
 }
 
 function DiscoverFormat {
         input=$1
 
 
 }
 
 function RemoveOriginal {
         origfile=$1
         extension=$2
         if [ $opt_e -eq 1 ]; then
                 if [ $success -eq 1 ]; then
                         echo "Removing Original file: $origfile.$extension"
                         rm -f $origfile.$extension
                 else
                         echo "Not Removing Original file!"
                 fi
         fi
 }
 
 Main $@

Custom Schedules

Shouldn't be needed for 0.25 on

The Daily Show

program.title LIKE "%Daily Show%"
AND HOUR(DATE_SUB(program.starttime, INTERVAL 2 HOUR)) > 20
AND WEEKDAY(DATE_SUB(program.starttime, INTERVAL 2 HOUR)) < 4
AND (WEEKDAY(DATE_SUB(program.starttime, INTERVAL 2 HOUR)) = 0
OR program.previouslyshown = 0)

Colbert Report

program.title LIKE "%Colbert Report%"
AND (MINUTE(program.starttime) = 30 OR MINUTE(program.starttime) = 31)
AND HOUR(DATE_SUB(program.starttime, INTERVAL 2 HOUR)) > 20
AND WEEKDAY(DATE_SUB(program.starttime, INTERVAL 2 HOUR)) < 4
AND (WEEKDAY(DATE_SUB(program.starttime, INTERVAL 2 HOUR)) = 0
OR program.previouslyshown = 0)