-   Linux - Software (
-   -   Recording Video with Xawtv (

Inexactitude 04-05-2004 05:45 PM

Recording Video with Xawtv
I'm trying to use Xawtv to record videos off my ATI tv woner ve, but I'm not having much success. In particular, I'm having two problems. One, the video is coming out upside down, but I think I could fix this with transcode. My main problem is that I'm not getting any sound. I can hear the sound when coming out of the computer's speakers as I'm recording the video, but there is no sound in the resulting avi after I'm done recording the video. I have the audio cables going to the mic input on my audio card, which is a soundblaster audigy. Can someone tell me how I may be able to fix this?

Thanks for any help.

acid_kewpie 04-05-2004 05:50 PM

xawtv's recording capabilites are pretty limited, you should focus on using a dedicated application, in particular mencoder, which comes with more than worth the trouble reading some of the docs.

Inexactitude 04-05-2004 05:56 PM

Thanks, I didn't know that mencoder could record straight from a tv capture card. I'm going to look into it.


acid_kewpie 04-05-2004 06:04 PM

this is a really basic perl wrapper i sometimes use to quickly encode from tv

use strict;
use Getopt::Long;

my %opts=();
GetOptions( 'c=i' => \$opts{'c'}, 'l=i' => \$opts{'l'}, 't=s' => \$opts{'t'}, 'd=s' => \$opts{'d'}, 'q' => \$opts{'q'} );

print "setting volume...";
system("aumix -r 10 -l R -i 10");
print "Done\nattempting to free /dev/video...";
system ("fuser -INT -k /dev/video0");
sleep 1;
print "Done\n";
my $quiet = $opts{'q'} ? " 2&>1 > /dev/null" : "";

my $command = "mencoder tv:// " .
"-tv driver=v4l:width=768:height=576:alsa:amode=1 " .
"-ovc lavc -oac lavc " .
"-lavcopts acodec=mp3:abitrate=64:vcodec=mpeg4:vbitrate=600:vme=5:vhq " .
"-vf pp=lb,crop=720:544:24:16,scale=480:-2";

my $channel = $opts{'c'} ? " -tv channel=" . $opts{'c'} : "";
my $endpos = $opts{'l'} ? " -endpos " . $opts{'l'} : "";
my $dir = $opts{'d'} ? $opts{'d'} . "/" : "";
my $file = $opts{'t'} ? " -o ". $dir . $opts{'t'} . ".avi" : "";
print "running " . $command . $channel . $endpos . $file . $quiet . "\n";
system($command . $channel . $endpos . $file . $quiet);

l = length in seconds, c = channel frequency, t = title, d = directory, q= quiet

Inexactitude 04-05-2004 06:10 PM

Thanks for the script, but do you know how I could make mencoder stream from the composite video rather than from the televsion tuner?

Thanks a lot.

acid_kewpie 04-05-2004 06:12 PM

just change the tv options:

"man mencoder" says:

input=<value> Specify other input than the default 0 (Television) (see output for a list)

kev82 04-05-2004 06:19 PM

i found that when recording with mencoder the audio went out of sync quite quickly, the only application i found that had good sync was streamer (comes with xawtv) but this was quite a while ago and mplayer has probably improved since.

Inexactitude 04-05-2004 06:21 PM

I'm now using mencoder, but I'm still getting silent avis. The sound is coming out of my speakers though, so where can I be going wrong here? I don't think it's anything in the mixer, but I'll have a look at it and makes sure everything is okay there.

Thanks for any help.

Inexactitude 04-05-2004 06:50 PM

Right now it seems that xawtv is better because it gives me a better picture (albeit upside down), while mencoder is giving me a black and white picture that is doubled, with a huge green strip at the bottom of the screen. Neither are giving me any sound. It can't be that I have things muted because I can hear the sound on my speakers. Can it be that the xawtv or mencoder aren't trying to get the sound from the sound card and rather from the tv tuner card?

Thanks for any help.

Inexactitude 04-06-2004 02:55 AM

Does anyone know how I can get it to record the sound from the card? Any help is appreciated.

KWTm 05-02-2004 07:09 PM

Inexactitude: did you ever get mencoder working? In case no, here are some ideas:

If your video shows black and white with coloured bands, or if the screen is split into two half-size identical screens, or something like that, you may be using the wrong video signal encoding. Various encodings include RGB, YUV, and other formats like that. They might correspond to (for example) "specify Red for the whole image, then specify Blue for the whole image" or "specify Red, Blue, Green for this pixel, then move on to next pixel" which might explain why you're seeing what you're seeing.

[Addendum: when I play my North American NTSC signal but tell mplayer that I have a PAL signal, I get black&white with a green band across the bottom.]

Not sure why your video is upside down, but I think there's a "flip" option that you can put into the config file. "man mplayer" for details.

If you're not getting sound, here are two possibilities:
1. You should be plugging the sound output from your TV card into the Line-In jack, not the Microphone jack, of the sound card. Actually, I don't know why they are two different inputs, but there you have it.
2. Have you set your recording source (using aumix, alsamixer, etc.) to Line-In? Apparently mplayer will record from whatever the current sound source is, and you have to say "record from microphone" or "record from my CD player" etc.

Inexactitude 05-02-2004 10:55 PM

Thanks a lot man. The black and white with a green bottom is exactly what I get. So next I'm recording video I'll just specify ntsc (I can just do this on the command line right?).

I fixed my sound problem. All I had to do was specify my sound device as /dev/sound/adsp instead of /dev/dsp.


KWTm 05-05-2004 08:26 AM

AviCap works for me! (for mencoder: try setting NTSC as format)
In mencoder, to set NTSC for norm, try using the "-tv norm=NTSC" option, as in:

mencoder -tv norm=NTSC:driver=v4l:otheroption=othervalue:blabla=bla

(That's just a partial sample command line; add other command-line arguments as appropriate.)

Also, I have been experimenting with AviCap, and for the first time I was able to correctly record video (with audio), and do it with timer as well. At first I was put off by their home page at which did now show any "news" after last summer (so I thought that the project was stalled/dead and should be avoided). Actually, I was surprised by how simple the interface was, and that it worked. It works with xawtv, and I already had xawtv up and running. I even tested it to record 1 minute of TV at a given scheduled time, but I don't have enough space on my hard drive to record a full TV show.

After getting the AviCap configuration menu by right-clicking on the main screen, I got it working with my ATI TV Wonder VE card here in the USA by setting the following:

Device: "Color Mode = NTSC" , "Capture Color Space = YV12"
Video: "Current format = Uncompressed YV12"

You might have different settings depending on your own circumstances. This gives me huge uncompressed AVI files that I have to compress afterward with mencoder:

"mencoder -ovc lavc -oac mp3lame -o myrecording.mpg myhugerecording.avi"

I tried setting AviCap to use various codecs to compress while it was recording, but it couldn't find the right files. I'll continue to experiment. (I'll be out of town for the next few days, so it may take a while.)

Inexactitude 05-05-2004 05:07 PM

Good. Maybe I'll take a look at it myself since I'll probably be working on a couple of old vhs tapes this weekend. Thanks for the bit about ntsc though, that is almost definetly why I was having problems with mencoder in the first place. Using mencoder instead of xawtv really helps me out because the video that xawtv was producing was having problems with transcode, so I had to mencode it first anyway, which resulted in a serious degradation of quality.

All times are GMT -5. The time now is 03:24 PM.