Legality of Copying CDs

After posting about using rip to copy audio CDROMs to a computer, it got me thinking. Is it legal to copy audio CDROMs? After all, having rights granted to someone else’s work usually requires a contract. Why are audio CDROMs different? This is is what the RIAA says about copying CDROMs:

Copying CDs

  • It’s okay to copy music onto an analog cassette, but not for commercial purposes.
  • It’s also okay to copy music onto special Audio CD-R’s, mini-discs, and digital tapes (because royalties have been paid on them) – but, again, not for commercial purposes.
  • Beyond that, there’s no legal “right” to copy the copyrighted music on a CD onto a CD-R. However, burning a copy of CD onto a CD-R, or transferring a copy onto your computer hard drive or your portable music player, won’t usually raise concerns so long as:
    • The copy is made from an authorized original CD that you legitimately own
    • The copy is just for your personal use. It’s not a personal use – in fact, it’s illegal – to give away the copy or lend it to others for copying.
  • The owners of copyrighted music have the right to use protection technology to allow or prevent copying.
  • Remember, it’s never okay to sell or make commercial use of a copy that you make.

I like the phrase “won’t usually raise concerns”. It’s my guess a decent IP lawyer could successfully argue that all CDROM copying is illegal. If they are successful, how could the music business make money based on assumed legal actions? Well, Windows Media Player and iTunes know what you have imported from CD. Since copyright lasts so long, I can see a day where if you have X percent of your audio files imported from CDROM, you will get a notice to pay up. Or even better, you could have a surcharge on future purchases until you are deemed paid in full. Why not?

Pressed CDROMs will go away soon. This will benefit the music business in two ways – low cost of distribution (and therefore more profit), and license agreements. Licensing will end this assumed right of ripping audio, while placing controls of what you can and cannot do with music.

Cheapo Discs

What A Music Store Looks Like. Cheapo Discs. Austin TX. 2011.

 

Encoding CDROM Audio

Encoding CDs is dated, but has still has merit, falling into the preservation-of-formats category. The most recent encoded CD in my house was from August, 2009.

Taking a trip down memory lane, re-installing:

rip – A command-line based audio CD track ripper and MP3, FLAC, or Ogg Vorbis encoder

The installation is easy.  Download the latest (today, it is 1.07 – 2003 vintage).  The archive will extract into rip-1.07.

Opinions on how and where to install freeware vary, but for this post, I’ll say I put rip in /applications/rip-1.07/bin.  Rip also include two perl modules to make CDDB and MP3 tagging possible: CDDB_get-1.66.tar.gz and MP3-Info-0.91.tar.gz.  Extracting these two archives, and running the following in their respective directories sets things up properly:

perl Makefile.PL PREFIX=/applications/rip-1.07
make
make install

Once installed, if you set PERL5LIB to /applications/rip-1.07/share/perl5, and add /applications/rip-1.07/bin to your PATH, you are ready to run rip.

My preference is to name MP3 files as [TRACK]_[SONG NAME].mp3 while encoding at 256 Kbps. Therefore, issuing this command completed the deal:

rip -c -b 256 -f “%N_%S”

More rip help:

$ rip -help

USAGE: rip [option(s)] 

