View Full Version : HC encoder question
MarioGarcia
13th August 2005, 14:41
Hello I am wondering if you can use if you can use HC encoder to encode captured and uncompressed video files. or it' s only to be used in dvd rebuilder? if so, how to do it?
thank you
Trahald
13th August 2005, 16:18
HCenc can be used for all your mpeg needs. you would need to create a .avs (avisynth) script for importing and install the avisynth package (avisynth.org) if you dont already have it. you could use the directshowsource( "mycapture.avi" ) in the script. directshowsource will import almost anything that can play in media player. there is a sample script at the end of the hcenc release thread.
MarioGarcia
15th August 2005, 13:29
where's such thread?
urvieh
15th August 2005, 18:37
http://forum.doom9.org/showthread.php?t=93211
Delphin
18th August 2005, 06:55
Hello I am wondering if you can use if you can use HC encoder to encode captured and uncompressed video files. or it' s only to be used in dvd rebuilder? if so, how to do it?
thank you
Yes indeed HC is a WONDERFUL general purpose encoder for MPEG2 (though you will need to encode the audio separatly and then mux the stream manually).
There is a GUI version of HC in the HC install folder which is not too tough to deal with, though I have to admidt it looks a little scary at first to anyone not up on MPEG2 options.
Since you only got a very general RTFM answer, here is just a little more info to help you get started . . .
First, you do need AVIsynth to use the HC encoder, but that should already be on your system as part of the rebuilder install, if not get AVIsynth 2.5 (or later) from :
http://www.avisynth.org/
(Again, this install should not be necessary because it should already be there, but I included the above link just in case, and so you know where to go for more AVIsynth info)
You need AVIsynth because HC can not directly load AVI files.
If you look at some of the script examples for AVIsynth at the avisynth.org web site at the link posted above you will see that things can get pretty complicated, but don't let this discourage you, because the minimum script needed to use AVIsynth with HC is quite simple.
AVISource("your.avi")
converttoyv12()
You can create this script with any simple text editor like 'notepad' then save it to the same folder as your AVI file (obviously replace the name "your.avi" in the above script example with the actual name of your avi file in quotes).
Make sure to give the script a .AVS extension instead of the default .TXT extension notepad uses so AVIsynth can recognize that it is supposed to process the file.
You can test your .AVS script by dragging it into media player or VirtualDub to make sure that everything is working. If everything is ok the script will playback in media player or VirtualDub just like a standard avi.
If the script plays back ok, we are ready to load it into HC GUI and run our MPEG2 encode.
Note that this simple script will only work if your video is a reasonably standard AVI and is already at one of the frame rates and resolutions supported by the MPEG2 standard.
Frame rates of 23.98(23.976), 24, 25, 29.97, and 30 are all ok for general PC encoding, but if you have a low framerate like 15fps you will have to convert it first because this rate would not be allowed under the MPEG2 spec.
Almost any horizontal and vertical resolution which is evenly divisible by 16 should work, but I would stay with standard values like:
320x240, 352x240, 352x288, 640x480, 720x480, and 720x576.
Also, although all of the above frame rates and resolutions are all legal for MPEG2 video, only a certain very limited subset is allowed for DVD encoding.
For best PAL DVD compatibility use 720x576 at 25 fps
or
For best NTSC DVD compatibility use 720x480 at 29.97 fps (or encode at 23.98 fps and use an external program like DGpulldown to reset the pulldown flags in your MPEG2 for 23.98 > 29.97 conversion after the M2v file is created by HC)
If you just want to encode some quick files for testing on a PC you can ignore the DVD framerate and resizing issues because PC's are a lot more flexible about the format of MPEG2 files and will display any legal MPEG2.
But what do you do if you want to encode the MPEG2 for use in burning a DVD and your AVI is NOT at the correct resolution or frame rate?
Then things get a little more complicated because we have to use AVIsynth to change the resolution and/or frame rate.
This is why folks LOVE AVIsynth dispite it's sparten, no-nonsense, no-GUI design, because this can be done using only a few additional script commands.
Resizing is pretty simple except for ‘wide-screen’ formatted AVI’s
We have all seen how DVD's look if we select the wrong screen aspect ratio setup in the DVD player settings for 4:3 vs. 16:9.
You get tall skinny people or short squashed people depending on which way you mess up the settings.
Here is a link to a post where I explain a little more about the complicated subject of resizing widescreen AVI files for DVD in AVIsynth.
http://forum.doom9.org/showthread.php?p=696302#post696302
All the examples in the above link may look confusing at first, but the simple explanation is that DVD really only recognizes two aspect ratios 4:3 and 16:9 'anamorphic' (there are others but these are the ones used for DVD compatibility).
You need to pick one of these two aspect ratios in the HC GUI before encoding your AVS file into MPEG2 and then resize your AVI so the folks will not look fat or skinny at the aspect ratio you have selected (either 4:3 or 16:9 'anamorphic').
If you want to squeeze a very wide 2.35:1 AVI video into a standard 4:3 TV monitor frame you have to use fairly large black boarders at the top and bottom to bring the resulting video up to the full vertical height required (this is the process of 'letterboxing' the video).
2.35:1 will fit into a 16:9 'anamorphic' DVD frame with less wasted space so this is preferred aspect ratio for wide-screen sources most of the time.
But this is NOT an absolute rule, because if you plan to display the video on a 4:3 screen it may actually look better if we custom tailor the encoding to 4:3
This is because leaving bigger black boarders makes the video a lot easier to encode (because those black areas are really easy to compress and HC can then use more of the overall bitrate for the rest of the picture)
So unfortunately, this subject gets a little complicated because we have to show settings for each possible AVI aspect ratio 4:3, 16:9, 1.85:1, and 2.35:1 and so forth, for BOTH 4:3 and 16:9 screen optimized MPEG2 encoding.
Oh, I almost forgot . . .
In the HC GUI screen, you can just select BEST for the encoding profile then only change the minimum options that you have to.
- The default bit rate settings are fine for full D1 resolution (720x480 NTSC or 720x576 PAL) but you can tweak them much lower if you are encoding a lower resolution file for PC playback, or to try to squeeze a long movie onto a single DVD (also remember that FAT32 as used in WIN98 and ME can’t create files larger than 4 Gigabytes).
- For video sources which are ‘shot on video’ (like DV camcorder video) or for sources which are telecined and which are STILL INTERLACED (no IVTC or de-interlace) we need to use the ‘interlaced’ encoding option in HC. (note that most video posted on the internet is NOT interlaced because it looks like crap when displayed on a PC monitor instead of a television). Most of the time we want to leave this disabled.
- The ‘scanning’ order should be left as ‘Zigzag’ for Progressive (from film) sources and only set to the alternate option for the fully interlaced ‘from video’ sources mentioned above.
- Lastly the aspect ratio should be set to 4:3 or 16:9 based on how you have resized your video.
I also have some script settings for frame rate conversions if you run into the need to do that, but this should give you enough to chew on for now.
I know this looks complicated, but it’s actually not that bad, as once we have a few fundamentals down, we can just play cut and paste games and put together a quick script in a matter of minutes.
P.S.
I just double checked the re-sizing info link I posted above and noticed that it's all calculated for PAL.
Sorry, let me know if you need numbers to resize correctly for NTSC DVD encoding, because they would be different due to the NTSC 720x480 frame size.
MarioGarcia
18th August 2005, 14:35
hello
all I have is OWN vhs to avi captures. the one i am trying to use to start is completely uncompressed.. not even huffyuv was used.. it's 4 minutes long is weighs 5 gb, the audio is pcm. 48.000 hz.. (i choosed 48.000 instead of 44.1 khz) i don't know if it was wise.. I think the dvd standards require 48 khz??
what I am not able to do is to deinterlace the video... I want it to be played in dvd players as well as in pc screens..
I captured the video at 720 * 576 and the framerate is of 25 fps .. so resizing should not be necessary...
do I have to de-multiplex the avi.. ? the avisource("myavi") must be video only or the real audio video interleave?
I need to denoise it a bit to improve the vhs quality and deinterlace... but I am going to try to encode it with the simple script you gave to me.. I have avsedit to create the scripts ;
thank you very, very much..
Boulder
19th August 2005, 09:20
hello
the one i am trying to use to start is completely uncompressed.. not even huffyuv was used..
HuffYUV is lossless, therefore you save space but lose no quality whatsoever.
Delphin
25th August 2005, 12:25
hello
all I have is OWN vhs to avi captures. the one i am trying to use to start is completely uncompressed.. not even huffyuv was used.. it's 4 minutes long is weighs 5 gb, the audio is pcm. 48.000 hz.. (i choosed 48.000 instead of 44.1 khz) i don't know if it was wise.. I think the dvd standards require 48 khz??
what I am not able to do is to deinterlace the video... I want it to be played in dvd players as well as in pc screens..
I captured the video at 720 * 576 and the framerate is of 25 fps .. so resizing should not be necessary...
do I have to de-multiplex the avi.. ? the avisource("myavi") must be video only or the real audio video interleave?
I need to denoise it a bit to improve the vhs quality and deinterlace... but I am going to try to encode it with the simple script you gave to me.. I have avsedit to create the scripts ;
thank you very, very much..
There are about a dozen or more deinterlace filters for AviSynth, each seems to have it's fans.
If you search the web with the key words "AVIsynth" and "deinterlace" you will find a lot of examples.
MvBob is supposed to be very good (though very slow), but I would start with something simple like " LeakKernelDeint "
http://www.avisynth.org/warpenterprises/files/leakkerneldeint_25_dll_20050118.zip
If this guy lives in your AviSynth 'plugins' folder you can just call the function between the 'avisource' and 'converttoyv12' lines in your simple script.
If you don't want to place the DLL in your AVIsynth 'plugins' folder, you will also need a 'loadplugin' call at the top of your script.
Personally, when I have to deinterlace, sometimes I like to use the VirtualDub version of Donald Grafts 'smart deinterlacer'.
http://neuron2.net/smart/smart28b1.zip
Then I pass the video from Virtual Dub to AVIsynth.
To do this, I just start the 'Frame Server' in the Virtual Dub 'File' menu and then save the 'signpost' file with a name like 'VirtLink.vdr'.
Then in AVIsynth I point the "AviSource()" function at this .VDR file like:
AviSource("VirtLink.vdr")
After this trick, you can use Virtual Dub as a 'front end' for AVIsynth, and get access to almost all the VirtualDub filter options (except filters which cause delay like Virtual Dub's 'temporial smoother').
The nice thing about this setup is that VirtualDub will show you the effect of tweaking your deinterlace settings in Don's 'smart deinterlace' filter in real time. Then, when you have everything perfect, you can just start the frame server and load the AVS script into the HC encoder.
I know this is a little confusing so here is the video transfer path again:
YourAVI >> Virtual Dub (just load it)
VirtualDub ‘frame serves’ it’s .VDR file >> AVIsynth
AVIsynth script loads .VDR >> AviSource(VirtLink.vdr)
AVIsynth is now ready to frame serves .AVS >> HC MPEG2 encoder
The only down side is that this is a little slower than a direct AVIsynth script would be without Virtual Dub.
There is also a theoretical hit in quality due to the fact that Virutal Dub processes almost exclusively in RGB, so an additonal 'color space' conversion could be taking place. Truth is, I have actually seen this IMPROVE things for some files because it prevents some kinds of color up-sampling errors which can arise with a few codecs.
If you can't get the Virtual Dub frame server to work, there is a troublshooting guide over at VideoHelp.com (I have used the Virtual Dub frame serve function a lot so I think you will find it's worth the trouble to get it working)
Even If you can't get the Virtual Dub Frame server working right away, you can still use it to deinterlace your video. Just save your deinterlaced video using the HuffyUV codec, then AviSource() that saved video to AVIsynth and HC.
As noted in a previous reply, HuffyUV is LOSSLESS so this will not degrade your video.
Remember you also have a last ditch option when it comes to deinterlacing . ..
You can have AVIsynth split the two fields in your interlaced source, THEN DROP ONE (and then vertically resize with a slight sharpen). Even with the sharpen, you will notice a slight loss in vertical resolution, but this will completly solve the WORST interlace artifacts, so it's worth considering if you are really desparate.
Both the 'Smart deinterlace' and 'leakKernelDeint' work very well and MvBob is another option if you can spare the time (it's a bit slow), so hopfully you wont have to resort to the desparate mesure of cutting your vertical resolution in half.
As far as the AVI stream multiplexing goes . . .
NO YOU DON'T USUALLY HAVE TO DEMULTIPLEX THE AUDIO AND VIDEO FROM THE AVI.
AVIsynth will process and 'serve' BOTH the audio AND video from the AVI, but HC is smart enough to ignore the audio and just encode the video.
BeSweet is also smart enough to do just the opposite (ignore the video and just encode the audio).
Technically you could probably send the .AVS through BeSweet to MPEG2 encode the audio, but if I am not doing someting in AVIsynth which will effect the sync (like using the trim function), I usually find it's simpler to just load the ORIGINAL AVI into BeSweet Light and encode the MPEG2 or AC3 stream right from there.
MarioGarcia
26th August 2005, 12:44
thanks I will try that.
just another question.. is it possible to encode in batch with hc? i want to create the avs files and then leave the computer do the rest.. I know there's a hcbatch but it seems totally independent from the hcgui..
thanks again
Prodater64
26th August 2005, 17:23
thanks I will try that.
just another question.. is it possible to encode in batch with hc? i want to create the avs files and then leave the computer do the rest.. I know there's a hcbatch but it seems totally independent from the hcgui..
thanks again
http://forum.doom9.org/showthread.php?p=692791#post692791
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.