View Full Version : vhs to digital
asdfen
13th December 2017, 10:06
hello all
I am in the process of converting some VHS to PC files
so far I am able to get contents of the tape through a converter and VirtualDub on my PC in AVI container
Video: HFYU 720x576 25fps 119525kbps [V: huffyuv, yuv422p, 720x576, 119525 kb/s]
Audio: PCM 48000Hz stereo 1536kbps [A: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s]
What I would like to do now is to encode that in x264 for video and AC3 (I think) for audio. Its been a long time since I've done that last. So if someone can guide me towards a way to do that fast and easy that would great.
So far I've tried using Megui to do that but the program is giving me a lot of trouble when I try to use it to create an AviSynth script.
So I have manually made one
LoadPlugin("D:\VideoEditing\MeGUI\tools\ffms\ffms2.dll")
LoadPlugin("D:\VideoEditing\MeGUI\tools\avisynth_plugin\yadifmod2.dll")
AviSource("D:\PreRenderTMP\tapecapture.avi", audio = true).AssumeFPS(25, 1, true)
Trim(180, 121771)
crop(18, 4, -36, -108)
BilinearResize(1034, 720, 0, 0, 664, 462)
AddBorders(122, 0, 124, 0, $000000)
ConvertToYV12()
Yadifmod2(order=0)
Should I just make manual AviSynth scripts and use a x264 encoder directly? Also I've forgotten all about interlacing. Should I deinterlace that video and how to do it properly.
Summary
do I need to deinterlace.
how do I deinterlace
Should I resize the video to 720p for newer TVs or add black bars around it after cropping and keep it at 720x576 and let TV resize it for better picture quality.
how to convert the video to x264
how to convert audio to ac3
how to put it into an mp4 or any other container with good comparability that you would recommend. Want to stay away from mkv in this case.
Thank you
manolito
13th December 2017, 17:13
Summary
do I need to deinterlace.
how do I deinterlace
Should I resize the video to 720p for newer TVs or add black bars around it after cropping and keep it at 720x576 and let TV resize it for better picture quality.
how to convert the video to x264
how to convert audio to ac3
how to put it into an mp4 or any other container with good comparability that you would recommend. Want to stay away from mkv in this case.
Hi asdfen
this is a complex topic where you have many options. I can give you a few hints, but you will need to do some testing to determine if one specific method fulfills your needs or not.
First of all congratulations for having successfully captured your VCR source to a huffyuv AVI with PCM audio. For most people this is the hardest part (using VDub for capturing is an excellent choice). Before continuing just make absolutely sure that this AVI plays without any sync problems or other issues.
Your AVS script could use some polishing IMO. You do not need to load the ffms2 plugin if you are using AviSource as your source filter. If you need to deinterlace, your deinterlacing filter should be at the top of your script after the AssumeTFF or AssumeBFF command.
Now to your summary:
1. Your captured AVI will always be flagged as interlaced, but this does not mean that the content is interlaced. To determine this you need to step through some frames with motion in VDub and check for combing artifacts. If there aren't any then the content is progressive, and there is no need to deinterlace at all.
If the content is interlaced then you can either encode in interlaced mode or deinterlace before encoding. Today when converting to AVC or HEVC it is mostly recommended to deinterlace before encoding because the encoders are more efficient in progressive mode.
2. This is (as always) quality vs. speed. Yadif (mod) is fast, and for the VCR source quality you will likely not even need a higher quality deinterlacer. QTGMC is the deinterlacer with the highest quality, but it sure is sloooow. You need to test yourself...
3. For MP4 or MKV containers there is no need to resize your source. If you keep your source resolution then the X264 commandline should have the command "SAR 12:11" in it. The alternative is to resize the source to 720 x 528 (square pixels) and omit the SAR command. I recommend to not resize the source.
Do not add black borders yourself. Your player or TV should take care of this.
4. Of course you ask how to convert to H.264...
Use x264. This is the best free X264 encoder.
5. If you decide to use AviSynth then Aften is your weapon of choice. Today the AC3 encoder in FFmpeg (based on Aften) is considered to be a little bit better.
6. The mostly used containers for AVC video are MP4 and MKV. I prefer MKV, and you want to use MKVToolNix for muxing your encoded streams to MKV. For MP4 you will probably need MP4Box.
Having said this, I would recommend to use a GUI software to make the whole process a lot easier. I am not familiar with MeGUI, but I do know StaxRip quite well. (I use an older version which still works in 32-bit). In StaxRip you will use AviSynth which makes the software very powerful, but it does have a learning curve.
An alternative which is much easier to use would be FFmpeg together with a capable GUI. I use dmMediaConverter. FFmpeg comes with x264 and with the best free AC3 encoder. It only has a limited selection of deinterlacers, though. Yadif is included, and a newer addition is BWdif (Bob Weaver Deinterlacer). I mostly use BWdif these days.
Here is an FFmpeg command line which was created by dmMediaConverter for a captured PAL AVI:
ffmpeg.exe -fflags +genpts -y -i "J:\Capture.avi" -map 0:0 -r:v:0 25 -filter:v:0 "bwdif=mode=0" -c:v:0 libx264 -preset:v:0 slow -tune:v:0 film -level:v:0 4.1 -crf:v:0 19 -map 0:1 -c:a:0 ac3 -b:a:0 224k -channel_layout:a:0 stereo -ar:a:0 48000 -shortest "I:\capture.mp4"
The parameters are for high quality (CRF 19, Preset Slow) and tuned for Film sources. You should be able to test it with your own sources after editing the path and file name parameters.
I probably forgot some other important things... :cool:
Let us know how things are going.
Cheers
manolito
asdfen
13th December 2017, 17:48
great info
thank you manolito
manolito
13th December 2017, 19:47
I did forget one thing you might want to consider:
Your captured AVI file has a color subsampling of 4:2:2. If you use AviSynth it will be converted to 4:2:0 by the "ConvertToYV12()" command.
My FFmpeg command line from the above post keeps the 4:2:2 subsampling for the output, maybe it is a good idea to convert it to 4:2:0. To do this the command line should have the parameter "-pix_fmt yuv420p" added to the video parameters. It should look like this:
ffmpeg.exe -fflags +genpts -y -i "J:\Capture.avi" -map 0:0 -r:v:0 25 -filter:v:0 "bwdif=mode=0" -c:v:0 libx264 -preset:v:0 slow -tune:v:0 film -level:v:0 4.1 -crf:v:0 19 -pix_fmt yuv420p -map 0:1 -c:a:0 ac3 -b:a:0 224k -channel_layout:a:0 stereo -ar:a:0 48000 -shortest "I:\capture.mp4"
Conversion will be faster, the resulting file will be a lot smaller, and I believe that for a VCR source you will not see any quality degradation.
Cheers
manolito
asdfen
14th December 2017, 18:30
thank you manolito
been using / learning staxrip and dmMediaConverter
staxrip takes forever to load the source file for me almost as long as encoding does and gave me an error after when I tried to encode. at that point I stoped using it so far probably am doing something wrong
dmMediaConverter has been a great help and I have made a successful encoding from the source along with crop and interlace.
I am also trying to remember how to properly do stuff in avisynth as on the 2nd tape dmMediaConverter was giving me trouble so I had to use AviSynth to load the source. The encoding turned out with a strange green line(s) in the bottom. Trying to figure out what caused it and redo. (looks like I have to use modx4 resolution at least adding a few pixel padding in avisynth script to make it modx4 fixed it for me)
thank you again
manolito
15th December 2017, 15:02
The encoding turned out with a strange green line(s) in the bottom. Trying to figure out what caused it and redo. (looks like I have to use modx4 resolution at least adding a few pixel padding in avisynth script to make it modx4 fixed it for me)
Maybe you can upload a short sample... :cool:
Cheers
manolito
asdfen
15th December 2017, 21:15
here is a sample video (http://s000.tinyupload.com/index.php?file_id=85952950254457258029) of the vhs rips you have helped me with
manolito
16th December 2017, 12:56
Thanks for the sample...
This one is NTSC and not PAL like you described in your first post. It has the typical VCR artifacts like color glitches at the left, top and right borders. You should maybe crop them off. In the bottom part of the picture you also have timing errors, the vertical edges of the door frame are not aligned properly. Not much you can do about it except getting a better VCR with a built-in time base corrector (TBC).
All these problems come from the source itself, they do not originate from the conversion to AVC/AAC.
Cheers
manolito
asdfen
19th December 2017, 01:35
originally I thought they were pal tapes and so I ended up with a black and white first capture instead of color. doh
but all the following captures turned out to be satisfactory. best I can do with source and capture hardware I got.
the lines I mentioned earlier were some kind of encoding error that was happening when encoding mod2 resolution think it was 702x470. When I switched to mod4 (704x472) they went away.
manolito
19th December 2017, 12:47
Glad you got it working...
IMO it is always a good idea to crop sources to mod4 right after loading the source. Technically it is only required for interlaced sources (progressive should work in mod2), but it never hurts.
Cheers
manolito
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.