Re: resetting bbtv card v4l2
Christian Iversen <[email protected]>
| Newsgroups | gmane.comp.video.transcode.user |
|---|---|
| Message-ID | <[email protected]> |
ted morris wrote: > > Greetings, > > I would like to capture video w/o having to reset the card(s) with > awtv,tvtime, etc.,etc. > through X. > > It can be done with mencoder so I am assuming there must be some 'trick' > to doing > it with transcoder. As claimed by a student over here the mencoder > command looks > like this: > > mencoder -ffourcc XVID -oac lavc -ovc lavc -lavcopts > vcodec=mpeg4:mv0:trell:v4mv:vbitrate=3000:ildct:aspect=16/9:acodec=mp2 > -tv driver=v4l2:norm=ntsc:input=2:adevice=/dev/dsp:width=720:height=480 > -o /videos/test.avi tv:// > > Here is a command I have been using for quite a while which captures > perfectly the > way I want but still requires starting x, running tvtime (for example), > then closing x: I used a very similar transcode command a couple of years ago for realtime compression of TV feeds. I compiled a very small utility called v4lfreq. I didn't write it, but I've attached the source (v4lfreq.c) to this mail so you can give it a try. Other parameters than the frequency (tv mode, PAL/NTSC, etc) can be set with the command-line tool v4l-conf (I think that's the name anyway, it's been a while). Hope it works for you. Don't give up, I've done it for years, so it's definitely possible. -- Med venlig hilsen Christian Iversen
v4lfreq.c
(text/x-csrc, 1.5 KB)
/* channelchanger.c 2002/08/21 * * Bill Eldridge, Radio Free Asia, 2002, GPL (see www.gnu.org) * http://techweb.rfa.org/staff/bill * [email protected] * * Very simple program to change channels (well, "frequencies") * on a video device. * * Requires the device not be in use or that it be v4l2 * * Has NOT been tested well. Use at your own risk. * Specifically, you might want to mute audio between * changes, etc. * */ #ifndef CONFIG_WIN32 #include <unistd.h> #include <fcntl.h> #include <sys/ioctl.h> #include <sys/time.h> #include <termios.h> #include <sys/resource.h> #endif #ifdef __BEOS__ #include <OS.h> #endif #include <time.h> #include <ctype.h> #include <string.h> #include <stdio.h> #include <linux/videodev.h> #include <stdlib.h> int video_fd; int ret; char v4l_device[40]; unsigned long new_freq; int main(int argc,char *argv[]) { if (argc > 2) strcpy(v4l_device,argv[2]); else strcpy(v4l_device,"/dev/video0"); printf("v4l_device: %s\n",v4l_device); if (argc > 1) { new_freq=(unsigned long)(atof(argv[1])*16.); } else { printf("Usage: channelchanger <frequency> [videodev]\n;"); exit(-1); //new_freq=196.250*16.; } video_fd = open(v4l_device, O_TRUNC); //Same as O_NOIO if (video_fd < 0) { perror(v4l_device); printf("Error: %d\n",video_fd); exit(-1); } printf("new_freq: %6.3lf\n",(double)new_freq/16); ret = ioctl(video_fd, VIDIOCSFREQ, &new_freq); printf("Result: %d\n",ret); return(ret); }