LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-27-2006, 06:47 AM   #1
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 66
VHS to hard disk : almost there


Hello,

I want to record some old VHS tapes I own to hard disk with as good a quality as possible.
My computer is a 1GHz VIA Nehemiah (said to be roughly equivalent to an Athlon 800). My capture card is a Pinnacle PCTV Stereo and I live in France (capture in PAL).
So far, I use mencoder to record, and avidemux to post-process, but I'm open to suggestions regarding alternative free software, if needed.

First, I'm a little lost on the basics.

I've read on Internet that PAL is 720x576, which has rectangle (D1) pixels. I've read further that computers should change this to 768x576, so as to get 4:3 with square pixels. Next, I'm told that TV is "overscan", in the sense that part of the picture is never displayed; indeed, when I try and record the whole recordable area, the top and bottom pixels are awfull (some data is obviously encoded there), with ever-shifting colors, and the left and right sides are sub-optimal (tinted, or just gray), so I want to get rid of those bad-looking borders.

So my first question is: What size should I capture in, and what size should I crop to to get rid of the "underscan effect"?

I've read that width and height should be multiples of 4 (or even 8 or 16), is that true?
So far, I capture at 384x288, which is a quarter of the "corrected" full size. I got those numbers from someone else's script, but I have the problem with the borders. Anyway, my aim is the full size (at least 640px wide).

Next, I have a problem with the recording process itself.

My computer doesn't have enough processing power to do anything fancy while recording. It seems to be fast enough to record raw data at full size, though.
So I decided I would first record with a "raw" quality (as good or as bad as the VHS source), and post-process the result in a second pass.
Based on someone else's script (again), I tried capturing 1 minute of video at 702x576 (croped to -IIRC- 702x568). With mencoder parameters "-ao copy -vo copy", I get a perfect capture, about 840MB big (for 1 minute).

This kind of video is exactly what I want to obtain: no less than 640 pixels in width. Unfortunately:
- Xine has a very hard time coping with the data flow,
- a 2h movie would take some 100GB+, which is bound to lead to problems (available space, filesystem limitations, dataflow...)
- I wouldn't dare recording a 3h or 4h movie...

Sadly, I've tried using "-vo lavc" with either ljpeg or mpeg1video codec, and each time, the computer is too slow.

So my second question is: What codec and settings would be able to reduce the raw data by half at least, without introducing noticeable recording artifacts (I mean the video must be the same quality as the source), and very fast?
Most codecs seem to try and make 2 hours fit in 800MB, whereas I would only need 2 or 3 minutes to fit in such space, so hard disk space is not that much of an issue. Speed is an issue here.


Please help me. I know computing and programming very well, but I'm at a loss where it comes to audio, video, codecs... I'm a newbie here
Thanks,

Yves.

Last edited by theYinYeti; 05-10-2006 at 09:23 AM.
 
Old 04-28-2006, 03:29 AM   #2
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Original Poster
Rep: Reputation: 66
Nobody knows?

If nothing else, please read the bold and underlined parts. Thanks.

Yves.
 
Old 04-28-2006, 05:11 AM   #3
maroonbaboon
Senior Member
 
Registered: Aug 2003
Location: Sydney
Distribution: debian
Posts: 1,495

Rep: Reputation: 48
Lot of questions

I have done this in the past, but don't recall the details. I probably used mencoder also, compressing on the fly to mpeg4, maybe as suggested in the mplayer documentation:

http://www.mplayerhq.hu/DOCS/HTML/en...ml#tv-examples

As for resolution, I do not think that PAL has a horizontal resolution, since the signal is analogue. The 576 vertical sounds right and you want 4:3 ratio.

One you have the raw data I would compress it to mpeg4 using mencoder (again). The command line should be quite similar to the TV to mpeg4 example given in the link above, except the -tv option is replaced by the name of the raw data file.

It will compress to a small fraction of the original size. You can adjust the final dimensions here also. The bitrate can also be adjusted, but in my experience the basic quality of VHS/PAL is so bad it is not worth it.