OPTIONS:

  -b   --bitrate NUM          set bitrate for encoding to NUM kbps
  -B   --bladeenc             use bladeenc for MP3 encoding
  -c   --cddb                 use CDDB to rename output files (must be online)
  -C   --comment              add your comments to each track via file tagging
  -d   --dev DEV              force input to come from device DEV
  -D   --debug                leave debug info in the file /tmp/rip-stderr
  -e   --eject                eject CD tray after doing everything else
  -f   --format FORMAT        use FORMAT when naming the output file

                                      %A   artist name
                                      %T   title of album
                                      %S   song name
                                      %N   track number

                              example:   rip -f "%A - %T - %N - %S"
                              example:   rip -f "%A_-_%S"

  -F   --flac                 use FLAC for lossless compression
  -g   --generate DIR/NAME    playlist NAME created in DIR (DIR may be omitted)
  -G   --gogo                 use GOGO for MP3 encoding
  -h   --help                 print this help to the screen
  -l   --lazy                 uses -t, -c, -g, -b/q, -m, and -e implicitly,
                              creates a playlist in $PWD in a common format,
                              moves output audio files to $PWD/ArtistName/
  -L   --lame                 use LAME for MP3 encoding
  -m   --move DIR             place all of the ripped/encoded tracks in DIR
  -M   --many                 rip many CDs one after the other (loop thru script)
  -n   --nounderscore         do NOT use an underscore '_' in filenames
  -N   --notlame              use notlame for MP3 encoding
  -O   --oggenc               use oggenc and encode to Ogg Vorbis files
  -p   --paranoia             use 160 kbps and do not accept skips on rip
  -P   --play                 play finished files in XMMS during rip
  -q   --quality NUM          use variable bitrate encoding with quality NUM
                              only works when LAME or oggenc is the encoder
                              see that encoder's documentation when choosing NUM
  -Q   --quiet                rip and encode tracks without any visible output
  -r   --rename               ask for proper name of all tracks before ripping
  -s   --speed NUM            force CD-ROM device to read at speed NUM
  -S   --superlazy            same functionality as -l/--lazy except that all
                              output is to $PWD/ArtistName/AlbumTitle/ instead
  -t   --trayclose            close CD tray before doing anything else
  -T   --tag                  tag the output file with artist/song/album info
  -v   --verbose              print lots of info about what script is doing
  -V   --version              print rip's version information
  -w   --wav                  rip CD tracks to WAV files and no further
  -Y   --cdparanoia           rip CDs using cdparanoia (this is the default)
  -Z   --cdda2wav             rip CDs using cdda2wav instead of cdparanoia

EXAMPLES:

  rip 1 3-5 7 9-11 12 14      rip tracks 1 3 4 5 7 9 10 11 12 and 14 to MP3
  rip 6                       rip track 6 to MP3 using default encoder
  rip -c 6                    rip track 6 and rename its MP3 file via CDDB
  rip -c -d /dev/dvd 6        rip using /dev/dvd as the input device
  rip -c -m ~/mp3 6           simliar: moves output MP3 files to dir ~/mp3

NORMAL USAGE:

  rip -P                      rip entire CD to MP3 and play tracks as we go
  rip -Pet                    similar: also closes and ejects CD tray
  rip -S                      laziness at its best IMHO (must be online)
  rip -S 1 3-5 7 12           superlazy rip specific tracks
  rip -TOPS                   similar: also tags, uses oggenc, and plays

  If you do not specify which track numbers to rip, then all tracks are ripped.
  You may now specify a subset of tracks to rip during a lazy rip

  The default output directory is the Present Working Directory ($PWD).
  Use -m/--move to alter/change the $PWD to a different directory, DIR.
  If the DIR you give -m/--move doesn't exists, rip will create it for you.

  If no specific encoder is flagged, rip uses the first encoder it finds.
  Encoders are searched in this order: gogo, lame, bladeenc, oggenc, flac, notlame.

                     http://rip.sourceforge.net

  Copyright (C) 2003 by Gregory J. Smethells and licensed under the GPL

If you prefer loss-less audio files, then you should encode to FLAC, not MP3:

rip -c -F -f “%N_%S”

Cryptsetup and LUKS

Ever have a hard drive go bad, yet hesitate to RMA it? That’s understandable. Who knows what people on the other end will do, once it is repaired. Once simple solution is to encrypt the contents of the hard disk. This is made easy using cryptsetup.

For example, I just plugged in a 1TB external USB drive. Looking at my dmesg output, I see it is /dev/sde.

# dmesg
...
[710452.205068] sd 9:0:0:0: Attached scsi generic sg4 type 0
[710452.206899] sd 9:0:0:0: [sde] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)
[710452.208131] sd 9:0:0:0: [sde] Write Protect is off
[710452.208361] sd 9:0:0:0: [sde] Mode Sense: 00 38 00 00
[710452.208364] sd 9:0:0:0: [sde] Assuming drive cache: write through
[710452.210121] sd 9:0:0:0: [sde] Assuming drive cache: write through
[710452.226260]  sde:
[710452.228245] sd 9:0:0:0: [sde] Assuming drive cache: write through
[710452.228472] sd 9:0:0:0: [sde] Attached SCSI disk

