digitalFAQ.com Forum

digitalFAQ.com Forum (https://www.digitalfaq.com/forum/)
-   Capture, Record, Transfer (https://www.digitalfaq.com/forum/video-capture/)
-   -   How to digitize VHS and correct aspect ratio? (https://www.digitalfaq.com/forum/video-capture/13268-how-digitize-vhs.html)

Duxa 01-29-2023 02:49 PM

How to digitize VHS and correct aspect ratio?
 
1 Attachment(s)
Hi all, I am going through and digitizing old VHS tapes (PAL). As I am capturing the preview looks ever so slightly squished from the sides (people seem skinnier), (I am capturing at 720x576). So I started googling and it sounds like there is an issue with the black bars on the sides and they need to be cropped to 704x576 for proper aspect ratio?

I dont know what I am talking about here, so please educate me. And most importantly, should I be doing all this in post (with ffmpeg) or should I be cropping something, somewhere during capture? I would like to avoid capturing days worth of footage then to find out I need to recapture it and crop during capture.

Image sample attached. (screenshot of virtualdub window)

Hushpower 01-29-2023 06:53 PM

3 Attachment(s)
Here are my thoughts. I have read the same about the 16 pixels (mainly from @Latreche43). My understanding is that an analogue capture adds the 16 pixels (nominally 8 per side) during the digitising process, and they will squash in your video. So, you need to crop the 16 pixels away, but not just leave it at that because you would have a still-squashed-in video, just 704 wide with no black bars. You therefore need to resize back out to 720 at a 4:3 ratio, or 768 at 1:1. This will stretch your image slightly. I've done some circle tests and this procedure appears to work.

I've attached an untouched capture of a video of a pure circle; the rear of the engine is circular.

Extrapolating, if you want to also crop off the headswitching noise at the bottom (or take more off the sides), then my understanding is you should do it in roughly the 4:3 (1.3333) ratio, ie if you take an extra 10 pixels off the bottom, you should take 13 total off the sides.

This can be easily done in VDub 2 using the Crop filter. Then I use the Resize filter to resize to 768x576 (1:1) as per the attached. I prefer 768x576 because it's less confusing to export using the x264 encoder in VDub 2. File size seems to be about 5% more for the 768x576 file.

If you use the VDub2 x264 encoder, for the 720x576 file use a SAR of 16:15.

If you use the 768x576 file, use a SAR of 1:1.

traal 01-30-2023 11:47 AM

Just load the video into MkvToolNix GUI, select the video stream in the lower left pane, and in the right pane select the correct aspect ratio. Muxing will only take a few seconds, then the aspect ratio will be correct.

If you want to crop out the 16 pixels then you can enter into the cropping field in the right pane: 8,0,8,0

VLC doesn't respect the cropping parameters but Potplayer does.

Duxa 01-30-2023 01:28 PM

Quote:

Originally Posted by traal (Post 88868)
Just load the video into MkvToolNix GUI, select the video stream in the lower left pane, and in the right pane select the correct aspect ratio. Muxing will only take a few seconds, then the aspect ratio will be correct.

If you want to crop out the 16 pixels then you can enter into the cropping field in the right pane: 8,0,8,0

VLC doesn't respect the cropping parameters but Potplayer does.

Wont aspect ratio be wrong without cropping out the black bars since they are part of the video?

Hushpower 01-30-2023 08:03 PM

Quote:

Originally Posted by Traal
Just load the video into MkvToolNix GUI, select the video stream in the lower left pane, and in the right pane select the correct aspect ratio. Muxing will only take a few seconds, then the aspect ratio will be correct.

Not here it isn't. VLC Player does not read the MKVToolnix AR; it displays an analogue AVI as 5:4/1.25 to 1. If VLC Player won't display it properly, other programs/equipment might be the same.

@Duxa, I just looked at your screenshot. You can see what your video looks like at 4:3 in the VDub monitor: right-click on the video image then choose 4:3. Of course, that isn't setting the actual AR, but you'll be able to see what 4:3 looks like. Crop off the 16 side pixels and it'll "widen" even more.

traal 01-30-2023 08:27 PM

Quote:

Originally Posted by Hushpower (Post 88875)
VLC Player does not read the MKVToolnix AR

As I said.

Again, PotPlayer displays it correctly.

lordsmurf 01-30-2023 10:02 PM

Quote:

Originally Posted by Duxa (Post 88850)
As I am capturing the preview looks ever so slightly squished from the sides (people seem skinnier), (I am capturing at 720x576).

That is correct. 720x576 is 5:4, storage aspect. That has nothing to do with 4:3 viewing aspect, don't get those confused, 4x3 isn't done at capture step.

Quote:

it sounds like there is an issue with the black bars on the sides and they need to be cropped to 704x576 for proper aspect ratio?
No.
704 is padded to 720, but that also has nothing to do with the AR.
704 isn't 3:3 either.

Quote:

I dont know what I am talking about here, so please educate me.
Not a problem. :)

Quote:

And most importantly, should I be doing all this in post
Yes.

Quote:

(with ffmpeg)
No.

Quote:

or should I be cropping something, somewhere during capture?
No.

Quote:

Originally Posted by Hushpower (Post 88855)
and they will squash in your video.

Not quite. Nothing is squashed.

Quote:

So, you need to crop the 16 pixels away, but not just leave it at that because you would have a still-squashed-in video, just 704 wide with no black bars. You therefore need to resize back out to 720 at a 4:3 ratio, or 768 at 1:1. This will stretch your image slightly.
But that's incomplete info. Why crop? And if cropping is indeed warranted, you must consider whole-frame AR.

On a DVD, those 8 pixels per side are removed by the player, displayed 4x3, done.
To convert to streaming, view on a computer/tablet/etc, it's all on you to do manually. So take 720 source, crop width to 704 (remove black bars), then resize whole frame to a 4x3 (usually 720x540 PAL, 640x480 NTSC).

Images have offset, so you rarely remove 8 from each side, but rather 16 total to recenter image.

Quote:

Extrapolating, if you want to also crop off the headswitching noise at the bottom (or take more off the sides), then my understanding is you should do it in roughly the 4:3 (1.3333) ratio, ie if you take an extra 10 pixels off the bottom, you should take 13 total off the sides.
This gets messy for newbies.
- The easy way is to crop to proper AR, then resize further (stretch back out) to the cropped AR, removing overscan. Yes, crop 4x3/
- The harder way is to use your high school algebra, an crop during the AR resize (crop before resize). That involves more complex numbers.

Or best yet, stop cropping. Mask it. Your content does need to "fill the screen", especially not if doing so is destructive to the image.

Quote:

If you use the VDub2 x264 encoder,
It's terrible, never use that, output is non-standard to modern expectations, ancient encoder.

Quote:

Originally Posted by traal (Post 88868)
Just load the video into MkvToolNix
VLC doesn't respect the cropping parameters but Potplayer does.

How did the conversation move from encoding to playback? :question:

Quote:

Originally Posted by Duxa (Post 88871)
Wont aspect ratio be wrong without cropping out the black bars since they are part of the video?

Wrong in what context?

Quote:

Originally Posted by Hushpower (Post 88875)
Not here it isn't. VLC Player does not read the MKVToolnix AR; it displays an analogue AVI as 5:4/1.25 to 1. If VLC Player won't display it properly, other programs/equipment might be the same.

Most everything is the same, hardware or software. AR is so easily screwed up, and it happens way to often. (The worst is when a documentary stretches 4:3 to 16:9, idiots.)

latreche34 01-30-2023 10:18 PM

Quote:

Originally Posted by lordsmurf (Post 88877)
Most everything is the same, hardware or software. AR is so easily screwed up, and it happens way to often. (The worst is when a documentary stretches 4:3 to 16:9, idiots.)

I had my fare share of viewing that crap in the past decade or so, every doctor, dentist, service or public office I go to I see the stretched frame on their waiting room TV, even worse stretched with black bars on top and bottom, go figure, I could never understand how they don't see anything wrong with that.
Sorry for going off the rail.

Duxa 01-30-2023 10:36 PM

What I am the most concerned about is for when I play the video on a modern TV it is in correct aspect ratio, not squished or stretched. I dont care about the black bars on the sides as long as it means aspect ratio stays correct. From what I understand the raw file captured at 720x576 will not have the correct aspect ratio and will be squished from the sides. Because its 16 pixels narrower (side to side) than it would be if shown on an old tube TV where those black bars arent shown.

Am I understanding that right?

Basically I am not interested in removing black bars, I am interested in making sure the aspect ratio is correct, and if removing black bars is the way to do it then I want to know how to do it (but if its as simple as removing 16 pixes from the sides and then setting aspect ratio then I think I got it down).

Im still on step 1 (capturing), but I think my workflow will be as follows.

1. Capture in Vdub
2. Deinterlace in Vdub and color correct (to get rid of the washed out look, thats not how VHS was on tube TVs right?)
3. Transcode into h265 in Handbrake for final storage, during this step also crop and set correct Aspect Ratio (I dont want to keep 100GB+ files of uncompressed PCM/Video).

(PS. still need to look up how to properly color correct).

Feedback please :congrats:

lordsmurf 01-30-2023 10:39 PM

Quote:

Originally Posted by latreche34 (Post 88878)
I had my fare share of viewing that crap in the past decade or so, every doctor, dentist, service or public office I go to I see the stretched frame on their waiting room TV, even worse stretched with black bars on top and bottom, go figure, I could never understand how they don't see anything wrong with that.
Sorry for going off the rail.

Too many people are willingly ignorant when it comes to video.

I like westerns, especially The Lone Ranger, and it's on daily on The Cowboy Channel on cable. But I can't stand to watch it. Everything is butchered, both AR and interlacing. It's a stretchy liney mess, gives me a headache to try and watch. I finally bought a Chromecast for that TV, and have yet to see AR/interlace issues on the free views. Tons and tons of westerns, too!

Quote:

Originally Posted by Duxa (Post 88879)
What I am the most concerned about is for when I play the video on a modern TV it is in correct aspect ratio, not squished or stretched.

- What is the format of the source?
- What is the player?

Those questions all matter.

This is an issue of following rules/standards. Proper delivery format, specs therein. Proper playback.

For example, an MPEG file, 720x480, flagged to DVD/BD specs, played from a proper player, will not screwed stuff up. But then you get to interlaced H.264 (usually NOT supported), or flag-less non 1:1 MKV/MP4 (ie 1:1), etc, and it's all screwed up. Sometimes the player just outright ignores H.264 flags altogether.

Quote:

From what I understand the raw file captured at 720x576 will not have the correct aspect ratio and will be squished from the sides. Because
You should not watch capture files. Those are for processing in editors, NLEs, etc. Delivery formats are for watching. And never capture to delivery formats (aka H.264 aka "MP4").

Quote:

Am I understanding that right?
Not quite. Info missing, info taken out of context.

Quote:

(but if its as simple as removing 16 pixes from the sides and then setting aspect ratio then I think I got it down).
No, not it.

Quote:

2. Deinterlace in Vdub
You're harming quality. At best, it does Yadif, a method of deinterlace from 15+ years ago, long ago superceded by QTGMC.

Quote:

and color correct (to get rid of the washed out look, thats not how VHS was on tube TVs right?)
But careful. You don't want to "correct" against a bad monitor. If all your videos are "washed" your monitor is wrong, not calibrated.

You need to worry more about chroma noise, use Camcorder Color Denoise (CCD) in VirtualDub for that.

Quote:

3. Transcode into h265 in Handbrake for final storage, during this step also crop and set correct Aspect Ratio (I dont want to keep 100GB+ files of uncompressed PCM/Video).
Handbrake is notorious for screwing up AR. Don't use it for captures. It was made to copy DVDs. Use Hybrid, and QTGMC is also in there.

Quote:

(PS. still need to look up how to properly color correct).
In VirtualDub, start with Colormill.

Duxa 01-30-2023 11:10 PM

So the end goal is to probably host them on Plex, so as far as clients (family members) watching the home videos from the 90's its basically a FFMPEG transcode to a Roku or phone/tablet.

For storage as I said I aim to MKV with x265 compression.

How do I make sure that the Aspect Ratio for the clients is correct? Also you said not to deinterlace... are you suggesting to watch interlaced video or are you suggesting to do something else that would keep original interlace but show it correctly for clients?

traal 02-01-2023 10:29 AM

Quote:

Originally Posted by lordsmurf (Post 88877)
How did the conversation move from encoding to playback? :question:

MkvToolNix lets you do things like set aspect ratios and add chapter stops, all without re-encoding the video. For some tasks like these, it's a lot easier to use than Handbrake or ffmpeg.

Duxa 02-01-2023 01:46 PM

So this is what I decided to do, please tell me if this is a bad idea.

I am going to keep uncompressed 60GB per hour captures, going to burn them onto some Blu Rays and also dedicate a portable drive that I can throw in a closet to them.

Now as far as plex/sharing the content.

I am using FFMPEG. I am deinterlacing with yadif=1 (one frame per field), making NTSC videos ~60FPS and PAL ~50FPS.

I am setting DAR to 4:3.

I am using x264 at QC17 (which after encoding and using MediaInfo shows that it results in about 16Megabit per second for video).

I am compressing PCM audio to AC3 at 192kbps.

Here is my command for FFMPEG:

Quote:

-c:v libx264 -preset veryslow -crf 17 -vf yadif=1 -aspect 4:3 -c:a ac3 -b:a 192k
Please tell me if I should be doing something differently.

MediaInfo:

Quote:

Format : AVI
Format/Info : Audio Video Interleave
Format profile : OpenDML
File size : 20.7 GiB
Duration : 3 h 1 min
Overall bit rate : 16.3 Mb/s
Writing application : Lavf59.27.100

Video
ID : 0
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High 4:2:2@L4
Format settings : CABAC / 16 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference : 16 frames
Codec ID : H264
Duration : 3 h 1 min
Bit rate : 16.1 Mb/s
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 4:3
Frame rate mode : Variable
Frame rate : 50.000 FPS
Color space : YUV
Chroma subsampling : 4:2:2
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.778
Stream size : 20.5 GiB (99%)
Writing library : x264 core 164 r3099 e067ab0
Encoding settings : cabac=1 / ref=16 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=18 / lookahead_threads=3 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=17.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Color range : Limited
Matrix coefficients : BT.470 System B/G

Audio
ID : 1
Format : AC-3
Format/Info : Audio Coding 3
Commercial name : Dolby Digital
Codec ID : 2000
Duration : 3 h 1 min
Bit rate mode : Constant
Bit rate : 192 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Frame rate : 31.250 FPS (1536 SPF)
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 249 MiB (1%)
Alignment : Aligned on interleaves
Interleave, duration : 32 ms (1.60 video frames)
Service kind : Complete Main


Hushpower 02-01-2023 08:33 PM

Quote:

I am going to keep uncompressed 60GB per hour captures, going to burn them onto some Blu Rays and also dedicate a portable drive that I can throw in a closet to them.
If space is an issue, I'd compress them into lossless format (HUFFYUV or Lagarith); Virtual Dub>Fast Recompress. That'll take them down to around 30gb per hour. Lossless is still considered excellent archival quality.

I don't have any experience with AC3 and how compatible it is with players such as phones; suggest you check that. AAC at 192kbps is a common audio format for MP4.

Can't help you with the rest; my thoughts on dropping all that rubbish off the top, bottom and sides still stands. I don't like seeing all that stuff. And I don't like seeing masks either. I have a big TV so I can see a big picture! :D

mrmuy97 02-04-2023 12:08 AM

Quote:

Originally Posted by Hushpower (Post 88901)
I don't have any experience with AC3 and how compatible it is with players such as phones; suggest you check that. AAC at 192kbps is a common audio format for MP4.

Both AAC and AC3 very well-supported these days on every major device/OS AFAIK.


Quote:

Originally Posted by Duxa (Post 88898)
I am compressing PCM audio to AC3 at 192kbps.

Please tell me if I should be doing something differently.

MediaInfo:

Audio
ID : 1
Format : AC-3
Format/Info : Audio Coding 3
Commercial name : Dolby Digital
Codec ID : 2000
Duration : 3 h 1 min
Bit rate mode : Constant
Bit rate : 192 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Frame rate : 31.250 FPS (1536 SPF)
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 249 MiB (1%)
Alignment : Aligned on interleaves
Interleave, duration : 32 ms (1.60 video frames)
Service kind : Complete Main

Personally I'd upgrade the audio to 320 kbps (x2 channels = 640 kbps total audio bitrate).

When I started capturing I was surprised to learn that the VHS audio specs are way better than I had assumed based on its low video quality. Of course this comes down to several factors like whether you even care about the audio quality to that extent, or if the recording's sound quality isn't great anyway and the higher bitrate won't matter. As you can see in the specs you posted, we're talking about a few hundred MB increase for the audio stream; in my opinion that's no problem and well worth the difference.

In the case of quality tape brands, SP recordings, excellent condition, recorded with quality equipment, it makes sense. When there's music in the background and people talking, singing, etc in their home videos, it makes an audible difference. I find the 320(640) AC3 essentially indistinguishable from the uncompressed 1536 kbps PCM.

One of my early tests showing audio settings including x265 clips to hear the audio (retail VHS for experimenting) - https://www.digitalfaq.com/forum/vid...html#post83973


Quote:

Originally Posted by mrmuy97 (Post 83973)
Uncompressed video/audio file info:

[Audio]
Format : PCM
Format settings : Little / Signed
Codec ID : 1
Duration : 1 min 10 s
Bit rate mode : Constant
Bit rate : 1 536 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Bit depth : 16 bits
Stream size : 12.9 MiB (100%)

- - - - - - - - - - - - - - - - - - - - - - - -

x265 compressed video/audio file info:

[Audio]
ID : 2
Format : AC-3
Format/Info : Audio Coding 3
Commercial name : Dolby Digital
Codec ID : A_AC3
Duration : 1 min 10 s
Bit rate mode : Constant
Bit rate : 640 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Frame rate : 31.250 FPS (1536 SPF)
Compression mode : Lossy
Delay relative to video : -5 ms
Stream size : 5.38 MiB (21%)
Title : Stereo
Service kind : Complete Main
Default : Yes
Forced : No



All times are GMT -5. The time now is 06:34 PM

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.