If it is essential to compress in real time you could try some of the other codecs. Maybe nuppelvideo would work. Alternatively you could scale the image to half size before encoding. VHS is so bad you would hardly notice the difference.

I think the 1MHz Nehemiah (I have one) is seriously slower than an 800MHz Athlon. More like a 500MHz Celeron. But cute
 
Old 04-28-2006, 06:17 AM   #4
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Original Poster
Rep: Reputation: 66
Thanks for the link. It is indeed very informative!
I didn't know that anything beyond 288px high would be basically redundancy. This may change the way I want to record, after all... But is it still interleaved for a VHS tape? Is 288 the limit for PAL or the limit for TV only?

I'll think about all of this.

Yves.

Last edited by theYinYeti; 04-28-2006 at 06:18 AM.
 
Old 04-28-2006, 09:21 AM   #5
maroonbaboon
Senior Member
 
Registered: Aug 2003
Location: Sydney
Distribution: debian
Posts: 1,495

Rep: Reputation: 48
I have forgotten most of what I knew of the technical details and I never knew anything about VHS recording. I just hooked up to video-in on the TV card and treated it the same as a live TV signal.

The MPlayer docs may have more information on interlacing and such things. It's certainly possible I was missing some trick to get the best possible quality. The recordings from VHS were much worse quality than analog TV recordings, even using commercially recorded tapes.

Recording from live analog TV you might see a difference between capturing at 576 and 288 if you have a good signal. Also I think recent TV cards may be a bit better than the original bt878(?) models.
 
Old 05-10-2006, 09:26 AM   #6
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Original Poster
Rep: Reputation: 66
Quote:
As for resolution, I do not think that PAL has a horizontal resolution, since the signal is analogue. The 576 vertical sounds right and you want 4:3 ratio.
That was very interesting. My TV card doesn't accept "unusual" values for the height, but does seem to accept almost anything for the width.

This made me think: I receive a 288 pixels-high signal every 1/50th seconds. However, the vertical information is interleaved, so I do actually receive a 576 pixels-high signal every 1/25th seconds (25fps). With the 4:3 ratio, that makes 768x576, but tests indicate that my computer cannot handle this.
Based on what you said about the horizontal resolution, I tried to get 384x576 images (25fps) so as to get the full frames (two combined, formerly interleaved, half-frames each time) while still aiming at the "normal" PAL resolution.
IT WORKS!! The result (displayed fullscreen with ratio 4:3) does seem to display a better image than a 384x288 recording of the same broadcast.

So I can postprocess this 2:3 video (instead of 4:3), so as to either get a full quality 768x576 picture by doubling the width, or get the low quality 384x288 picture by shrinking the height by half. This seems like a nice compromise to me.

Quote:
One you have the raw data I would compress it to mpeg4 using mencoder (again). The command line should be quite similar to the TV to mpeg4 example given in the link above, except the -tv option is replaced by the name of the raw data file.

It will compress to a small fraction of the original size. You can adjust the final dimensions here also. The bitrate can also be adjusted, but in my experience the basic quality of VHS/PAL is so bad it is not worth it.

If it is essential to compress in real time you could try some of the other codecs. Maybe nuppelvideo would work. Alternatively you could scale the image to half size before encoding. VHS is so bad you would hardly notice the difference.
For the first pass, I did not see nuppelvideo in mencoder options, so I tested several codecs and chose (lavc) MJPEG with vqscale=2 (fast good quality, it seems).
For the second pass, I still use avidemux because I can visually select the size to crop to while removing the black borders.
As for quality, it is not that bad, really, maybe thanks to the saa7134 chipset being better than the bt8x8 ones. Maybe the fact that the incoming signal is SECAM (I formerly thought it would be PAL) does count too.

Quote:
I think the 1MHz Nehemiah (I have one) is seriously slower than an 800MHz Athlon. More like a 500MHz Celeron. But cute
So true! Ever since I bought it, I've been thinking about how bad a choice it was to choose this MB and CPU... on the technical side of things. Yet at the same time, I wouldn't change it because it is indeed quite cute, and after all, it is good at what I chose it for: low power consumption

