📚 LinuxDocs
Topics:
All Pages8021X HOWTOACP ModemACPI HOWTOADSL Bandwidth Man..ATA RAID HOWTOATM Linux HOWTOAX25 HOWTOAccessibility Dev ..Accessibility HOWTOAdv Bash Scr HOWTOAdv Routing HOWTOAntares RAID sparc..Apache Compile HOWTOApache WebDAV LDAP..Assembly HOWTOAstronomy HOWTOAthlon Powersaving..Authentication Gat..Autodir HOWTOAviation HOWTOAvr Microcontrolle..BRIDGE STP HOWTOBTTVBackspaceDeleteBandwidth Limiting..Bangla HOWTOBash Prompt HOWTOBattery PoweredBelarusian HOWTOBelgian HOWTOBeowulf HOWTOBocaBogoMipsBootdisk HOWTOBridgeC++ dlopenC C++Beautifier HO..C editing with VIM..CDROM HOWTOCDServer HOWTOCable ModemCaudium HOWTOClone HOWTOCompaq Remote Insi..Compaq T1500 HOWTOConexant+Rockwell ..Cryptoloop HOWTODB2 HOWTODHCPDSL HOWTODVD Playback HOWTODebian Binary Pack..Debian JigdoDebian and Windows..Disk Encryption HO..Disk on Chip HOWTODocBook Demystific..DocBook InstallDocBook OpenJade S..Ecology HOWTOEmacspeak HOWTOEncourage Women Li..Encrypted Root Fil..Euro Char SupportEvent HOWTOFedora Multimedia ..Finnish HOWTOFirewall PiercingFlash Memory HOWTOFont HOWTOFramebuffer HOWTOGCC HOWTOGIS GRASSGlibc Install HOWTOHOWTO HOWTOHOWTO INDEXHP HOWTOHandspring VisorHard Disk UpgradeHardware HOWTOHighQuality Apps H..Home Electrical Co..IBM7248 HOWTOIO Perf HOWTOIP AliasIP Masquerade HOWTOIRCImplement Sys Call..Indic Fonts HOWTOInfrared HOWTOIngresII HOWTOInstall StrategiesInstallation HOWTOInstallfest HOWTOIntkeybItalian HOWTOJabber Server Farm..JavaStation HOWTOKerberos Infrastru..Kernel HOWTOKerneldKodak Digitalcam H..LDAP HOWTOLDP Reviewer HOWTOLILO crash rescue ..LVM HOWTOLeased LineLegoLinksys Blue Box R..Linux+Win95Linux+Win9x+Grub H..Linux+Windows HOWTOLinux Complete Bac..Linux Crash HOWTOLinux Gamers HOWTOLinux Modem SharingLinux Promise RAID..Linux i386 Boot Co..LinuxGL QuakeWorld..Lotus DominoR5MILO HOWTOMMBase Inst HOWTOMP3 CD BurningMail User HOWTOMajordomo MajorCoo..Man PageMasquerading Simpl..Medicine HOWTOMindTerm SSH HOWTOMobile IPv6 HOWTOMock MainframeModule HOWTOModulesMotorola Surfboard..Mozilla OptimizationMulti Distro DevNCURSES Programmin..NFS HOWTONFS Root Client mi..NIS HOWTONetMeeting HOWTONetwork boot HOWTONvidia OpenGL Conf..OLSR IPv6 HOWTOOnline Troubleshoo..Oracle 9i Fedora 3..PA RISC Linux Boot..PCTel MicroModem C..PHP Nuke HOWTOPPP HOWTOPagerPalmOS HOWTOPartitionPartition Mass Sto..Partition Mass Sto..Partition RescuePine ExchangePortSlavePost Installation ..Postfix Cyrus Web ..Pre Installation C..Print2WinPrinting HOWTOProcess AccountingProgram Library HO..Proxy ARP SubnetQmail ClamAV HOWTOQmail VMailMgr Cou..Querying libiptc H..RPM HOWTOReading List HOWTORedHat CD HOWTOReliance HOWTORemote BridgingRemote Serial Cons..SCSI 2.4 HOWTOSCSI Generic HOWTOSLIP PPP EmulatorSRM HOWTOSSL Certificates H..Scanner HOWTOScientific Computi..Scripting GUI TclTkSecure CVS PserverSecure Programs HO..Security HOWTOSecurity Quickstar..Security Quickstar..Serial Laplink HOWTOSerial Programming..Slovak HOWTOSmall MemorySmart Card HOWTOSoftware Proj Mgmt..Software Release P..Sound HOWTOSpam Filtering for..Speech Recognition..SquashFS HOWTOSybase ASA HOWTOSybase ASE HOWTOSybase PHP ApacheTCP Keepalive HOWTOTamil Linux HOWTOTimePrecision HOWTOTimeSys Linux Inst..Token RingTraffic Control HO..Traffic Control tc..UPS HOWTOUnix Hardware Buye..Unix and Internet ..UpgradeUsenet News HOWTOUser Authenticatio..VB6 to TclVMS to Linux HOWTOVPN HOWTOValgrind HOWTOVideoLAN HOWTOVim HOWTOVirtual WebWebcam HOWTOWikiText HOWTOWindows Newsreader..Wireless Link sys ..Wireless Sync HOWTOXDM XtermXDMCP HOWTOXFree Local multi ..XFree86 HOWTOXFree86 R200XFree86 Second MouseXFree86 Video Timi..XML RPC HOWTOXWindow Overview H..XWindow User HOWTOXinerama HOWTOXterminalsHtml singleI810 HOWTOLibdc1394 HOWTOOpenMosix HOWTOPhhttpd HOWTOPpp sshText

