Editing Video Tapes and Prompting TV Talent with Ada
Form U121-0394 VIDEOADA.TXT
Ada Information Clearinghouse, 1-800-AdaIC-11 (232-4211), 703/685-1477
Tom Moran Decision Aids 14701 Farwell Avenue Saratoga, CA 95070 Tel: 408/741-5952 E-mail: firstname.lastname@example.org 71541,3125 CIS 2113665@MCIMail.com
Ada's real-time features make it highly suited for computers and television. The TV time scale is one frame every 1/60 second -- fast enough to require a real-time mindset, but slow enough for a PC or Macintosh. Ada's Calendar package and Delay statement allow easy and portable control of timing. Usually more than just video is running; operator input, audio, VCR control, etc., all complicate the system. Juggling all these without any tasking leads to complex, fragile designs. Using interrupts or OS tasking facilities (if any) is hard to debug and leads to non-portable code. Ada tasks simplify the design, and they are portable.
Two examples of how I have used Ada in programming software for television production and post-production are Orson, a video tape editor, and Prompt, a teleprompter-like program that scrolls a script.
Orson is designed as a low-end program for the millions of people with a camcorder; lots of un-indexed, un-edited, and un-watched "vacation videos"; and a computer. If you have ever tried to edit by using the play/fast forward/rewind buttons on a VCR you know there has to be a better way! Using modern video compression chips and very fast multi-gigabyte disks, it is possible to copy tapes to disk, edit them with the random access speed of a disk, and then copy the result back to video tape. Such hardware is still beyond the reach of most small video houses, not to mention consumers. Orson uses cheap PC audio and video capture boards costing only a few hundred dollars to capture telephone-quality sound and small, monochrome pictures to a hard disk at rates averaging 20 megabytes/hour of tape.
Once captured, the tape can be edited at disk speeds to produce an edit decision list, which is simply a list of the shots the user wants on the edited tape, in the order he wants them. Each shot has a short description and a starting and ending position on the original master tape. The CRT during editing shows two TV sets, two remote control pads, and two pads of yellow ruled paper. The TV, remote control, and yellow pad on the left show the original master tape, while the ones on the right show the edited result tape. In addition to the play/fast and forward/rewind remote control buttons, there are buttons to move forward or back by a single frame or to the next change of scene. The master-tape controller also has buttons to specify and name shots and to copy a shot to the edited tape. The yellow pads also scroll -- jumping the small TV picture to the correct section of tape. Sound is very important in editing: If grandma says "How nice you could all come. Don't point that camera at me!" you may wish to include the first sentence but cut out the second. Sound must be played with accurate timing, even when stepping forward or back by single frames. A few seconds are necessary so the user can tell where he is, but a keystroke or mouse click must immediately stop the sound and potentially start it at a new location. It is common in searching for a cut point to repetitively step forward one frame at a time to find the correct audio spot. This sounds like "Ma, Ma, Max, Max, ax, ax, ax H, ax He, x Hea, x Head, Headr, eadro, eadroo, adroom" talking -- and the computer had better get the timing right.
The small, monochrome pictures and telephone sound on disk are only used to let the editor make decisions. Given the final edit decision list, the computer shuttles the VCRs around to copy the desired sections of tape, VCR to VCR, thus maintaining maximum picture and sound quality. Professional systems incorporate a digital time code telling the position of each video frame. Consumer camcorders not only lack that, but vacation videos frequently have totally blank sections of tape so simple frame counting will not work. A one-time calibration step lets the computer determine the mechanical delays and timings of the VCRs. Other, proprietary techniques are also used. The different methods for controlling the VCR transports range from telling the user to push the buttons (having previously measured his response time) to hardware (of various levels of sophistication and reliability) to interface the computer to the camcorder or VCR.
Ada's encapsulation mechanisms nicely handle the plethora of different hardware. Thus Orson has a single package, package sound_play, that defines the interface to sound playing hardware. There are multiple bodies corresponding to different supported hardware.
It took me two weeks to port the decision list editor to the Macintosh. This included learning the Macintosh OS calls, the MPW editor, and the Meridian Macintosh Ada compiler (I use RR Ada on the PC). The program was already organized with a main loop to respond to operator inputs, so that matched directly to the Macintosh style. The low-level graphics and sound needed to be totally changed but the package specifications stayed intact, and thus the higher level packages needed no changes. The Macintosh OS is defined in Pascal terms so it maps at least tolerably well to Ada. The Meridian System'Tick is one second but I wrote a package, package my_calendar, to get times accurate to 1/60 second from the OS. Meridian was kind enough to send a patch to allow Delay to execute with that granularity. RR on the PC uses the MSDOS clock which ticks every 1/18 of a second, but I replaced their Calendar body with one that reads the clock to a quarter millisecond and their Delay immediately became that accurate.
PROMPT is a small program I originally wrote for KSAR -- the local Community Access Television station. Talent -- a technical TV term meaning anybody in front of the camera -- needs help remembering a script of any significant length. A teleprompter simply displays text in large enough letters to be read at a distance and scrolls it past at a comfortable speaking pace.
KSAR has a low budget and depends heavily on donated equipment. They had an IBM PC XT with a CGA display available. The CGA was originally designed to use a television sets as a monitor, so it has an (adequate) NTSC video output signal. The program must: 1) display large text and scroll it steadily on the TV, 2) read the script file from disk and feed it to the scroller, and 3) accept operator input to vary the speed, pause, insert comments, etc. The Ada program uses three tasks, one for each of these jobs. With a little trickery controlling the CGA hardware, the program is able to scroll 12 twenty-character lines of large, blocky letters that look just fine at talent-teleprompter distance, at speeds up to faster than a person can intelligibly speak.
Thinking PROMPT might be useful to other community access stations I uploaded it to the National Federation of Local Cable Programmers electronic bulletin board system (BBS) [since renamed the Association for Community Media or ACM] and the Compuserve Broadcast Professionals Forum. Since it was small, and nicely demonstrated the use of Ada tasking, I included the source code. I have had positive feedback from people using it across the US and around the world. I recently heard from an Australian who uses it on his laptop when storytelling in the local community center. I understand it is included on a CD-ROM of shareware.
Produced in cooperation with Ada Information Clearinghouse, Ada Software Alliance, and ACM SIGAda. Hard copy available from the Ada Information Clearinghouse, at the address below.
The views, opinions, and findings contained in this report are those of the author(s) and should not be construed as an official Agency position, policy, or decision, unless so designated by other official documentation.
Ada Information Clearinghouse (AdaIC) P.O. Box 46593 Washington, DC 20050-6593 1-800-AdaIC-11 (232-4211), 703/685-1477, FAX 703/685-7019 email@example.com; CompuServe 70312,3303
The AdaIC is sponsored by the Ada Joint Program Office and operated by IIT Research Institute.