Skip to topic | Skip to bottom
Home
Main
Main.DigitalTelevisionAtscapr1.23 - 03 Feb 2008 - 06:09 - PeterKnaggstopic end

Start of topic | Skip to actions

Update: Inkling's atscap project has been cancelled, as of January 2008.

The atscap project has been cancelled as of January 2008, and this notice was posted by its author (Inkling).

Please contact the author (Inkling) directly, regarding any concerns you may have with the notice.

Please refer to the GPL license explanations on the FSF website, especially this page. Some discussion of the notice can be found here and here.

Inkling's atscap

If you've been looking for a user-friendly tool to schedule HDTV recordings on Linux, Inkling's atscap (now a SourceForge.net project) is what you've been waiting for. See here to download the release candidate. The previous release of atscap was called pchdtvr, but the new name atscap is used because it works on any ATSC capture cards that support the DVB api (e.g. the AirStar HD5000 PCI and DVICO Fusion cards), as well as the cards from pcHDTV.

It has both a web interface as well as a console interface. The web interface is an integral part of atscap, and doesn't require any web server to be installed: atscap is itself the web server. It serves not only the program guides, but also the video that it has recorded for you. The web interface also conveniently provides little square charts showing the signal strength of each of your stations.

Web interface to atscap

Here's a screen shot of the console interface to atscap, showing the program guide received from off-the-air. The console interface packs a lot of information, so it can take some getting used to, but it's very versatile.

Program guide in atscap

Because full ATSC streams eat up large amounts of disk space, atscap automatically selects the proper program stream to record. Program streams are called Virtual Channels in the ATSC spec.


Editing your recordings: xtscut

Bundled with atscap is a graphical tool called xtscut which makes it really simple and speedy to cut out commercials and other junk from your recordings, to save space and make them more convenient for later viewing. You can invoke it from the web interface by clicking on the happy-face icon, once you've followed the instructions in the WEB BROWSER CONFIGURATION section of man atscap. You can also invoke it directly from the command line, giving it the name of the .ts file as a parameter. Remember to add the -1 parameter if you want to write out your cuts as separate files.

Use the "scrolly wheel" (if your mouse has one) or use the u and i keys, and click with the left mouse button to select the "cut points". Once you're happy with your selections, pressing e will write out all the "even" segments. See man xtscut in the KEYS --- FUNCTIONS section, for more on the keys to use to get around, and the MORE KEYS section for other ways to write out the segments you've selected.

On Ubuntu 7.04 Feisty Fawn xtscut needs XLIB_SKIP_ARGB_VISUALS to be set to 1 in its environment before invoking it (see this bug for details), like this:

XLIB_SKIP_ARGB_VISUALS=1 xtscut filename.ts

ATSC Transport Stream Container UTility: atscut

Also bundled with atscap is the command line tool atscut, which can be used for things that would be harder to describe in a graphical user interface, like extracting a single virtual channel from a full stream capture and for other kinds of editing, as well as for very detailed inspection of the stream contents in human-readable form.


Using atscap with GNU screen

With atscap, you can enable the use of GNU screen using the -W option, so that when you run atscap on the console you'll still be able to view it and control it from within X11 without worrying about X11 crashing and messing up your recording session. Even if X11 should happen to crash, the screen session will still be running completely unaffected and you'll be able to re-attach to it and resume control using atscap with the -R option. It also allows you to conveniently control atscap remotely over ssh.


Running atscap from a "Live CD"

Running atscap from a "Live CD" may be useful, if for example you want to demo atscap or to provide a reproducable testcase environment. Here, we'll use the Ubuntu Dapper Drake 6.06.1 (LTS) desktop live CD. Burn it to a 700MB CD-R or CD-RW, and boot it up. Once the desktop appears, open up a terminal window and right-click on the desktop. Select the Create Launcher menu item, and fill in the word xterm into all of the boxes and click OK. Then double-click on the new blue xterm cog-wheels icon to launch a terminal. Type the following commands:
  sudo bash

  # First, install the firmware
  wget http://www.pchdtv.com/downloads/firmware.tar.gz
  tar zxvf firmware.tar.gz
  cp firmware/dvb-fe-or51132-vsb.fw /lib/firmware/
  cp firmware/dvb-fe-or51132-qam.fw /lib/firmware/
  invoke-rc.d udev restart

  # Load the kernel module for your pcHDTV HD-3000 card
  modprobe -rv cx88_blackbird
  modprobe -rv cx88-dvb
  modprobe -rv cx8800
  modprobe -v cx88-dvb
  
  # Install some packages needed for atscap to build
  echo "deb http://archive.ubuntu.com/ubuntu dapper universe" >> /etc/apt/sources.list
  apt-get update
  apt-get -y install gcc make libmpeg2-4-dev imlib11-dev freeglut3-dev libimlib2-dev libxv-dev