Yves.
 
Old 05-24-2006, 09:21 AM   #7
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Original Poster
Rep: Reputation: 66
Hello,

I finally managed quite well by myself, using the wonderfull URL that you gave to me:
http://www.mplayerhq.hu/DOCS/HTML-si...n/MPlayer.html
This is a must-read as it contains absolutely all one needs to get started!
Here I share my results, for those interested.

I encode video in three steps:

a/ First, I record TV/VCR with almost no compression, so that the resulting file is as good (or as bad) as the original (and 2.5GB/hour).
I'm targetting the standard PAL resolution, that is 384px in width. However, TV/VCR signal is interleaved, so the 288px height of the 4:3 picture is only half the original content at 25fps, as the TV signal is at 50fps and it takes two 1/50th-second-long half-frames to make one 1/25th-second-long frame. So I record with the unusual resolution of 384x576@25fps, which is aspect ratio 2:3.
To do that I run (input from Composite1):
Code:
$ mencoder tv:// -tv driver=v4l2:device=/dev/v4l/video0:input=1:norm=SECAM:fps=25:width=384:height=576:alsa -oac copy -ovc lavc -lavcopts vcodec=mpeg1video:vqscale=2 -o bigrecord.avi
b/ Next I choose my filters. It seems I'll be able to always use the same They're so efficient! When I apply them to the record from VHS, I get as good a picture as I would have from a DVD! In real-time! No more "snow", no more noise...
Code:
$ mplayer bigrecord.avi -vf pp=lb/ha/va/dr,hqdn3d
c/ Finally comes the time of the final encoding. As I see it, there are only 3 video formats worth being used:
- SVCD mpeg2 for compatibility with non-computer devices at the cost of a CD;
- DVD mpeg2 for compatibility with non-computer devices at the cost of a DVD, or for a very high quality result;
- MPEG 4 if compatibility is not an issue.
Those three video formats all permit 2-pass encoding, which is the way to go; I tested the SVCD format with 1 pass and with 2 (with the same target filesize), and 1-pass encoding leads to awful results on fast-moving scenes. I didn't test DVD creation so far, but I expect it should be easy to store at least 4 movies on a 4.7GB DVD.

Contrary to what I had decided at first, I use mencoder for this last step instead of avidemux. I had way too many crashes with avidemux on my big 5GB (2hours) video file, whereas mencoder is rock-solid.

Besides, contrary to what I had read before, a SVCD is not limited to 1 hour or so; it can perfectly hold a 2-hour movie, as long as you use 2-pass encoding with good optimisations, and still retain a high-enough quality (I tested with "The return of the Jedi", that I had recorded on VCR from a TV broadcast).

In this step, I add the "-mc 0" option, I add the crop, scale, expand, and harddup filters, and I choose the encoding settings. The bitrate (vbitrate) is computed according to this post:
http://forum.hardware.fr/hardwarefr/...3.htm#t1075575
Some basic rules deduced from the MPlayer documentation:
- Croping should be done with even numbers only (width, height, offsets).
- Interlaced video cropped width should be a multiple of 8 (not written, but the diagram "says" so).
- Interlaced video croping should occur at a multiple of 4 pixels.
- The cropped and rescaled video's width and height should each be a multiple of 16 pixels.
- The added black borders' width and height should each be a multiple of 16 pixels.
I took the habit of putting croping as the first filter, and scaling and expanding as the last (except harddup).
Last filter is harddup.

I won't put code for this 3rd step, as I get the quality I need by just taking the advices from the above linked-to MPlayer documentation (except that I do 2-pass encoding for SVCD, something this document doesn't say is possible; Internet says so, though).

THE problem I still have...

I find that the most difficult part of encoding is scaling, which is necessary if the video is to be viewed anywhere else than MPlayer, since MPlayer is the only player to respect the aspect tag in AVI files... As for MPG files, it must be done anyway because width and height are imposed by the SVCD/DVD spec.

