INDEX  F.A.Q.  SEARCH  LATEST POSTS     Rules  Register  Profile  Private messages  Login


Login:   Username:  Password:   Log me on automatically    
Register I forgot my password I forgot my username Resend the activation key

Converting VHS to DVD under Linux HOWTO

Forum Index -> Video -> Linux Printer-friendly version
Reply to topic
Author Message
danboid
Member


Joined: 20 Oct 2005
Location: Rochdale, United Kingdom

Post Posted: Aug 24, 2006 14:53 Posts Comp View users profile Send private message Reply with quote

Converting VHS to DVD under Linux HOWTO

by Dan MacDonald, 24th August 2006

This document assumes you have:

A computer with a fast CPU (2Ghz+ if you want to encode straight to MPEG2 in software with no dropped frames) running Linux with at least 10GB free drive space.

Basic knowledge of Linux (how to install programs, use the console etc.)

A VCR

A video capture card supported by Linux (see http://linuxtv.org/v4lwiki/index.php/Main_Page )

A DVD burner

The programs tvtime, varsha, k3b and mencoder (which is part of mplayer)

You may also need a SCART to COMPOSITE cable and a stereo RCA to 3.5mm jack audio cable

The best way to capture analogue video under any operating system is with a firewire analogue video adapter such as Canopus ADVC 110. This supposedly gives much better picture quality than most of the PCI capture cards but these adapters are still quite expensive at the time of writing. If you plan to do a lot of analogue video capture then it may well be worth the extra cost. Under linux you could then just use dvgrab to capture from one of these but I'm not covering that method here.

The first step, of course, is to connect your VCR to your PC. Most TV capture cards have three types of video input: s-video, composite (the yellow one) and TV aerial. s-video gives the best quality of the three so use that if you can. I have an Avermedia TV Capture 98 PCI capture card which is based on the bt878 chipset. The picture I get with this card is quite grainy and I hear that the saa713x chipset capture cards are supposed to be much better- see the v4l2 wiki link above for card recommendations and compatibility. Another thing about this card is that I couldn't get it to find my VCR signal through the aerial connector and so I had to use a SCART to composite cable.

After plugging your VCR into your PC (including running an auxiliary cable from your VCRs sound outputs to your PCs mic in) insert a VHS tape, push play and start tvtime to check you are getting a picture and sound. If you are trying to get a picture through an aerial cable then you will probably have to scan through the channels but this isn't normally neccessary with composite and s-video. If there is no sound then you will need to open your mixer program (like alsamixer) and turn up the mic input levels.

From here on I'll be talking about using tvtime but if you have xdtv (xawdecode) installed you can use that instead to preview your analogue video input. I'm using mencoder here as I haven't yet worked out the exact settings to capture directly to a DVD-compliant MPEG2-PS file using xdtv, which would be a much nicer way of doing things for GUI fans. Also, if your computer isn't fast enough to be encoding direct to DVD res MPEG2 under mencoder then you'd be better off capturing your footage under xdtv to a MJPEG format avi file. MJPEG avis can be loaded into both Cinelerra and DeVeDe.

Once you have a picture with sound under tvtime then you are ready to start capturing. If your tape is at the right point then you can shut tvtime now. Open up a console, change into the directory where you want to save your video (you will need a few GB free if you're doing a full tape) and then copy/paste one of the following three commands into that console

PAL LOW (VCD QUALITY) RES CAPTURE

mencoder -tv norm=PAL:driver=v4l2:width=352:height=288:input=1:fps=25 tv:// -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf pp=lb/ha/va/dr,hqdn3d,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=900:vrc_maxrate=1500:vbitrate=1300:keyint=15:acodec=mp2:abitrate=192:aspect=4/3 -o capture.mpg

PAL MEDIUM (SVCD QUALITY) RES CAPTURE

mencoder -tv norm=PAL:driver=v4l2:width=352:height=576:input=1:fps=25 tv:// -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf pp=lb/ha/va/dr,hqdn3d,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1500:vrc_maxrate=3000:vbitrate=2500:keyint=15:acodec=mp2:abitrate=192:aspect=4/3 -o capture.mpg

PAL HIGH ('DVD' QUALITY) RES CAPTURE

mencoder -tv norm=PAL:driver=v4l2:width=720:height=576:input=1:fps=25 tv:// -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf pp=lb/ha/va/dr,hqdn3d,harddup -srate 48000 -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 capture.mpg

As soon as you push enter the capture process will begin, to end it push CTRL+C.

It is important to note that the above commands are for capturing PAL (European) video from a composite input. If you use NTSC videos (like in America and Japan) then you have to change the norm value to ntsc, the fps value to 29.97 and you would use these width/height values instead:

720 x 480 high res

352 x 480 medium res

352 x 240 for low res

If you're capturing through the aerial, change the input value to 0 (or 2 for s-video).

'-vf pp=lb/ha/va/dr,hqdn3d,harddup' is the video filter setting to clean up a grainy picture. If you have a better quality capture card than me then you should be able to get away with just '-vf harddup' instead. Using fewer filters will mean less stress on your CPU of course.

The main value you may be interested in altering is vbitrate. You can lower the bitrate to shrink the size of the video file and fit more video onto your DVD but this of course also degrades the quality and puts greater strain on the CPU when encoding. Don't expect all DVD players to be able to handle a vbitrate greater than 8000 though.

On my AthlonXP 2000 (which is of course really 1.7Ghz) I can capture a full 25fps @ 352x576 with stereo sound and no dropped frames on certain footage but if there is lots of motion it tends to average about 20fps which is also the framerate it maxes out capturing at the high res setting.

Now that you have an .mpg file of your video you should try playing it under mplayer or xine to check that it is OK. If its fine then you can load varsha and create a DVD iso file with it which in turn can be burned with the burning program of your choice such as k3b.

If you want to know more about mencoder's options then you should read the manpage or the online documentation at

http://www.mplayerhq.hu/DOCS/HTML-single/en/MPlayer.html

Good luck!

dan


Last edited by danboid on Oct 01, 2006 10:50, edited 3 times in total


tekkieman
Grizzled


Joined: 23 Mar 2004
Location: Over the hill

Post Posted: Aug 24, 2006 21:37 Posts Comp View users profile Send private message Reply with quote

Thank you for this great info. I will use this as a guide and test it sometime soon. My capture card is also a BT878 chipset, so I hope for good results. I just happen to have a bunch of Hi-8 I need to capture sometime in the very near future.
_________________


danboid
Member


Joined: 20 Oct 2005
Location: Rochdale, United Kingdom

Post Posted: Aug 25, 2006 02:53 Posts Comp View users profile Send private message Reply with quote

np tekkieman! Its good to know I've already saved at least one person potentially days of hassle and experimentation like I went through.

As you can see, the process I described above is entirely graphical, point+click apart from the actual capture part. Before being forced into figuring out that mencoder command I tried a few different mencoder GUIs but none of them worked, at least not for doing what I wanted. It would be good if tvtime could integrate capture features.

If anyone knows of a nice mencoder GUI for Linux that can capture from a v4l device to DVD MPEG2 (and VCD MPEG too pref.) that WORKS then please let me know!

Thanks!


danboid
Member


Joined: 20 Oct 2005
Location: Rochdale, United Kingdom

Post Posted: Aug 30, 2006 16:46 Posts Comp View users profile Send private message Reply with quote

I just edited the above HOWTO to reflect that you probably need a 2Ghz+ CPU if you want to record straight to DVD MPEG2 without dropping any frames under most conditions.

There is a graphical analogue video capture tool for Linux that works (a bit) - gv4l, but it uses transcode not mencoder . If I use its ffmjpeg codec and turn the de-interlace option on I get smooth, fantastic image quality captures at up to 720x576- the problem is that the sound is out of sync. I've read that this could be because it is compressing the audio so I've tried using 'ffmjpeg,wav' 'ffmjpeg,raw' or 'ffmjpeg,pcm' in the 'encode codec' box as I read somewhere but that doesn't work so I've wrote to the programs author to see if he can help.

I'd really like to get this sorted as this would seem to be the best option for transferring some analogue video to DVD under Linux for people like me whose CPU isn't quite fast enough for real-time MPEG2 encoding. Soon as I we get this sorted out I'll update this HOWTO with a second method with 2 encoding steps (gv4l -> DeVeDe) instead of one.


courtrrb
Member


Joined: 24 Apr 2003
Location: United States

Post Posted: Aug 31, 2006 09:48 Posts Comp View users profile Send private message Reply with quote

This is the same problem I had with gv4l. Audio out of sync. After weeks & week of trying everything writing the author (I did get a respose) I still couldn't get it to work correctly.

I finally gave up on it. I then bought a PVR-250 card & did a dual boot with KnoppixMyth.
I capture directly to DVD format with no dropped frames at a full 720x480 even accross a network.

Now When I need to capture any video I reboot in KnoppixMyth and do my capture.


danboid
Member


Joined: 20 Oct 2005
Location: Rochdale, United Kingdom

Post Posted: Sep 01, 2006 14:31 Posts Comp View users profile Send private message Reply with quote

Great news - I found it!!!

Yes, there is a graphical analogue video capture tool for Linux that really DOES work, its called

xdtv

which is short for xawdecode. As you might guess from the name, it is basically a souped-up XawTV with many more options for video capture. I find it strange that xdtv is five years old now but not one of the hundreds of web sites, forums and documents about Linux video capture that I read mentioned this program. Hundreds (thousands) of people have read this guide in the last few days and it would seem none of those people knew about it either. The other strange thing about this is how I found it- under the Multimedia/Video section of kde-apps.org and it is obviously neither a QT or KDE app! smile.gif

I'm happy with my Linux video setup now as xdtv can capture perfect quality 704x576 MPEG2 or MJPEG video @25fps on my AthlonXP with NO frames dropped- yeah! I now just need to see if I can get it to produce DVD compliant MPEG2 files...


uth
Member


Joined: 11 Oct 2005
Location: United States

Post Posted: Sep 07, 2006 10:06 Posts Comp View users profile Send private message Reply with quote

Thanks for the guide. My only comment is that capturing straight to mpeg will make the video tougher to edit, if you want to remove commercials, or extra stuff you don't want. (many editors botch the a/v sync with mpegs)

If you capture to something other than mpeg, then you can do it on a slower machine too

For capturing, I use mjpeg tools:

http://mjpeg.sourceforge.net/

It comes with a lavrec command that can be used to capture video to an avi. It can then be edited with the included glav tool or with something like avidemux.

mjpeg tools also comes with tools to convert to MPEG, and various filters, but I find mencoder is faster for this task.

I've tried various programs for this task, and the above is what works best for me so far.


oldcpu
Member


Joined: 26 Aug 2005
Location: Europe

Post Posted: Sep 07, 2006 14:58 Posts Comp View users profile Send private message Reply with quote

uth wrote:
Thanks for the guide. My only comment is that capturing straight to mpeg will make the video tougher to edit, if you want to remove commercials, or extra stuff you don't want. (many editors botch the a/v sync with mpegs)
I used to find this too, but my experience with dvbcut (which I mentioned in another thread on this subject) has been that it does truely an excellent job of retaining audio-video sync. Do you experience problems with it also?

danboid
Member


Joined: 20 Oct 2005
Location: Rochdale, United Kingdom

Post Posted: Sep 07, 2006 15:35 Posts Comp View users profile Send private message Reply with quote

I couldn't get either lavrec or glav to work but I agree that MJPEG would be a better choice of capture format if you wanted to edit too. In fact thats the format I've been capturing to under xdtv before I use DeVeDe to make a DVD image out of the avis. I can confirm that MJPEG avi's captured with xdtv open fine under Cinelerra

I wrote to both the author and mailinglist for xdtv asking if anyone knew the correct capture settings to record to a DVD compliant MPEG2-PS file but I've had no response. The plan was to re-write this tutorial based around xdtv but looks like that will have to wait until someone does some experimentation to discover the correct settings.

It looks like xdtv/ xawdecode still hasn't been added to the list of Linux video tools yet- might have to write another mail to the maintainers as I think its an important addition/ big omission.


suoko
Member


Joined: 22 Sep 2006
Location: Italy

Post Posted: Sep 23, 2006 12:03 Posts Comp View users profile Send private message Reply with quote

I just wanted to say that mpegs created with mencoder the way presented in this thread, are almost ok to be imported in mainactor.

There are only some "minor" problems which I reported in an unofficial mainactor forum.

http://mainactor.flavor8.com/index.php?topic=25.msg44#msg44

and thanks for this howto


danboid
Member


Joined: 20 Oct 2005
Location: Rochdale, United Kingdom

Post Posted: Oct 01, 2006 11:02 Posts Comp View users profile Send private message Reply with quote

I made a small update to this document today just to explain why I'm using mencoder and tvtime instead of replacing them both with just xdtv

mairambija
Banned


Joined: 21 Dec 2006
Location: US

Post Posted: Dec 21, 2006 02:02 Posts Comp View users profile Send private message Reply with quote

visit SPAM and transfer your home video tapes to dvd. You can get a pretty good conversion at a reasonable price from a lot of places. But what are most of these companies lacking? Care and attention to detail! Other ways you get totally amateurish product done with domestic equipment.[/url]

trents
Member


Joined: 13 Feb 2007
Location: United States

Post Posted: Feb 14, 2007 09:52 Posts Comp View users profile Send private message Reply with quote

Okay,

danboid said you need to install "the programs tvtime, varsha, k3b and mencoder (which is part of mplayer)" in order to capture VHS onto DVD media. The hardware is set up and I've been converting these tapes to DVD in Windows but I want to do it in linux.

Having trouble getting off the ground here. Via synapitc package manager I installed all the programs danboid suggested in my Ubuntu 6.06 system with a SAA7134 based video capture card. Varsha don't even show up in the Applications menu. TVtime does show up, however, but when I click on the menu icon, TVtime doesn't load. Danboid says the starting point is getting a signal in TVtime. Well, I can't even get TVtime to open. Can anyone help?

Thanks, Steve


kikou87
Member


Joined: 24 Apr 2007
Location: Italy

Post Posted: Apr 25, 2007 05:12 Posts Comp View users profile Send private message Reply with quote

Hi Danboid,

I have used mencoder in the way you described; the video quality it's pretty good, but the audio gives me some problem of noise. cry.gif To give you an idea of this, it is similar to a mp3 with a very low bitrate.
Which option of mencoder must I modify ?

Thank you so much


kikou87
Member


Joined: 24 Apr 2007
Location: Italy

Post Posted: Apr 25, 2007 05:49 Posts Comp View users profile Send private message Reply with quote

I have solved this audio noise problem, adding: alsa:audiorate=128000 smile.gif

Thanks however!


flebber
Member


Joined: 03 Jun 2007
Location: Australia

Post Posted: Jun 04, 2007 07:06 Posts Comp View users profile Send private message Reply with quote

Quote:
It is important to note that the above commands are for capturing PAL (European) video from a composite input


Is there any diffrence in PAL (Australian) fps. I have tried to copy using the commands but am getting poor picture quality.


Linoob
Member


Joined: 04 Oct 2008
Location: United Kingdom

Post Posted: Oct 04, 2008 17:24 Posts Comp View users profile Send private message Reply with quote

I found this HowTo really helpful. The only problem I've had is that I couldn't record audio. I'm using a Hauppauge ImpactVCB capture board, and feeding the audio into the Line In jack on my motherboard, and I'm running Fedora 9.

The problem was that the alsa mixer wasn't set to capture from Line In. Entering

amixer -c 0 sset Line cap

solved it.

Thanks.


Reply to topic All times are GMT - 6 Hours
Forum Index -> Video -> Linux Page 1 of 1





You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Jump to:  
Display:   
About   Advertise   Forum Archive   RSS Feeds   Statistics