To perform any captures, you'll of course need to provide somewhere to store them. As you're running from the live CD, there wouldn't be any space unless you mount a filesystem. Let's say you've mounted a filesystem at the mount point /windows/C. For atscap to find the space, the most convenient way is to make a symbolic link to it with the name /dtv.

  # Create a symbolic link in the / directory with the name dtv, pointing to somewhere you have space:
  ln -s /windows/C /dtv

Now that everything is in place, download atscap as usual, and build and install it, e.g.:

  # Download atscap and build it
  tar zxvf atscap-1.1rc9u.tar.gz
  cd atscap-1.1rc9u
  make
  make install
  

Before launching atscap, set the xterm window to use reverse video, by holding down Ctrl and middle-clicking on the xterm window. Using reverse-video makes the atscap ncurses interface much easier to read.

  # Create some directories needed by at runtime by atscap
  mkdir /var/run/atscap      # location of the file containing the process id of the running atscap instance
  mkdir /etc/atscap          # location of atscap's configuration file

  # Set the system time, based on an internet NTP server's time.
  ntpdate ntp.ubuntu.com

  # Set your timezone, e.g. if you're in California, use  TZ='PST+8'; export TZ  otherwise use tzselect
  tzselect 

  # Launch atscap to create the configuration file (initial channel scan):
  atscap -s

  # launch atscap with the web interface enabled:
  atscap -w 127.0.0.1:24:80
You can then use atscap as usual. You'll be able to connect to the web interface at the URL http://localhost:80 to control it.


Running atscap from Hard Drive

Build atscap as follows. On Debian, you'll need to have these packages installed:
  apt-get install gcc make libmpeg2-4-dev imlib11-dev freeglut3-dev libimlib2-dev libxv-dev
If you don't see FE_ATSC and VSB_8 inside the enum fe_type and enum fe_modulation in your /usr/include/linux/dvb/frontend.h then it's easiest to download the latest headers included with atscap (in the download file include.tar.gz). Backup your headers, and replace them with the ones from this bundle, before building atscap using:
  make
  sudo make install
This will also install man pages for atscap, atscap_conf, xtscut and atscut.

When building atscap-1.1rc9t, if you see the following error, it means you probably haven't the libimlib2-dev package installed, but we need it now that Inkling updated xtscut to use imlib2 instead of the old imlib.

/bin/sh: imlib2-config: command not found
xtscut.c:428:20: error: Imlib2.h: No such file or directory

Now, launch atscap with the web interface enabled:

  atscap -w 192.168.1.10:24:80 -m -i0
It will start the signal scan, which will look something like this to begin with:

Signal scan found nothing yet...

It may take a while to find the first channel. Once it finds a channel, it adds it to the list along the bottom of the screen, like this:

Signal scan has found many stations...

Once it has scanned all 70 channels, it streams a little from each of them to determine their callsign, and prompts you asking whether you want to automatically load the Electronic Program Guide for each of the channels. Usually, that's a good idea, so press Y to say yes. You can always disable auto-EPG load later, using the web interface or by editing the configuration file.

Enable auto-EPG load?

The configuration file /etc/atscap/atscap0.conf is now generated.

To quit from atscap before the EPG load for all the channels has run its course, press z to cancel it, then press q to quit. But for now, let's leave atscap running while it loads all of the program guides, and let's connect to the web interface, e.g.: http://192.168.1.10/.


The Web Interface

If you're just getting started with using the web interface, it may seem that there are a lot of icons to get familiar with, so find the Legend: Show and click on the Show link, to display all of the icons:

