LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-19-2009, 03:35 PM   #1
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Recording TV


Building a DVR box is a hefty project and on my to-do list, but currently I lack the time to tinker with that. Perhaps in a couple of months. For now I seek a short-term recording solution.

I found many different perspectives for recording TV over the air with mencoder. After some surfing and experimenting I decided on the following:

Code:
mencoder dvb://${1} -oac copy -ovc copy -endpos ${2} -o ${FILENAME} -cache 8192 -quiet
Where ${1} is the station as listed in channels.conf and ${2} is the recording period.

The file is AVI. The picture quality is great. Running ffmpeg -i reveals the video format is MPEG2. I also have noticed that various stations transmit at different resolutions (1080p, 780p, 480p) and resolution varies from show to show.

So what is the problem?

Although picture quality is great, I cannot view the video at any point other than from the very beginning. Whenever I move the position slider, the slider immediately returns to the beginning of the video.

I have some AVIs using MPEG4 and they do not behave this way. I figured the slider problem was related to the MPEG2 format and I needed to convert the TV broadcast on-the-fly to MPEG4. I snipped the following from some web site:

Code:
OPT="vbitrate=2160000:mbd=2:keyint=132:v4mv:vqmin=3:lumi_mask=0.07:dark_mask=0.2:scplx_mask=0.1:tcplx_mask=0.1:naq"
mencoder dvb://${1} -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:${OPT} -endpos ${2} -o ${FILENAME} -cache 8192 -quiet
I received the following error message:

The selected video_out device is incompatible with this codec.

Additionally, the picture quality deteriorates despite ffmpeg reporting the video is in MPEG4. Files sizes are much smaller too, which confirms the lower resolution.

Watching TV live with either Xine or Kaffeine works fine. Kaffeine provides a fairly nice interface to record TV and even provides an option to repeat the schedule. Not bad. Kaffeine saves the file in m2t format and I have no slider issues when watching such files. Yet my computer is primarily a workstation and not a multimedia center. Until I can build a dedicated box, I prefer to record from the command line and in the background. Less overhead and I can schedule with cron/at. Additionally, Kaffeine sometimes stalls and I prefer not to run Kaffeine to record.

Oddly, ffmpeg reports the m2t file uses MPEG2 for the video. Perhaps then the problem is not the MPEG2 format but something else.

I have a Hauppauge HVR-1250 TV capture card. Only digital TV drivers are available. No analog or infra red drivers yet exist.

Using mencoder seems to be a straightforward method for recording. I can live with the direct copy and not having slider control, but having high quality and slider control would be better.

How do I convert on-the-fly to MPEG4? Or do I have to convert after recording? Do I need to convert or is there another way to restore slider control?

Lastly, can I record TV with ffmpeg?

I'm using Slackware 12.2, mencoder 1.0rc2-4.2.3, ffmpeg 20081105.

Thanks.
 
Old 02-19-2009, 03:50 PM   #2
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
See the bottom of this page:
http://www.linuxtv.org/wiki/index.php/V4L_capturing

You can use ffmpeg, as described above, but transcode may be better. Also for live tv recording you may need to use x264, but maybe if you have a powerful computer you can use xvid, make sure to use the threads option on whatever encoder you are using.

Last edited by H_TeXMeX_H; 02-19-2009 at 03:52 PM.
 
Old 02-19-2009, 05:49 PM   #3
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Thanks for the link. Unfortunately the examples presume analog stations rather than digital. (There is no /dev/video device node with digital channels.)

I've been trying variations of the examples. I end up with the same problem: if I resolve the slider problem I end up with terrible resolution.

P.S. Hardware is not an issue. Dual core, nvidia chip set, etc.

Last edited by Woodsman; 02-19-2009 at 05:51 PM.
 
Old 02-20-2009, 01:03 AM   #4
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Hmm, well in that case I'm not sure, but I know that xdtv is likely to support it if built correctly:
http://xawdecode.sourceforge.net/htm.../indexUS.shtml

Regular ffmpeg may not support recording from DVB if there is no device node associated with it.
 
Old 02-22-2009, 10:29 PM   #5
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
To anybody who reads this thread, I found a solution.

Originally I used the following:

mencoder dvb://${1} -oac copy -ovc copy -endpos ${2} -o ${FILENAME} -cache 8192 -quiet

That provided a great picture but I lost the slider control with the viewer.

I modified that to include the -of option:

mencoder dvb://${1} -oac copy -ovc copy -of avi -endpos ${2} -o ${FILENAME} -cache 8192 -quiet

For whatever reason, the mpg switch always resulted in the video stalling somewhere around 6 to 8 minutes although the audio recorded all the way. Weird. The man page does say the -of option is experimental but the avi switch has worked without hitch.

No genius on my part. I read something not directly related and on a whim I tried the -of option.

Works fine and I no longer have slider problems with the viewers.
 
Old 02-24-2009, 07:55 PM   #6
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
I wanted only to create a nominal method for recording TV without using MythTV. I posted a mini-how-to about my experience:

Recording TV With A PC
 
Old 02-25-2009, 01:37 PM   #7
justwantin
Member
 
Registered: Aug 2003
Location: Melbourne, Australia
Distribution: Slackware, Slackwarearm
Posts: 878

Rep: Reputation: 120Reputation: 120
Did you ever consider using dvbstream?
 
Old 02-25-2009, 02:59 PM   #8
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Tough to try something I never heard of.

