Ok, i think i got it now. Looks like this is a video capture program for tv tuners, right? I know that video capture is still pretty new in Linux so i guess alot of ppl just dive right in.
Ok, i think i got it now. Looks like this is a video capture program for tv tuners, right? I know that video capture is still pretty new in Linux so i guess alot of ppl just dive right in.
Linux Tidbits | Hobbyist: archlinux
ok here it is:
This will record the audio and video together. The problem is the audio is still distorted, however really it isn't it seems that if it is played in vcl you can slow it down and it comes out fine. It is as though it is recorded at a slightly faster speed, and played back consequently the same way, faster. I don't have any idea for fixing this issue, but the good news is this can be done!Code:mencoder -v tv:// -tv driver=v4l2:device=/dev/video0:input=1:adevice=/dev/dsp1:norm=ntsc -ovc raw -oac pcm -of avi -o experimentaltest.avi
Shane
Ok, here is the final edition:
This is what I'm using. I had to add the -speed .7 option to slow down my video it was playing back too fast and the audio was distorted. I hope someone can use this to help.Code:mencoder -v tv:// -tv driver=v4l2:device=/dev/video0:input=1:norm=ntsc:adevice=/dev/dsp1 -srate 48000 -speed .7 -ovc lavc -lavcopts vcodec=mpeg4 -oac mp3lame -of avi -o $videoname.avi
Shane
Where there is a will there is a way. Last one worked sort of, but this one seems to work well, I did a short clip, burned it to DVD (RW) and it seemed to work very well. I ended up having to record the sound with arecord, instead of mencoder, mencoder refused to record sound for me. Here is my script:
This is posted as a help, please be careful using it as you could potentially overwrite videos you already have. It also creates very large files you will need a lot of extra space for recording videos. Any questions feel free to ask and we will see what we can do to help.Code:#!/bin/bash read -p "What do you want to name the video? :" videoname read -p "How many minutes for the video? (guess high if in doubt) :" time read -p "Where do you want the video saved to? (full path place (no trailing slash)) :" location b=$((time*60)) mencoder -v tv:// -tv driver=v4l2:device=/dev/video0:input=1:norm=ntsc:width=720:height=480:fps=29.97 -nosound -ovc lavc -lavcopts vcodec=mjpeg -of avi -o /home/$USER/$location/$videoname.avi & arecord -D hw:1,0 -c 2 -r 32000 -f S16_LE -t wav /home/$USER/$location/$videoname.wav & sleep $b killall -9 mencoder arecord mencoder -audiofile /home/$USER/$location/$videoname.wav -oac mp3lame -ovc copy /home/$USER/$location/$videoname.avi -o /home/$USER/$location/merged$videoname.avi exit
This is meant strictly as an addition to this thread, it isn't meant to steal from this thread. I have the same card, and therefore figured all this info should just go in one place.
Shane
Thanks buntunub for helping me get my card working properly.
Hi Shane2peru
Not sure if you have sorted out your problems yet but I have long struggled down this path and you may find some of my results usefull, else ignore: I made a file called record-tv, then chmod +x to make it exacutable The opening a word editor added the following:
__________________________________________
#!/bin/bash
CH=$1
BITRATE=$2
TIME="$3"
FILE="$4"
TARGETDIR=/mnt/win_d_linux/tv
NAME="`/bin/date +%Y%m%d_%H%M`_ch"$CH"_$FILE".avi.pcm
#video1 = asus
mencoder -tv driver=v4l2:device=/dev/video1:adevice=/dev/dsp2:audiorate=32000:width=640:height=480:input=0: normid=0:channel=$CH:chanlist=us-cable -vf yadif -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=$BITRATE:keyint=30:vhq:v qmin=3:vqcomp=0.7:aspect=4/3,v4mv,q=5 -oac pcm -endpos $TIME -o $TARGETDIR/$NAME tv://
__________________________________________________
I put this in a bin directory in my home folder. So I just open a terminal and type
record-tv the-tv-channel-number the-bitrate-I-want(usually 3800) the-length-to-record a-file-name
e.g
record-tv 20 3800 00:30:00 naruto-anime
This record channel 20 for 30 minutes
________________________________________
an explanation of the values used.
I have 1 audio card, 2 tv cards.
My saa7133 is my 2nd tv card. so it gets the index /dev/video1. The first card gets video0.
The Sound part means my audio card is dsp0, the 1st video card's sound is dsp1 so my saa7134 card is dsp2. You will have to change these numbers depending on your setup.
*You have to use audiorate=32000 as the tv soundcard is not 48000.
Mencoder assume this is the default. Your audio comes out really funny. I used gnome alsa mixer to set the recording levels on the card (once only, kmixer does not have this option). It hasn't changed in last 4 years.
If you run mencoder its initial screen tells you the cards input and norm numbers and what they mean. Norm 0 for me is NSTC. input 0 is the tv. So if you want to record a video tape you would change input to 1 (for me) to record composite in.
_______________________________________
If you have a good source you may select to copy to the hard drive first then apply the program again with the codec you want and the deinterlacing you want. Especially if you have a slower pc. I selected msmpeg4v2 a long time ago for compatability reasons. Other than file size it seems to give me quality at the right speed. My older pc's struggle with live recording in mpeg4 xvid or h264. If I was really interested I would record raw then run a script to convert to h264. Note if you have a slower pc then yadif the deinterlacer may just push it to far, I generally cant do yadif and convert to mp3 with my older pc's.
________________________________________________
mencoder for me has been the better solution out of the other choices mentioned - milage may vary,
_________________________________________________
I run a script every now and then to compress the audio. I have copied it below for you. The only requirement is you install a program called chcase.
Note if you dont need to or dont want to bother, then remove the avi.pcm in the name and just leave it .avi (above in the record-tv script)
so from a terminal I type this:
for nam in *avi.pcm; do nice mencoder "$nam" -o "$nam.converted-avi" -ovc copy -oac lavc -lavcopts acodec=libmp3lame:abitrate=224; done; chcase -x 's/avi.pcm.converted-avi/avi/' *avi.pcm.converted-avi
This will go through the directory and change any .avi.pcm file. Of course if you recorded raw you can put all your favourite mencoder options in here and let it run for the number of days needed to convert. Else if you have the latest hottest fastest pc with a volume knob that goes to 13 then you can replace the original pcm to the above oac options.
Lastly when you are sure you have done the right stuff you can:
rm -f *.avi.pcm
PLEASE PLEASE PLEASE PLEASE note the last command has the highest potential for an outcome that ends in tears and holes punched in walls.
Hope that was helpfull. The terminal is your friend and something I find very powerfull, the windows grafic stuff cant do this as easily or quickly
__________________________________
Hope that helped.
Shawn
Note just realised you need to make sure your saa7134 has its alsa option turned on. Depending on your computers flavour its done in
/etc/modprobe.conf
I copied the relevant section below
options saa7134-alsa index=2
options saa7134 noninterlaced=1 vbibufs=32 tsbufs=32 card=25,25,25,25 tuner=43,43,43,43 vbi_nr=1,2,3,4
Note the "options saa7134-alsa index=2" index sets the cards sound to dsp2. change yours here to suit. Note your sound card should be index=0
Generally auto detect works well so you probably just want "options saa7134 noninterlaced=1 vbibufs=32 tsbufs=32"
Thats about all the mysterious secrets I can think of for recording on linux. Its pretty simple when you understand that you just have to tell it how you want to set up the hardware. I have found not setting these options usually lands me in trouble. When its set its frozen in stone and my scripts I write work (well have worked for the last 10 years)
Last edited by shawnvdm; July 27th, 2009 at 12:38 AM. Reason: keep loosing my formatting for some reason. Think firefox noscript caused some hiccups
Just carrying on, If you are interested in recording non-interlaced video (compresses better etc) then you can change the following
set mencoder width=720:height=288
then instead of ydif
-vf dsize=768:576
and add outfmt=yv12
You loose a small bit of quality but etc etc. Mencoder has a phenominal amount of options, you tweak acording to your computers ability.
Any way hope this is all usefull. It was interesting reading about your struggles. I hope to see some final solutions and learn from your success.
PS I still like the look of yadif over this so I don't use it. Note yadif itself has a number of options as well depending on processor power.
Last edited by shawnvdm; July 27th, 2009 at 12:59 AM.
shawnvdm
Wow, thanks for the wealth of information! I did finally get it working and failed to post my results here, at any rate I will do that now. I don't pretend to understand all the options and everything that I used in my script, it was a long drawn out process of trial and error, mostly error.![]()
I cut out a lot of the extra junk I had left in my script with it commented out (right under opts 1 (I made it bold) is the line that is working for me). You really have to pay attention to what is commented out and what isn't. At any rate that gives me the quality that I want to turn it around and create a DVD out of it. I'm using this on a pretty regular basis now. I'm teaching Sign Language and recording the classes, and putting them on DVD with the out dated equipment that I have. Works like a charm. When I have to re-setup everything again in the future, I will have to re-visit this thread to re-learn how I did it all. So, all notes and information here is helpful. Thanks for sharing!Code:#!/bin/bash #This is now working don't mess with this script! It is a lot of work to get it back to what we have now. read -p "Which device? TV=0 Composite1(RCA jack)=1 Svideo=3 (only from Camcorder): " n read -p "What do you want to name the video?: " videoname read -p "Where do you want the video saved to? (/home/$USER/ is assumed (type directory name without trailing slash/)): " location read -p "How many minutes for the video? (guess high if in doubt hh:mm:ss or mm:ss): " time read -p "Hit play then hit enter" null b=$((time*60)) function sound { arecord -D hw:1,0 -c 2 -r 32000 -f S16_LE -t wav /home/$USER/$location/$videoname.wav & sleep $b && killall arecord } ####################### Primary command this is ##1 Number ONE! ###################################### ### Any trials and errors must be done below this line! ############This will be the opts disk that I burn. Doing the same video twice. To see if there is any difference. #mencoder -tv norm=NTSC:driver=v4l2:width=720:height=480:input=$n:fps=30000/1001:alsa:adevice=plug.saa7134 tv:// -endpos $time -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf pp=lb/ha/va/dr,hqdn3d,harddup -noskip -skiplimit 4 -mc 0 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1500:vrc_maxrate=8000:vbitrate=7000:keyint=15:acodec=mp2:abitrate=192:aspect=4/3 -o /home/$USER/$location/$videoname.mpg #this one seems clearer than the old avi one I was using. ####################### ^^^^^^^^^^^^^Primary command this is ##1 Number ONE!^^^^^^^^^^^^^############################# ################## This is the no opts disk that I recorded, keep for the testing purposes, don't change this line. #opts 1 - didn't really notice a difference with this and the options: ,harddup -noskip -skiplimit 4 -mc 0 mencoder -tv norm=NTSC:driver=v4l2:width=720:height=480:input=$n:fps=30000/1001:alsa:adevice=plug.saa7134 tv:// -endpos $time -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf pp=lb/ha/va/dr,hqdn3d -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1500:vrc_maxrate=8000:vbitrate=7000:keyint=15:acodec=mp2:abitrate=192:aspect=4/3 -o /home/$USER/$location/$videoname.mpg #opts 2 - came out a shorter video 20 min segment, was only 14min. #mencoder -tv norm=NTSC:driver=v4l2:width=720:height=480:input=$n:fps=30000/1001:alsa:adevice=plug.saa7134 tv:// -endpos $time -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf pp=lb/ha/va/dr,hqdn3d -noskip -skiplimit 4 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1500:vrc_maxrate=8000:vbitrate=7000:keyint=15:acodec=mp2:abitrate=192:aspect=4/3 -o /home/$USER/$location/$videoname.mpg
Shane
Sorry I haven't been back at this thread in a while, and very much appreciate all the inputs - thats the beauty of the Open Source world! I hope this thread has been a help to all and please continue updating as new info becomes available.
I have a kworld pvr-tv 7134se, all channels working from scratch in TVtime but no sound, i have an onboard sound card and a 5.1 pci sound card, I'm using the last one, this tv tunner doesn't have audio output so i can't plug in a wire to the soundcard audio input. I tryed with "sox -r 32000 -2 -t alsa hw:1,0 -t alsa hw:0,0" but no success "sox FAIL formats: can't open output file `hw:0,0': snd_pcm_open error: Device or resource busy". I'm totally new on this OS so please give me some help. Thanks in advance for your time guys.
hello, I just bought this card and went through the steps, up until you say to start tvtime... this same thing happened before the steps as after...
tom@tom-desktop:~$ sudo tvtime
Running tvtime 1.0.2.
Reading configuration from /etc/tvtime/tvtime.xml
Reading configuration from /home/tom/.tvtime/tvtime.xml
videoinput: Cannot open capture device /dev/video0: No such file or directory
Segmentation fault
tom@tom-desktop:~$
i'm sure its probably something small and stupid, so any help would be great
Bookmarks