To install encryption, I use the cryptsetup command:

# cryptsetup --verbose --verify-passphrase luksFormat /dev/sde
WARNING!
========
This will overwrite data on /dev/sde irrevocably.

Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase: 
Verify passphrase: 
Command successful.

Now, I need to install assign a device to the encrypted device:

# cryptsetup luksOpen /dev/sde BACKUP
Enter passphrase for /dev/sde:

Finally, I’ll make a filesystem on it and mount it:

# mke2fs -j -m 0 -L BACKUP /dev/mapper/BACKUP
mke2fs 1.41.12 (17-May-2010)
Filesystem label=BACKUP
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
61054976 inodes, 244190134 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
7453 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
	102400000, 214990848

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
# mount /dev/mapper/BACKUP /mnt
# df -k /mnt
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/BACKUP   961432608    204568 961228040   1% /mnt

Being able to unplug this USB drives means I need to issue the following:

# umount /mnt
# cryptsetup luksClose /dev/mapper/BACKUP

There are many nice features in cryptsetup. One is that you can have multiple passwords.
To add a pass phrase to my USB drive I first have to authenticate using an original pass phrase, then I can add a new one:

# cryptsetup luksAddKey /dev/sde 
Enter any passphrase: 
Enter new passphrase for key slot: 
Verify passphrase: 

http://code.google.com/p/cryptsetup/

The Marginalization of Adobe Flash

If you remember, it was not that long ago that Steve Jobs categorically rejected Adobe Flash on the iDevice platform. Instead of Flash, Apple promoted H.264 for video. At the time, that seemed like a crazy idea. Adobe Flash has enjoyed great success, and it seemed short sighted to lock out Flash on any platform. Android phones, when they were first introduced, touted as being Flash enabled, while iDevices were not.

How a couple of years can make a difference. HTML 5 is now a part of most web browsers, and in that is the <video> tag. Web browsers now have native video playback capabilities. The clear winner is H.264, having support in Internet Explorer, Safari, and Chrome. The free and open standard WebM comes in second, supported by Firefox and Chrome.

I have used FlowPlayer in the past, but now it is obsolete. Instead of placing a Flash player on a web site, you can now simply use HTML to provide video. It is as simple as this:

<video width="480" height="270" controls="controls">
  <source src="http://example.com/video.webm" type="video/webm" />
  <source src="http://example.com/video.mp4" type="video/mp4" />
  Your browser does not support the video tag.
</video>

If your browser desires to download the content instead of playing it, you may need to update a server directive. Consider this .htaccess file:

AddType video/webm .webm 

What is particularly powerful about the <video> tag is that you can specify multiple sources. If a browser does not support a source format, it tries the next.

UPDATE – 20120222 – From the category of not surprising:

For Flash Player releases after 11.2, the Flash Player browser plug-in for Linux will only be available via the “Pepper” API as part of the Google Chrome browser distribution and will no longer be available as a direct download from Adobe. Adobe will continue to provide security updates to non-Pepper distributions of Flash Player 11.2 on Linux for five years from its release.

Adobe Flash Roadmap (URL)

Roadmap PDF

MythTV, UPnP, and CentOS 6

MythTV is certainly one of the outstanding open source projects available. From MythTV.org:

MythTV is a Free Open Source software digital video recorder (DVR) project distributed under the terms of the GNU GPL. It has been under heavy development since 2002, and now contains most features one would expect from a good DVR (and many new ones that you soon won’t be able to live without).

It is a little tricky to get going, but once you do, you will have both a fantastic and heartbreaking experience with Linux and multimedia. In this space, you will learn why free and open source software is so important, along with what barriers have been put in place to inhibit it.

One exciting aspect about MythTV is its UPnP functionality. I have a Bluray player that understands this protocol, so out of the box, it had instant access to my 0.21 version of MythTV content. This is why open standards are nice!