Guide to the atscap icons for the web interface.

The last line of the legend shows the colors used in the program guide to indicate what atscap is going to do for the "event", e.g. whether it will capture that show (colored yellow, because a timer has been set to do the capture), or whether a show is coming up in the future but hasn't been scheduled for recording (colored green, because it's available in the future).


Energy Star Appliance (the -E option).

If you have hard drives that can be set to spin-down when not in use (e.g. firewire drives, SCSI drives, or internal IDE drives), then atscap can be set up to use tmpfs (an in-memory filesystem) to store its configuration while it's running, so that it can avoid waking up the sleeping dragon. For more info on spinning down firewire and SCSI drives, see here, which explains how to use the /sbin/scsi-spin command from the scsitools package. For info on spinning down IDE drives, see the -S option to hdparm. Note that some recent external firewire Seagate drives spin down all by themselves when they haven't been accessed for a while, even when they have xfs filesystems mounted, so you may not need any special command to spin your drive down as long as you only use it to hold the /dtv directory (where atscap stores the captured video files by default).

To use this energy and disk-life saving feature, you would first mount a smallish tmpfs filesystem on /dtv/ram as follows, before launching atscap with the -E option:

  sudo mkdir /dtv/ram
  sudo mount -t tmpfs none -o size=20m /dtv/ram

If you are using the -p option of atscap (to specify a different capture directory from the default /dtv), then you'll need to mount your tmpfs filesystem over the ./ram subdirectory of that directory. For example, if your capture directory is /mnt/machine/captures and you launch atscap using the command:

  atscap -w 192.168.1.10:24:80 -m -i0 -p /mnt/machine/captures
then you'd need to mount your tmpfs filesystem like this:
  sudo mkdir /mnt/machine/captures/ram
  sudo mount -t tmpfs none -o size=20m /mnt/machine/captures/ram

If you include the -E flag when you launch atscap for the first time, then remember that the newly-created configuration file containing the list of channels it found during the signal scan will only be copied to the /etc/atscap directory when you quit from atscap (in the meantime, it will live in the /dtv/ram directory, which is in memory only, and thus could be lost if your system crashed). So for now it's best to launch atscap with the -E flag only once you have everything set up and working properly.

Linking atscap statically

For debugging, it may be useful to link atscap statically. This involves adding the -static flag, and then repeating the libraries -lpthread -lrt -lm -lpng -lz over again at the end of the link line:
gcc -static -Wall -lm -g -rdynamic -DUSE_GNU_BACKTRACE -DUSE_GNU_BACKTRACE_SCRIPT \
-DUSE_LIBRT -lrt -DUSE_DVB -DUSE_DYNAMIC -DUSE_POWERDOWN -DUSE_ECMA48  \
-DUSE_WWW -DUSE_PNG -lpng -DUSE_CSS_SCROLLBARS -lpthread -o atscap atscap.c \
-lpthread -lrt -lm -lpng -lz

-- PeterKnaggs - 25 Feb 2007

Back to LinuxHints


to top

I Attachment sort Action Size Date Who Comment
atscap_program_guide.png manage 24.2 K 25 Feb 2007 - 03:11 PeterKnaggs Program guide in atscap
atscap_web_interface.png manage 66.3 K 25 Feb 2007 - 03:26 PeterKnaggs Web interface to atscap
signal_scan_nothing.png manage 6.3 K 26 Feb 2007 - 03:18 PeterKnaggs atscap beginning the signal scan
signal_scan_found_many.png manage 4.1 K 26 Feb 2007 - 03:19 PeterKnaggs Signal scan almost complete
signal_scan_auto_epg.png manage 5.3 K 26 Feb 2007 - 03:21 PeterKnaggs Enable auto-EPG load?
atscap_icons_guide.png manage 5.2 K 26 Feb 2007 - 04:19 PeterKnaggs Guide to the atscap icons for the web interface.
atscut.052.out.bz2 manage 5.2 K 29 Dec 2007 - 08:51 PeterKnaggs atscut -m3 -a15 -q 052.ts

You are here: Main > TWikiUsers > PeterKnaggs > LinuxHints > DigitalTelevisionAtscap

to top

Copyright © 1999-2008 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback