tutorials:command_line_dvb
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorials:command_line_dvb [2012/03/03 19:34] – rmiles | tutorials:command_line_dvb [2017/10/12 21:58] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | **Command line dvb-t** | + | **Command line dvb-t by example** |
- | I have two budget dvb-t pci cards in a linux box that I use for saving dvb TV programs and, since I am a minimalist, sometimes viewing in real time using xine. In this brief tutorial I will explain how to access DVB broadcasts on the command line and introduce a bare bones example script that will tune a channel, encode a broadcast on the fly and save it to disk. | + | I have two budget dvb-t pci cards in a linux box that I use for saving dvb TV programs< |
- | You might wonder | + | You might ask why in the age of Myth TV would I bother |
---- | ---- | ||
- | If you want to try any of this on your own machine you will need to install dvb-apps. If a package is not available for your distro or if you want the latest version go to [[http:// | + | If you want to try any of this on your own machine you will need to install |
+ | |||
+ | Note that some distros package // | ||
- | Note that some distros package dvb-apps as dvb-utils and that there is another bundle of dvb related utilities named DVBapps. If you have installed or built the correct dvb-apps, in addition to some include files, libraries and frequency listings you should have installed the follwing command line utilities | ||
< | < | ||
rick[~]$ ls saves/ | rick[~]$ ls saves/ | ||
Line 18: | Line 19: | ||
I will only discuss the use of //scan// and //tzap// in this tutorial. | I will only discuss the use of //scan// and //tzap// in this tutorial. | ||
- | In order to tune a channel with //tzap// or indeed other applications including //mplayer// and //xine// you will first need a // | + | In order to tune a channel with //tzap// or indeed other applications including //mplayer// and //xine// you will first need a // |
< | < | ||
Line 36: | Line 37: | ||
</ | </ | ||
- | To create my channels.conf I run scan with the path to au-Melbourne and redirect stdout to a file. | + | To create my //channels.conf// I run scan with the path to //au-Melbourne// and redirect stdout to a file. |
< | < | ||
Line 94: | Line 95: | ||
</ | </ | ||
- | Tzap uses // | + | Tzap uses // |
< | < | ||
Line 109: | Line 110: | ||
</ | </ | ||
- | Once tzap has tuned the channel it will remain tuned until the process is terminated. | + | Once tzap has tuned the channel it will remain tuned until the process is terminated. |
< | < | ||
Line 126: | Line 127: | ||
</ | </ | ||
- | Using cat to stdout is pretty useless but dvr0 can be redirected and saved as a transport stream (.ts) on disk or accessed by an application and viewed in real time by opening up another terminal and running the second command. The following will redirect stdout from dvr0 to a file that can be either viewed or encoded to some other format. | + | Using cat to stdout is pretty useless but dvr0 can be redirected and saved as a transport stream (.ts) on disk or accessed by an application and viewed in real time by opening up another terminal and running the second command. The following will redirect stdout from dvr0 to a file that can be either viewed |
< | < | ||
Line 132: | Line 133: | ||
</ | </ | ||
- | As can be seen, the above command redirects stdout from dvr0 to stdin xine. | + | The next command redirects stdout from dvr0 to stdin xine which will then open up in a window. |
< | < | ||
Line 169: | Line 170: | ||
</ | </ | ||
- | As I mentioned above, I sometimes watch dvb in real time with xine but using tzap in one terminal and then running xine in a second is overkill. However, I do use mplayer' | + | As I mentioned above, I sometimes watch dvb in real time with xine but using tzap in one terminal and then running xine from a second |
- | Except for the inclusion of encoding instructions and a path/ | + | Except for the inclusion of encoding instructions and a path/ |
< | < | ||
Line 196: | Line 197: | ||
< | < | ||
</ | </ | ||
+ | |||
+ | I could just save every thing I want to watch as a transport stream but the overhead running mencoder is very minimal. Additionally i prefer to save shows as mpeg-ps videos and I can edit out commercials from using a very fast no frills gui application , gopdit, that was developed specically for editing program streams< | ||
+ | |||
+ | Using two terminals and remembering commands, options and syntax gets to be a bit too much so I'll close this tutorial with an example script that illustrates how the commands tzap and mencoder can be used in a script to record a dvb broadcast. To use this script you would have to edit the variable declarations to suit and run it when the show is about to begin. I have written an interactive script that parses channels.conf, | ||
+ | |||
+ | I'll present that script later on in my series of bash tutorials. | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | # zap-men | ||
+ | # Edit variables to suit. | ||
+ | dvb_card=1 | ||
+ | video_dir=/ | ||
+ | chnl_cnf=/ | ||
+ | channel=ABC1 | ||
+ | duration=3600 | ||
+ | name=luther-abc-friday.mpg | ||
+ | |||
+ | # Tune in and lock channel | ||
+ | tzap -a $dvb_card -c $chnl_cnf -r " | ||
+ | tzap_pid=$! | ||
+ | |||
+ | # Give tzap time to tune in and lock channel | ||
+ | sleep 2 | ||
+ | |||
+ | # Encode on the fly | ||
+ | mencoder -oac copy -ovc copy -of mpeg -mpegopts format=dvd / | ||
+ | mencoder_pid=$! | ||
+ | |||
+ | sleep $duration | ||
+ | |||
+ | kill $tzap_pid | ||
+ | kill $mencoder_pid | ||
+ | |||
+ | # end of script | ||
+ | ################################################## | ||
+ | # Note: | ||
+ | # The ampersand "&" | ||
+ | # the script will never proceed to the mencoder command. Likewiseand the | ||
+ | # mencoder command is follwed by an ampersand else the script will never | ||
+ | # proceed past that command to run the duration of recording and the shut | ||
+ | # down. | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | Rick Miles | ||
+ | |||
+ | 03 March 2012 | ||
+ | |||
+ | ---- | ||
+ | |||
+ | //< | ||
+ | |||
+ | //< | ||
+ | |||
+ | //< | ||
+ |
tutorials/command_line_dvb.1330763676.txt.gz · Last modified: 2017/10/12 21:58 (external edit)