CentOS 6 ships with QT 4.6.2, but without QtWebKit. A quick search reveals that you can install it via the Extra Packages for Enterprise Linux (or EPEL) repo from Fedora. I tend to shy away from installing random packages from random people, so the first step will be to compile a different version of QT. I started with 4.7.4 from Nokia’s FTP server. The options are pretty simple for the configure script:

sh ./configure                                                          
                --prefix=${PREFIX}                                      
                --libdir=${PREFIX}/lib64

gmake clean
gmake install

Your choice of ${PREFIX} is up to you. Now QT 4.7.4 is installed in ${PREFIX}, with the libraries in ${PREFIX}/lib64. After extracting the MythTV source file, I made the following addition to the settings.pro file:

147a148,149
> EXTRALIBS += -L${PREFIX}/lib64
> 
156a159
> 

I fed the following options to the configure script:


PATH=${PREFIX}/bin:$PATH
export PATH

sh ./configure                                                          
                --prefix=${PREFIX}                                      
                --libdir-name=lib64                                     
                --extra-cflags="$CPPFLAGS"                              
                --extra-cxxflags="$CPPFLAGS"                            
                --extra-ldflags="$LDFLAGS"                              
                --enable-libgsm                                         
                --enable-libmp3lame                                     
                --enable-libvorbis                                      
                --enable-libtheora                                      

Notice I have enabled Ogg Vorbis, Theora, and GSM. These libraries are required if you want to be able to play those media types. The libraries are stuffed in the -L${PREFIX}/lib64 area mentioned above.

After extracting the plugins source file, I made the following addition to the settings.pro file:

63,65c63
< EXTRALIBS += -L${PREFIX}/lib64
< 
< EXTRA_LIBS += -lfreetype -lmp3lame $$EXTRALIBS
---
> EXTRA_LIBS += -lfreetype -lmp3lame

To build and install the plugins, I ran the above configure script without the –enable lines. After the build is complete, all I have to do is add ${PREFIX}/bin to my PATH, along with ${PREFIX}/lib64 to my LD_LIBRARY_PATH. I normally set the runtime library search path to point to ${PREFIX}/lib64 so LD_LIBRARY_PATH is not needed, but somewhere the LDFLAGS variable gets lost in the qmake build.

After upgrading my 0.21 MythTV MySQL database to the 0.24 MythTV Schema (and thus starting the backend), the mythfrontend can now invoke:

MythTV 0.24.1 Initial Screen

MythTV is one of the many successes of Open Source software!

Build Your Own HD Antenna

Many thanks goes to the uhfhdtvantenna blog at blogspot.com. I was able to construct an antenna that now provides stutter and artifact free HDTV reception. It cost about $20 to make. If you go to a box store to buy your materials, make sure you check out the remnant area.

HDTV Antenna - Installed in Attic

Using a HDTV tower locater from http://tvfool.com I was able to ascertain which direction had the best transmitters.

Executable Hijinks

In prepping some RHEL 5.5 laptops, I noticed something odd. Very odd. I had made some changes to a base system and did an rsync -av -n from the base system to a pristine source installation to see what had changed. I was expecting to see differences configuration files in /etc, /root, perhaps /var. Nothing prepared me for this:

# ls -al base/bin/bash pristine-source/bin/bash
-rwxr-xr-x 1 root root 801512 Oct 21  2008 base/bin/bash
-rwxr-xr-x 1 root root 768664 Oct 21  2008 pristine-source/bin/bash

Whoa! My base system’s bash shell increased in size. When this happens, it is paramount to determine why. The repercussions are significant.

The first place to look is to see if what RPM installs the executable.

# chroot /mnt/pristine-source rpm -q -f /bin/bash
bash-3.2-24.el5
# chroot /mnt/base rpm -q -f /bin/bash
bash-3.2-24.el5

Strike one. I should probably post the md5sums here:

# md5sum /mnt/pristine-source/bin/bash /mnt/base/bin/bash
dbb9e394d5e2017fb460c4f7d8618f59  /mnt/pristine-source/bin/bash
ecb556dec39092617bbbe8fbef06e381  /mnt/base/bin/bash

Perhaps there is a different RPM installed?