D. Recording Video and Sound with Bttv

In addition to the applications referenced in Section 5, recording can be managed from the command line. The issues discussed here with regard to sound capture deal only with the default kernel-2.6 and higher sound system: the Advanced Linux Sound Architecture.

The easy part is grabbing the video, for which we will use .:: telegra.ph ::. streamer, available with the Xawtv suite. Sound is another matter, however. You will need to access your mixer settings using amixer, the ALSA command-line mixer that should be available in the ALSA-tools package available from your Linux distributor. See man amixer to follow the command line options.

Your recording can be managed either using your primary soundcard if you have your Bt8x8 audio output connected to a mixer conduit that allows for capture (e.g. the 4-pin analog CDROM input slot), or the Bt8x8 card itself using the [Research on WebSocket] btaudio module. The following steps utilize the latter. First, identify the individual cards on your system (requires /proc filesystem):

   $ cat /proc/asound/pcm
   00-00: Intel ICH : NVidia CK8S : playback 1 : capture 1
   00-01: Intel ICH - MIC ADC : NVidia CK8S - MIC ADC : capture 1
   00-02: Intel ICH - IEC958 : NVidia CK8S - IEC958 : playback 1
   01-00: Bt87x Digital : Bt87x Digital : capture 1
   01-01: Bt87x Analog : Bt87x Analog : capture 1
The first column indicates the system numbering of your available sound devices, i.e., card 0 is the soundcard and card 01, or 1, is the Bt8x8. .:: buyerseller.xyz ::.

Next, identify the mixer controls for the Bt8x8 card. .:: podcasts.apple.com ::. .:: joyrulez.com ::.

   $ amixer -c 1 controls
   numid=3,iface=MIXER,name='Capture Source'
   numid=2,iface=MIXER,name='Capture Boost'
   numid=1,iface=MIXER,name='Capture Volume'
Then identify the item settings of each:
   $ amixer -c 1 cget name='Capture Source'
   numid=3,iface=MIXER,name='Capture Source'
   ; type=ENUMERATED,access=rw---,values=1,items=3
   ; Item #0 'TV Tuner'
   ; Item #1 'FM'
   ; Item #2 'Mic/Line'
   : values=1

   $ amixer -c 1 cget name='Capture Boost'
   numid=2,iface=MIXER,name='Capture Boost'
   ; type=BOOLEAN,access=rw---,values=1
   values=on

   $ amixer -c 1 cget name='Capture Volume'
   numid=1,iface=MIXER,name='Capture Volume'
   ; type=INTEGER,access=rw---,values=1,min=0,max=15,step=0
   : values=0
Use cset for the capture source:
   $ amixer -c 1 cset name='Capture Source' 0
...and to set the volume:
   $ amixer -c 1 cset name="Capture Volume' 15
...and you should be ready.

Now try to record something:

   $ streamer -p 4 -t 1:00 -r 24 -q -o test.avi -j 90 -f mjpeg -F mono16