After 10 minutes of some nominal surfing research, I don't see how dvbstream would help me. Did you have something particular in mind with respect to basic recording?
 
Old 02-25-2009, 03:48 PM   #9
justwantin
Member
 
Registered: Aug 2003
Location: Melbourne, Australia
Distribution: Slackware, Slackwarearm
Posts: 878

Rep: Reputation: 120Reputation: 120
Actually I was composing an email to you on your website email address when this came in. It was/is a bit verbose.

The short of it is dvbstream will also save to disk as an .mpeg.ps which is the same as a .vob and it is low overhead. You could watch realtime by streaming but we have been saving to disk and watching with any video ap off the disk with just a couple seconds delay from the real time broadcast.

I think dvbstream is more of a backend tool for shiney gui's. The command would look like this:
Code:
dvbstream -qam 64 -cr 3_4 -gi 16 -bw 7 -tm 8 -f 226500 -ps \
-n 10 -o 2308 2307
All the values come from the channels.conf but the have to be supplied in the command instead of referring to a complete line in the channels.conf.

To get around this my recording script first parses the channels.conf for uncommented lines and offers a station selection, when the user makes a selection, that line is then parsed to create variables to be used in the dvbstream command. The reason I comment ot lines in my channels.conf is that I only need to display 6 out of too many.

My script was set up to be run remotely via ssh on a file server and to be simple enough for my daughter to use cli. My approach was different to yours but I have often thought about putting in some checks like you have in your script. I have saved a copy of your script and will have a closer look later.

I am in the process of rewriting my scripts page but I uploaded the incomplete revision so you can have a look. If you select "save-dvb" you will go down the page to a brief discussion of of the script and links to the script and another page I wrote awhile back about saving and encoding digital tv.
http://www.turtlespond.net/scripts/scripts.html

Last edited by justwantin; 02-25-2009 at 09:25 PM. Reason: tyops
 
Old 02-25-2009, 04:08 PM   #10
rg3
Member
 
Registered: Jul 2007
Distribution: Fedora
Posts: 527

Rep: Reputation: Disabled
Just for the record, I have a DVB-T card and use it to record my favourite programs from time to time, and I don't use mencoder but mplayer. Also, I'm forced to zap using the "tzap" program (from dvb-tools) because zapping with mplayer doesn't seem to work in my case. My dvb-t-record script looks like this:

Code:
#!/bin/bash
#
# $1	channel
# $2	start time
# $3	end time
# $4	file name
#
at $2 <<EOF
screen -d -m /usr/bin/tzap -r "$1"
sleep 5
screen -d -m /usr/bin/mplayer -dumpstream -dumpfile "$4" /dev/dvb/adapter0/dvr0
EOF

userid=$( id -u )

at $3 <<EOF
pkill -x -u $userid mplayer
sleep 5
pkill -x -u $userid tzap
EOF
And I call it as the comments suggest. E.g. dvb-t-record 'Some channel' 22:15 00:15 ~/whatever.mpg. Of course, you can use any syntax "at" understands to specify the start and end time, but you have to use quotes in case of multiple words.

Last edited by rg3; 02-25-2009 at 04:12 PM.
 
Old 02-25-2009, 04:32 PM   #11
justwantin
Member
 
Registered: Aug 2003
Location: Melbourne, Australia
Distribution: Slackware, Slackwarearm
Posts: 878

Rep: Reputation: 120Reputation: 120
Quote:
I'm forced to zap using the "tzap" program (from dvb-tools) because zapping with mplayer doesn't seem to work.....
I seem to remember not being able to get any joy out of mplayer in the beginning and I too used tzap to lock on and cat to save what was happening on dvr0 to disk like this:
Code:
tzap -c /etc/channels.conf -r "ABC2"
and this
Code:
cat /dev/dvb/adapter0/dvr0 > /videos/sunday-07-04-29.ts
It was low overhead and since the box was remote and also doing other things I minimised the grunt required by avoiding mplayer completely. We could view in most video aps and only encode if we wanted to burn to a dvd.
 
Old 04-14-2009, 11:58 AM   #12
calande
Member
 
Registered: Oct 2005
Distribution: Ubuntu
Posts: 165

Rep: Reputation: 15
Is there a good DVB player out there that sports a timer to schedule a recording with a nice GUI? Totem doesn't seem to have a timer... Thanks.
 
Old 04-14-2009, 12:01 PM   #13
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,644

Rep: Reputation: 145Reputation: 145
kaffeine has a scheduler: http://slackbuilds.org/repository/12...edia/kaffeine/
 
Old 04-14-2009, 12:32 PM   #14
calande
Member
 
Registered: Oct 2005
Distribution: Ubuntu
Posts: 165

Rep: Reputation: 15
Thanks. Actually, I use Gnome, I'd prefer a Gtk application if possible...
 
Old 04-16-2009, 10:42 PM   #15
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Quote:
Is there a good DVB player out there that sports a timer to schedule a recording with a nice GUI?
If you are interested, I shared my experiences online how I solved the same question:

Recording TV With A PC
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
recording strycnine Linux - Newbie 1 12-26-2006 03:14 PM
CD recording with 2.6.10 Kronoss Linux - Hardware 2 01-03-2005 12:05 PM
recording help synaptical Linux - General 2 01-03-2005 07:31 AM
CD Recording JSThePatriot Linux - Newbie 7 09-06-2004 07:01 PM
It`s about recording Ich_hoffe Linux - Software 2 10-31-2002 01:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration