User Tools

Site Tools


ding:tvrecording

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Last revisionBoth sides next revision
ding:tvrecording [2005/10/05 07:55] – external edit 127.0.0.1ding:tvrecording [2008/06/04 19:10] – removed 138.220.76.37
Line 1: Line 1:
-====== TV recording using mencoder ====== 
- 
-Sometimes there is a show on TV I want to record for watching it later. I have a TV card in the [[ding:intro|ding]] to do this. It's an old MiroPCTV card sold by Pinnacle. Here is what ''/proc/pci'' has to say: 
- 
-  Bus  0, device   8, function  0: 
-    Multimedia video controller: Brooktree Corporation Bt848 Video Capture (rev 18). 
-      IRQ 5. 
-      Master Capable.  Latency=32.  Min Gnt=16.Max Lat=40. 
-      Prefetchable 32 bit memory at 0xef000000 [0xef000fff]. 
- 
-===== Kernel Support ===== 
- 
-Here are the modules I did select in the kernel configuration to get the TV card running.  
- 
-  Character devices  ---> 
-    I2C support  ---> 
-      <M> I2C support 
-      <M> I2C bit-banging interfaces 
-  Multimedia devices  ---> 
-    <M> Video For Linux 
-    Video For Linux  ---> 
-      [*]   V4L information in proc filesystem 
-      <M>   BT848 Video For Linux 
-  Sound  ---> 
-    <M> Sound card support 
-    <M>   BT878 audio dma 
-    <M>   TV card (bt848) mixer support 
- 
-===== Recording Script ===== 
- 
-I use [[http://www.mplayerhq.hu|MPlayers]] ''mencoder'' to record directly to DIVX with the following script: 
- 
-<file> 
-#!/bin/sh 
- 
-#Duration in seconds 
-TIME=$1 
-#Channel like S35 or E12 
-CH=$2 
-#name of program (filename) 
-NAME=$3 
- 
-#Where to put the stuff 
-OUTDIR="/ftp/disk1/upload" 
-OUT="$OUTDIR/$NAME.avi" 
- 
-#Bitrate for video encoding 
-VBR=500 
- 
-#Audiobitrate 
-ABR=96 
- 
-#mencoder 
-ME='/usr/bin/mencoder' 
- 
-CMD="$ME tv:// 
-  -tv driver=v4l:width=384:height=288:norm=pal:amode=0:adevice=/dev/dsp:channel=$CH:buffersize=64 
-  -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=$VBR:vhq 
-  -oac mp3lame -lameopts cbr:br=$ABR 
-  -endpos $TIME -sws 1 -o $OUT" 
- 
-echo "recsrc PhoneIn" | /usr/local/bin/smixer -s - 
-echo "vol PhoneIn 60" | /usr/local/bin/smixer -s - 
-$CMD 
-echo "vol PhoneIn 0" | /usr/local/bin/smixer -s - 
-</file> 
- 
-The script uses [[ding:smixer]] to set the soundcard's recording source and volume. It accepts three paramters: the duration of the show to record in seconds, the channel name, and the name of the file to save (without path and extension). 
- 
-For more info on the mencoder options used see http://mplayerhq.hu/DOCS/HTML/en/tv-input.html 
- 
-===== Programmed Recording ===== 
- 
-To program this VCR I use ''at'' (''#> apt-get install at'') and the following little bash script which uses ''dialog'' (''#> apt-get install dialog'') to ask all needed information interactively: 
- 
-<file> 
-#!/bin/bash 
- 
-RECORDER="/home/mm/recordtv.sh"; 
- 
-OPTS='--stdout --no-shadow --clear --backtitle "TV-Recorder"' 
- 
-NAME=`dialog $OPTS --title "Title" --inputbox "Please name the program to record (avoid special chars)" 0 0 "tvprogram"` 
-if test $? -ne 0 ; then exit; fi 
- 
-PROG=`dialog $OPTS --title "Station" --menu "Choose a station" 0 0 5 \ 
-                                            "E10"  "ARD" \ 
-                                            "E8"   "ZDF" \ 
-                                            "SE4"  "Arte" \ 
-                                            "SE19" "Phoenix" \ 
-                                            "E7"   "ORB" \ 
-                                            "E6"   "SFB1" \ 
-                                            "SE15" "BR" \ 
-                                            "S22"  "WDR" \ 
-                                            "SE17" "NDR" \ 
-                                            "SE18" "MDR" \ 
-                                            "SE9"  "3SAT" \ 
-                                            "S35"  "XXP" \ 
-                                            "SE20" "Pro7" \ 
-                                            "E9"   "Sat1" \ 
-                                            "E11"  "RTL" \ 
-                                            "SE13" "RTL2" \ 
-                                            "SE21" "Super RTL" \ 
-                                            "SE6"  "Kabel1" \ 
-                                            "SE11" "VOX"` 
-if test $? -ne 0 ; then exit; fi 
- 
-DATE=`dialog $OPTS --title "Startdate" --calendar "Select the day when the recording starts" 0 0` 
-if test $? -ne 0 ; then exit; fi 
-DATE=`echo $DATE | sed -e 's/\//./g'` 
- 
-START=`dialog $OPTS --title "Starttime" --timebox "Please set the starttime of the program" 0 0` 
-if test $? -ne 0 ; then exit; fi 
-START="`echo $START | cut -d : -f 1`:`echo $START | cut -d : -f 2`"; 
- 
- 
-TIME=`dialog $OPTS --title "Duration" --timebox "Please set the duration of the program" 0 0 0 0 0` 
-if test $? -ne 0 ; then exit; fi 
- 
-#Calculate seconds from TIME: 
-THRS=`echo $TIME | cut -d : -f 1` 
-THRS=`expr $THRS \* 3600` 
-TMIN=`echo $TIME | cut -d : -f 2` 
-TMIN=`expr $TMIN \* 60` 
-TSEC=`echo $TIME | cut -d : -f 3` 
-TIME=`expr $THRS + $TMIN` 
-TIME=`expr $TIME + $TSEC` 
- 
-dialog $OPTS --title "Confirmation" --yesno \ 
-"I will record the TV-Show '$NAME' on channel $PROG. \ 
- It starts at $DATE $START and runs $TIME seconds. Is that okay?" 0 0 
-if test $? -ne 0 ; then exit; fi 
- 
-echo "$RECORDER $TIME $PROG \"$NAME\"" | at $START $DATE 
-</file> 
- 
-Note: ''at'' has a [[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=13605|known bug]] which prevents it from working when ''/var'' is a mounted NFS partition. However for me it works as ''root'' not as normal user regardless of the set SUID bit. 
- 
  
ding/tvrecording.txt · Last modified: 2008/06/04 19:39 by ach