Example: my video is 2:3 384*576, but intended to be viewed at aspect 4:3 (pixels' aspect is 2:1). I crop it in both dimensions, so the real ratio is nothing well defined anymore, though the pixels' aspect has not changed. I try and use the scale filter to just double the width (no change in the height), but MPlayer insists on changing the height too, thus altering the ratio I intended! But if my rescaling goes to something well defined (say: 480x576=SVCD), then my chosen aspect is not altered on screen.
However, if I use the -aspect 4/3 parameter, then it *seems* to be OK... So, what is -aspect? is this the aspect of the initial video (the command-line parameter), or the filtered video, or the output video?

Thanks for any help or tips and tricks on this last topic

Yves.
 
Old 05-24-2006, 09:30 AM   #8
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I thought that France used the SECAM video standard??? Both PAL and SECAM use 625 lines at 50 hz.

From wikipedia:
Quote:
Facetious interpretations of the SÉCAM acronym
American engineers pejoratively claim that SÉCAM stands for "System Essentially Contrary to the American Method". European non-SÉCAM countries use the deprecatory "System Even Crappier than American Method" or "Shows Every Colour All Murky" — a reference to the reduction in vertical color resolution. A french alternative is "Systeme Élegant Contre les AMericans."
NTSC is often referred to as Never The Same Color.

Last edited by jschiwal; 05-24-2006 at 09:43 AM.
 
Old 05-29-2006, 07:07 AM   #9
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Original Poster
Rep: Reputation: 66
Quote:
Originally Posted by theYinYeti
As for quality, it is not that bad, really, maybe thanks to the saa7134 chipset being better than the bt8x8 ones. Maybe the fact that the incoming signal is SECAM (I formerly thought it would be PAL) does count too.
Indeed, we use SECAM in France, and I find the quality I can get rather impressive.
I initially thought that I would get PAL because (almost) all numeric devices in France are PAL: digital cameras, DVD, computers' TV-out... But TV-in still is SECAM after all.

Anyone has any idea on how scaling exactly happens with mencoder/mplayer? Is -aspect taken into account before or after filters are applied? Are there limitations to the aspect you can rescale to? And so on...

Yves.
 
Old 05-29-2006, 02:23 PM   #10
Bobymc
Member
 
Registered: Apr 2006
Location: INDONESIA
Distribution: SLAX,Damn S.L,Suse,Mandrake,Rd HAT62,72,73,90, Mandriva2k6, FEdora, SUNmicrosys.
Posts: 269

Rep: Reputation: 30
Well, hello then...

It's been years since I mingled with video transfers.
I make video capture from VGA card at first lesson.
Hardware have developed so fast, now I use firewire[iLINK].
I did it perfectly in WINdoz, now I see friends in LINUX.

Lemme share a bit;

AVI is very good for editing besides it need a lot of HDD space
MPEG2 is good also it's OK for editing and takes few space in HDD.

Use high speed HDD(with bigger memeory cache)
Plug in an ATA133 controller for P2-3 class CPU.
Use short interconnect from source to capture device to avoid signal [solid color] loses.

I feel rather sleepy if you'll excuse, I'll gain on another time.
You can easily find me at the BETAMAX chatpage, under the same name;
www.palsite.com

Greetz
Boby
 
Old 01-11-2007, 03:05 AM   #11
mairambia
LQ Newbie
 
Registered: Jan 2007
Posts: 2

Rep: Reputation: 0
Wink VHS to DVD conversion

or you can visit and try VHS to DVD 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.
link: http://www.vhs-to-dvd.com/
 
  


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
Cloning 1 hard disk to smaller hard disk, dd or ghost? fireman949 Linux - Hardware 8 12-23-2012 12:51 AM
60GB laptop hard disk & 200GB external USB hard disk linux compatibility powah Linux - Hardware 0 03-07-2006 10:55 AM
Reiser file system / Hard Disk/ Hard Drive Problems Oxyacetylene Linux - Software 4 10-10-2005 02:24 PM
Reclaim disk partition from hard disk installation EStester Linux - Enterprise 2 03-09-2005 11:46 AM
Hard Disk question - Making a big hard disk MrAnonym Linux - General 2 09-15-2003 06:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:55 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