John Goerzen: How To Record High-Definition MythTV Files to DVD or Blu-Ray
I ve long had a problem. Back on January 20, I took the day off work to watch the inauguration of Barack Obama. I saved the HD video recordings MythTV made of the day (off the ATSC broadcast), intending to eventually save them somehow. I hadn t quite figured out how until recently, so there they sat: 9 hours of video taking up about 60GB of space on my disk.
MythTV includes a program called mytharchive that will helpfully transcode your files and burn a DVD from them. But it helpfully will transcode the beautiful 1920 1080i down to DVD resolution of on a good day 720 480. I couldn t have that.
Background
My playback devices might be a PC, the MythTV, or the PlayStation 3. Of these, I figured the PS3 was going to be hardest to accommodate.
ATSC (HD) broadcasts in the United States are an MPEG Transport Stream (TS). Things are a bit complicated, because there may be errors in the TS due to reception problems, the resolution and aspect ratio may change multiple times (for instance, down to SD for certain commercials). And, I learned that some ATSC broadcasts are actually 1920 1088 because the vertical resolution has to be a multiple of a certain number, and those bottom 8 pixels shouldn t be displayed.
Adding to the complexity, one file was 7 hours of video and about 50GB itself. I was going to have to do quite some splitting to get it onto 4.7GB DVD+Rs. I also didn t want to re-encode any video, both for quality and for time reasons.
Attempts
So, I set out to try and figure out how to do this. My first approach was the sledgehammer one: split(1). split takes a large file and splits it on byte or line boundaries. It has no knowledge of MPEG files, so it may split them in the middle of frames. I figured that, worst case, I could always use cat to reassemble the file later.
Surprisingly, both mplayer and xine could play back any of these files, but the PS3 would only play back the first part. I remembered this as an option if all else failed.
Next, I tried avidemux. Quite the capable program and I thought I could use it to cut my file into DVD-sized bits. But I couldn t get it to let me copy the valid MPEG TS into another MPEG TS it kept complaining of incompatible formats, but wouldn t tell me in what way they were incompatible. I could get it to transcode to MPEG4, and produce a result that worked on the PS3, but that wasn t really what I was after.
Then, I tried mpgsplit. Didn t recognize the MPEG TS as a valid file, and even when I used a different tool to convert to MPEG PS, acted all suspicious as if it bought the MPEG from a shady character on a grungy street corner.
dvbcut
I eventually wound up using dvbcut to split up the ATSC (DVB) recordings. It understood the files natively and did exactly what I wanted. Well, *almost* exactly what I wanted. It has no command-line interface and didn t have a way to split by filesize, but I calculated that about 35 minutes of the NBC broadcast and 56 minutes of the PBS broadcast could fit on a single DVD+R.
It worked very, very nicely. The resulting files tested out well on both the PS3 and the Linux box.
So after that, I wrote up an index.txt file to add to each disc and a little shell scripting later and I had a directory for each disc. I started burning them with growisofs. Discs 1 and 2 burned well, but then I got an error like this:
File disc06/VIDEO/0930-inaug-ksnw-06.mpg is larger than 4GiB-1.
-allow-limited-size was not specified. There is no way do represent this file size. Aborting.
Eeeeepp. So apparently the ISO 9660 filesystem can t represent files bigger than 4GB. My files on disc 1 had represented multiple different programs, and stayed under that limit; and disc 2 s file was surprisingly just a few KB short. But the rest of them weren t. I didn t want to have to go back and re-split the data to be under 4GB. I also didn t want to waste 700MB per disc, or to have to make someone change video files every 15 minutes.
So I decided to investigate UDF, the filesystem behind Blu-Ray discs. mkisofs couldn t make a pure UDF, only a hybrid 9660/UDF disc that risked compatibility issues with big files. There is a mkudffs, but it doesn t take a directory of its own. So I wrote a script to do it. Note that this script may fail with dotfiles or files with spaces in them:
#!/bin/bash set -e if [ ! -d "$1" -o -e "$2" -o -z "$2" ]; then echo "Syntax: $0 srcdir destimage [volid]" echo "destimage must not exist" exit 5 fi if [ " id -u " != "0" ]; then echo "This program must run as root." fi EXTRAARGS="" if [ ! -z "$3" ]; then EXTRAARGS="--vid=$3" fi # Get capacities at http://en.wikipedia.org/wiki/DVD+R as of 9/27/2009 SECSIZE=2048 # I'm going to set it a few lower, than capacity 2295104 just in case. # Must be at least one lower than the actual size for dd to do its thing. # SECTORS=2295103 SECTORS=2295000 echo "Allocating image..." dd if=/dev/zero "of=$2" bs=2048 "seek=$SECTORS" count=1 echo "Creating filesystem..." mkudffs --blocksize=2048 $EXTRAARGS "$2" mkdir "$2.mnt" echo "Populating..." mount -o rw,loop -t udf "$2" "$2.mnt" cp -rvi "$1/"* "$2.mnt/" echo "Unounting..." umount "$2.mnt" rmdir "$2.mnt" echo "Done."That was loosely based on a script I found on the Arch Linux site. But I didn t like the original script, because it tried to do too much, wasted tons of time writing out 4.7GB of NULLs when it could have created a sparse file in an instant, and was interactive. So there you have it. HD broadcast to playable on PS3, losslessly. Note that this info will also work equally well if you have a Bluray drive.
Sometimes I really, really hate London. A trip to London on Saturday,
in theory: Leave Ely 16:26, arrive Kings Cross 17:34, change to Piccadilly
line and arrive Covent Garden at 17:54. Dinner then the 21:52 train back
home, arriving 23:10.
A trip to London on Saturday, in practise. Leave Ely 16:26, arrive Kings
Cross 10 minutes late. Change to Piccadilly line and stand outside the closed
barriers for 15 minutes because of overcrowding. Give up on the tube, catch a
number 59 bus to Aldwych: 10 minutes to reach Euston (faster to walk) and gave
up after sitting in gridlock on Russel Square for 15 minutes. Eventually get
rather empty Piccadilly line from Russel Square to Covent Garden, arriving
18:50. Oh, and then
I wrote in 
This coming Sunday, Germany is voting its parliament for the
next four years. I wanted to participate remotely, but they didn t
let me. The letter, inviting me to order the voting forms, was sent
too late. Instead of ordering and waiting for the voting forms,
hoping for them to arrive back in Germany before the municipal
agency stops all their work at 16:59 on Friday afternoon, I filled
in the fields in a way to give my mother full authority to submit
my vote. On the document, it only said that she would need a notary
procuration, which she has.
When my mother tried to vote in my name, they refused her: the
vote has to be confidential, and proxies may only vote for disabled
people, or those who cannot read. I can understand half of the
motivation behind this it guards against abuse but the bottom
line is that I am now unable to cast a vote. Democracy stabbed by
bureaucracy.
Well, democracy to the limited degree that we have it in
Germany. I do not mean to criticise at this time that voting in
Germany means to place trust into people you d rather not trust,
but once they get majority, they can do whatever they want for four
years. The specific shortcoming in our democracy on which I would
like to focus is the five percent clause , which states that a
party needs to reach 5% of votes before they can enter the
parliament; if those 5% are not reached, all votes for the party
are basically lost.
I suspect that this clause is what s keeping back a lot of
people from electing Germany s 
I ve seen a couple of the conversation-spams described in 
I was pointed to this Toast to Turing, by
this weekend while giving a bit of TLC to the php packages, i
thought i'd finally get around to tackling
So, anyone watching the show was actually pretty much told (although indirectly) how it was done.
(Potential spoilers see full post for my take)
Ok, the image with the flashing and the stuff, pretty noticable. From what I know of the subject, it was meant to be. What noone seems to have mentioned was the fact that as it flashed, there was a brief tone.
I believe that the image wasn t meant to actually be subliminal as he mentioned, subliminal images are invisible . It was meant to be noticed, but only to assosciate the tone with the image.
I also feel that the video did play a part. From what I can tell, an image (or text) was over/underlayed over the image of the rotating (fuzzy) lines, but had a very high transparency. This meant, that like the UV pen, you couldn t pick up the image conciously, but you could unconciously. (UV pens leave a small residue behind that makes visible light reflect slightly differently. Try it, get a UV pen and write on a shiny surface. (like the back of a playing card). Looking head on at it, you don t notice, but if you tilt the card, you can see the writing at some angles the mind subconciously picks this up).
Tie this in with things like the wording used before the video, the trailers, and hidden wording/images throughout the show, and you have your whole thing. No sublimilal messages were used, but there were many uses of whatever that term that he used was (SVP?)
Writing a network configuration tool is... fun.
Well, mostly anyway.
Now there is yet another package with a weird name in Debian - douf00 - a lightweight, slim and straight forward presentation tool. Written by some guys from a 