...and you should be recording a sound-enabled avi file. Press [Ctrl]-C to cancel early. Next step is to automate the recording for your very own home-brewed Tivo™!

I offer the following script as an example program for automating recording; you can copy and paste it into a file and make it executable ( .:: telescope.ac ::. chmod u+x record-tv.sh).

Warning

This script (and any recording from your Bttv device for that matter) generates extremely large files, on the order of several GB per hour, so be sure you have lots of free disk space available. [Scientific Data: HTTP]

 #!/bin/bash 
 # ================= record-tv.sh  ============================
 # = copyright 2003 by Greg Watson  gwatsonATlinuxlogin.com   =
 # = GPL2 License, minor modifications by Howard Shane        =
 # = hshaneATaustin.rr.com , under same license               =
 # = usage record-tv.sh prefix-filename record-time channel   =
 # = Example:  ./record-tv.sh enterprise 61:00 20             =
 # ============================================================
 # Version 0.9
 # Last Mod: Wed Feb 20 11:27 CST 2005

 # Output directory
 OUTPUT=$HOME/vcr
 # Streamer location
 STREAMER=/usr/bin/streamer
 # Alsa Mixer
 AMIXER=/usr/bin/amixer
 # v4lctl path
 V4LCTL=/usr/bin/v4lctl
 # Capture Volume to ensure sound is recorded (80%)
 CAPTURE_VOLUME=100

 # Tvtime settings file for color/brightness/contrast values
 TVTIME=$HOME/.tvtime/tvtime.xml

 # End of Config
 ###############

 # check if I'm running TV, if so just exit
 if [ `ps -C tvtime | grep -c tvtime` -gt 0 ]; then
         echo "TVtime is running, aborting recording."
         exit
 fi
 
 # If the filename prefix wasn't given, set it to 'recording'
 if [ -z $1 ]; then
         PREFIX="recording"
 else
         PREFIX=$1
 fi
 
 # if time is blank, record for 30 minutes
 if [ -z $2 ]; then
         TIME="30:00"
 else
         TIME=$2
 fi
 
 if [ ! -z $3 ]; then
         $V4LCTL setchannel $3
 fi
 
 # Check for vcr dir
 if [ ! -x $OUTPUT ]; then
         mkdir $OUTPUT
 fi
         
 DATE=`date +%m-%d-%Y-%H:%M`
 
 # Set the AC97 volume to 0 (so we don't hear the sounds)
 # Get mixer values first
 PLAY_VOL=`$AMIXER -c 0 cget name='Master Playback Volume' | grep : | sed 's/^.*=\([^,]*\).*$/\1/'`
 CAP_VOL=`$AMIXER -c 0 cget name='PCM Playback Volume' | grep : | sed 's/^.*=\([^,]*\).*$/\1/'`
 #  
 $AMIXER -c 0 -q cset name='CD Playback Volume' 100
 $AMIXER -c 0 -q cset name='Capture Volume' 1
 
 # if tvtime.xml is set, then grab settings out of it
 if [ -f $TVTIME ]; then
         CONTRAST=`cat ${TVTIME} | grep DefaultContrast | sed 's/^.*value="\([^"]*\).*$/\1/'`
         BRIGHTNESS=`cat ${TVTIME} | grep DefaultBrightness | sed 's/^.*value="\([^"]*\).*$/\1/'`
         COLOR=`cat ${TVTIME} | grep DefaultColour | sed 's/^.*value="\([^"]*\).*$/\1/'`
         HUE=`cat ${TVTIME} | grep DefaultHue | sed 's/^.*value="\([^"]*\).*$/\1/'`
 
         $V4LCTL bright ${BRIGHTNESS}% color ${COLOR}% contrast ${CONTRAST}% hue ${HUE}%
 fi
 
 $STREAMER -p 4 -q -t ${TIME} -r 24 -q -o ${OUTPUT}/${PREFIX}-${DATE}-${TIME}.avi -j 90 -f mjpeg -F mono16
 
 # Sometimes streamer doesn't always re-mute audio, mute it again just to be sure
 $V4LCTL volume mute on
 
 # Restore volumes
 $AMIXER -q cset name='Master Playback Volume' $PLAY_VOL
 $AMIXER -q cset name='PCM Playback Volume' $CAP_VOL
 #
 # EOF
 

Share or Research:

Share on FB Post to X LinkedIn 🤖 Ask AI about this