# chroot /mnt/base rpm -q -a > /tmp/base.rpms
# chroot /mnt/pristine-source rpm -q -a > /tmp/pristine-source.rpms
# diff /tmp/pristine-source.rpms /tmp/base.rpms
#

Strike two. I just queried both installations, and they have the exact same RPMs installed. Taking a look at shared libraries required to run bash:

# ldd -v /mnt/pristine-source/bin/bash /mnt/base/bin/bash
/mnt/pristine-source/bin/bash:
	libtermcap.so.2 => /lib64/libtermcap.so.2 (0x00002b0e241c1000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00002b0e243c4000)
	libc.so.6 => /lib64/libc.so.6 (0x00002b0e245c8000)
	/lib64/ld-linux-x86-64.so.2 (0x00002b0e23fa4000)

	Version information:
	/mnt/pristine-source/bin/bash:
		libdl.so.2 (GLIBC_2.2.5) => /lib64/libdl.so.2
		libc.so.6 (GLIBC_2.4) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.3.4) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
	/lib64/libtermcap.so.2:
		libc.so.6 (GLIBC_2.4) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.3.4) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
	/lib64/libdl.so.2:
		ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
		libc.so.6 (GLIBC_PRIVATE) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
	/lib64/libc.so.6:
		ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
		ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
/mnt/base/bin/bash:
	libtermcap.so.2 => /lib64/libtermcap.so.2 (0x00002ab1f0ec8000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00002ab1f10cb000)
	libc.so.6 => /lib64/libc.so.6 (0x00002ab1f12cf000)
	/lib64/ld-linux-x86-64.so.2 (0x00002ab1f0cab000)

	Version information:
	/mnt/base/bin/bash:
		libdl.so.2 (GLIBC_2.2.5) => /lib64/libdl.so.2
		libc.so.6 (GLIBC_2.4) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.3.4) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
	/lib64/libtermcap.so.2:
		libc.so.6 (GLIBC_2.4) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.3.4) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
	/lib64/libdl.so.2:
		ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
		libc.so.6 (GLIBC_PRIVATE) => /lib64/libc.so.6
		libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
	/lib64/libc.so.6:
		ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
		ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2

I am picking on bash, but you’ll see how systemic this problem is:

ls -alL /mnt/pristine-source/lib/libc.so.6 /mnt/base/lib/libc.so.6 
-rwxr-xr-x 1 root root 1611564 Mar 10  2010 /mnt/base/lib/libc.so.6
-rwxr-xr-x 1 root root 1608148 Mar 10  2010 /mnt/pristine-source/lib/libc.so.6

Right. Strike 3. All programs use the shared C library.

Here is the bash file, stored with xz and base64. This format prevents accidentally running the suspect shell.

Linux Serves Up Apple Time Machine

Upon the most undignified death of our Macbook Pro 2.2, we have since acquired a new Macbook, running Lion. Not surprisingly, my Linux based AFP server needed an update.

Code:

Netatalk 2.2.1, from http://netatalk.sourceforge.net/.
Berkeley DB 4.8.30, from http://www.oracle.com/technetwork/database/berkeleydb/downloads/index-082944.html

After installing the code, I took the netatalk-2.2.1/distrib/initscripts/rc.atalk.redhat-sysv.tmpl file and used that to install netatalk at boot time.

My AppleVolumes.default file contains these lines:

:DEFAULT: options:upriv,usedots
/data/backups Backups allow:me,root options:usedots,upriv,tm

Make sure you have a /etc/pam.d/netatalk file:

#%PAM-1.0
auth       required     pam_unix.so
account    required     pam_unix.so
#password   required    pam_cracklib.so
#password   required    pam_unix.so use_authtok
session    required     pam_unix.so

Using Finder, I can Go -> Connect to Server, and put in afp://server. You will need to authenticate to the server. This brings up a dialog that presents a selection of “Backups”. Going to System Preferences -> Time Machine, you can now select Backups as a backup disk. Time machine will create a sparsebundle file for you, and you are finished! I might suggest you wire up your Apple to the network for the first backup.

Links:

http://www.trollop.org/2011/07/23/os-x-10-7-lion-time-machine-netatalk-2-2/