Log in

View Full Version : Integrate the HC encoder by hank315 into DVD-RB


manolito
3rd February 2005, 20:49
Originally posted by manolito
I just wrote a small utility that gives HC a QuEnc compatible command line interface. This means that applications that can use QuEnc (like DVD-RB or DVD2SVCD) can now also use HC.

Download at
http://scifi.pages.at/manolito/HC_CLI/HC_CLI.zip

Cheers
manolito
Looks like my post is well hidden in this thread:
http://forum.doom9.org/showthread.php?s=&threadid=88888&perpage=20&pagenumber=4

This is for users of DVD-RB who are interested in trying a brandnew MPEG2 encoder.

Have fun
manolito

jdobbs
4th February 2005, 01:55
Any reports on how the output quality compares to QuEnc or CCE?

manolito
4th February 2005, 13:36
I can only speak for a couple of low bitrate SVCD conversions (bitrate between 700 and 900 kbps). I used some analog TV captures (very good quality from analog cable, captured at 468 x 576, added borders to get a frame size of 480 x 576, SmartDeinterlacer, no resizing, filters undot und hqdn3d). I encoded these clips with CCE 2.67 in OPV mode, FreeEnc 0.31 and HC. Matrix was Jawor1CD in all cases. For CCE I used a QC of 28, GOP 15, DC Prec 8. In FreeEnc the template was Incredible_KDVD, GOP increased to 24. For HC I used DC Prec 8, quality profile GOOD, GOP Auto.

With CCE I got a Q between 48 and 57. There was only light blockiness in darker textures, but with camera movements (panning and zooms) there was an annoying amount of mosquito noise.

HC showed no mosquito noise, but darker and also brighter textures were noticeably blocky. Maybe a fixed GOP length of 24 would have been better.

FreeEnc was the clear winner. No mosquito noise and only a slight but visible amount of blocking in darker scenes.

For speed nothing can beat CCE in OPV mode. FreeEnc took about twice as long, and HC was still 30% slower. This is probably due to my Celeron 1100 CPU which only supports MMX and SSE. With SSE2 and SSE3 HC is supposed to be much faster.


For DVD output this might of course be a completely different story...

Cheers
manolito

manolito
21st February 2005, 20:29
Now you can also test Peter Cheat's NuEnc (improved rate control) with DVD Rebuilder. Have a look here...
http://forum.doom9.org/showthread.php?s=&postid=614478#post614478

Cheers
manolito

DK
21st February 2005, 20:49
hello manolito,

quite some time ago i downloaded your hc_cli version

tried it last night and experienced the following error


after the first encoding this error pops up:

***
error 552 (228h) occured in line 121 of the command file ....

("info substr" error: incorrect start or end substring)

to continue press space, return or escape
***

here is the content of the command file

+++++++++++++++

rem ************************** HC_CLI *****************************************
rem **** Gives the HC encoder a QuEnc compatible command line interface *******



rem ************ Get the full path of the HC executable ***********************

echo off
:CHECKPATH
info reg "HKEY_LOCAL_MACHINE\Software\HC\InstallPath"
set HC_PATH=%info%
if !%HC_PATH%==! goto GETPATH
if not exist %HC_PATH%Hc.exe goto GETPATH
cd %HC_PATH%
set count=0
goto getparams
:GETPATH
Input [,,,,Enter Path for HC Encoder,,V]
Input "^LSN9^Please enter the full path where HC.exe is located on your harddisk."
Input /E:"C:\Program Files\HC\"
if errorlevel 1 goto GETPATH
sys regins "HKEY_LOCAL_MACHINE\Software\HC\InstallPath" STR %info%
goto CHECKPATH



rem *************** Write all commandline parameters into variables ************

:getparams
inc count
if !%1 ==! goto analyze
set P%count%=%1
shift
goto getparams



rem ***** Extract the parameters we need into variables and discard all others ***

:analyze
dec count
set paramcount=%count%
set count=1
:getinfile
if !%%P%count%%%==!-i set infile=%%P%+1count%%%
if %count%>>%paramcount% set done=true
if !%done%==!true set count=1
if !%done%==!true goto getoutfile
if !%infile%==! goto getinfile
set count=1
set done=
:getoutfile
if !%%P%count%%%==!-o set outfile=%%P%+1count%%%
if %count%>>%paramcount% set done=true
if !%done%==!true set count=1
if !%done%==!true goto getABR
if !%outfile%==! goto getoutfile
set count=1
set done=
:getABR
if !%%P%count%%%==!-b set ABR=%%P%+1count%%%
if %count%>>%paramcount% set done=true
if !%done%==!true set count=1
if !%done%==!true goto getMaxBR
if !%ABR%==! goto getABR
set count=1
set done=
:getMaxBR
if !%%P%count%%%==!-maxbitrate set MaxBR=%%P%+1count%%%
if %count%>>%paramcount% set done=true
if !%done%==!true set count=1
if !%done%==!true goto getAspect
if !%MaxBR%==! goto getMaxBR
set count=1
set done=
:getAspect
if !%%P%count%%%==!-aspectratio set aspect=%%P%+1count%%%
if %count%>>%paramcount% set done=true
if !%done%==!true set count=1
if !%done%==!true goto getInterlaced
if !%aspect%==! goto getAspect
set count=1
set done=
:getInterlaced
set interlaced=
if !%%P%count%%%==!-interlaced set interlaced=true
if %interlaced%==true goto modify
inc count
if %count%>>%paramcount% goto modify
goto getInterlaced



rem ****** Change the parameter format to the HC.INI format **********

:modify
set ABR=%ABR%000
set MaxBR=%MaxBR%000
info varpos infile "
if %errorlevel%==0 goto checkoutfile
info varlen infile
dec errorlevel,2
info substr infile 2,%errorlevel%
set infile=%info%
:checkoutfile
info varpos outfile "
if %errorlevel%==0 goto fixaspect
info varlen outfile
dec errorlevel,2
info substr outfile 2,%errorlevel%
set outfile=%info%
:fixaspect
info varlen aspect
set length=%errorlevel%
info varpos aspect :
set colonpos=%errorlevel%
calc %length%-%colonpos%
set length2=%info%
info substr aspect 1,%-1colonpos%
set first=%info%
info substr aspect %+2colonpos%,%length2%
set second= %info%
set aspect=%second%:%first%



rem *** Save original HC.INI and disable the relevant old parameters ****

attr hc.ini /R- /OA /OD /OR
copy hc.ini hc.$$$ /OD /OR
replace hc.ini /OD /OR /OS /<TD:>"*INFILE"<"!">" *INFILE"
replace hc.ini /OD /OR /OS /<TD:>"*OUTFILE"<"!">" *OUTFILE"
replace hc.ini /OD /OR /OS /<TD:>"*BITRATE"<"!">" *BITRATE"
replace hc.ini /OD /OR /OS /<TD:>"*MAXBITRATE"<"!">" *MAXBITRATE"
replace hc.ini /OD /OR /OS /<TD:>"*INTERLACED"<"!">" *INTERLACED"
replace hc.ini /OD /OR /OS /<TD:>"*ASPECT"<"!">" *ASPECT"
replace hc.ini /OD /OR /OS /<TD:>"*BATCH"<"!">" *BATCH"



rem ************* Write new parameters into HC.INI ***********************

echo {>>hc.ini<<}
echo *INFILE %infile%
echo *OUTFILE %outfile%
echo *BITRATE %ABR%
echo *MAXBITRATE %MaxBR%
echo *ASPECT %aspect%
echo *BATCH
if !%interlaced%==!true echo *INTERLACED {>>hc.ini<<}
wait 500


rem *** Execute HC.EXE and restore old HC.INI after the encoder is finished ***

hc.exe
del hc.ini /OA /OD /OR
ren hc.$$$ hc.ini /OA /OD /OR

++++++++++++++++++++++


when i press space, the next encoding will be done, but this way an automated process is not possible

manolito
21st February 2005, 23:13
@DK
Could you try to download the latest version (same link) and report back?

Cheers
manolito

DK
22nd February 2005, 00:13
by latest version you mean the link you give above concerning NuEnc?

i did and it did NOT work for me; received the infamous "Bad Parameter" using your nucli and nuenc 0.01

Fishman0919
22nd February 2005, 01:25
Amnon82 did a few tests...

http://forum.doom9.org/showthread.php?threadid=89559

I did a few tests myself and came up with pretty much the same thing.
CCE 2.70 and HC 0.1 were about the same and QuEnc came in last. HC is and excellent encoder, a little slow(in best mode) but great quality.


EDIT: Link for download - http://forum.doom9.org/showthread.php?s=&threadid=88888

Fishman0919
22nd February 2005, 18:47
New ver. - http://hank315.dyndns.org/HC_011.zip

Changes:
- GUI updated, many bugs fixed
- preview option added
- TFF/BFF flag added for interlaced encoding
- shows Avisynth script errors
- max. bitrate is written in sequence header instead of 9800
- minor changes in bitrate control for bitrate < 2000 kb/s
- AUTOGOP option didn't work if scene change detection was switched off, fixed
- bitrate now in kb/s, m2v file size in Kbytes (1 kbit = 1000 bit)
- MPEG matrix is set as default matrix

manolito
22nd February 2005, 18:47
@DK
I just spent a couple of hours testing HC_CLI and NuCLI with DVD Rebuilder 0.74.
I used all possible combinations of parameters, I used folder names with and without
all kinds of special characters and spaces, but I was unable to reproduce the errors
you encountered.

I can only think of two possible reasons for the errors, and these are:

1. Operating System
You are not using Win9x, are you? Don't, it will not work.

2. File I/O problems
Both scripts do some writing to / reading from files, and until now I did not
add any wait cycles after file I/O operations.

I have uploaded improved versions of both HC_CLI.zip and NuCLI.zip. Now there are some
one second wait cycles after file I/O, and the code is a little cleaner. For NuCLI I also
changed the time when the temp file that contains the new command line is deleted. This
means that if NuEnc quits with a "Bad Parameter" error, you can go to the NuEnc folder
and open the file CMDLINE.$$$ to see which faulty parameter causes the error.

http://scifi.pages.at/manolito/NuCLI/NuCLI.zip
http://scifi.pages.at/manolito/HC_CLI/HC_CLI.zip

Please let me know if the new versions work for you,

Cheers
manolito

DK
22nd February 2005, 18:59
my os is XP

i will try those two cli versions asap

thanx in advance


+++++++++++++++++++

the data itself is fine btw

used it with quenc (two different modes), cce and procoder for testing purposes


the problem must be calling the next encoding process

could a different language on the part of the os be an issue?

DK
22nd February 2005, 20:12
your latest HC_CLI runs fine this very moment

thumbs up!!!

seems the transition from one segment to the next works now :D

in the very beginning i had a problem though

the so called *intermediate pass* does not progress properly
(at least it doesnt do anything but stalling)

stating: optimizing picture length

i closed that window and from then on the encoder did a fine job
(so far)

manolito
22nd February 2005, 22:30
This should not have anything to do with HC_CLI. Once HC.exe is started, HC_CLI does not do anything, it just waits until HC.exe is finished. I do remember a post in the HC thread where the intermediate pass got stuck, maybe you can find a solution there.

Cheers
manolito

DK
22nd February 2005, 22:34
there seems to be a bug with hc.exe:

segments with only 1 frame to encode stop the encoding process

http://uncas.atlandide.net/images/hc_freeze.jpg

hank315
23rd February 2005, 10:31
there seems to be a bug with hc.exe:

segments with only 1 frame to encode stop the encoding processWill have a look at it, never tried it with just 1 frame, think it can easily be corrected.

DK
23rd February 2005, 10:37
think it can easily be corrected

that'll be great

for now the process simply stalls

hank315
23rd February 2005, 13:00
Just took a closer look at the command prompt window.
What puzzles me is the value for est. outfile length = 0 kB.
Could it be that the value for *BITRATE is very small or zero?

Did some tests with 1 frame but all came out fine, even complete black frames.

Could you give more info about the settings when this happens?

DK
23rd February 2005, 15:10
this was one example when hc did not progress:


[item]
title=V01000100002001
aud_out=0
vaf_file=G:\DVD\JUNGS2\D2VAVS\V01000100002001.vaf
aud_file=G:\DVD\JUNGS2\D2VAVS\V01000100002001.mpa
file_focused=0
packet_size=2048
width=720
height=576
frame_rate_idx=3
cbr_brate=6000
vbr_brate_avg=8808
vbr_brate_min=0
vbr_brate_max=8808
seq_endcode=1
dvd=0
half_width=0
half_height=0
lum_level=0
aspect_ratio=2
gop_m=3
gop_nm=4
gop_hdr=12
seq_hdr=1
all_closed_gop=0
fix_gop_length=0
samples_per_sec=44100
stereo=2
brate_idx=7
crc=1
progressive=1
alternate_scan=0
intra_dc_prec=2
encode_mode=0
vmode=1
fast_mode=0
quality_prec=24
timecode=0x0000000
vid_file0=G:\DVD\JUNGS2\D2VAVS\V01000100002001.m2v
vid_file1=G:\DVD\JUNGS2\D2VAVS\V01000100002001.m2v
vid_out=1
vaf_out=1
opv_q_factor=20
opv_brate_min=0
opv_brate_max=8808
vbr_bias=25
vbr_pass=2
use_filter=0
filter_val=6
non_linear=1
top_first=0
mpeg1=0
mpeg1_cps=1

[file]
name=G:\DVD\JUNGS2\D2VAVS\V01000100002001.avs
frame_first=0
frame_last=1
encode_first=0
encode_last=1

++++++++++++

this was the next segment that didnt work:

[item]
title=V01000500006001
aud_out=0
vaf_file=G:\DVD\JUNGS2\D2VAVS\V01000500006001.vaf
aud_file=G:\DVD\JUNGS2\D2VAVS\V01000500006001.mpa
file_focused=0
packet_size=2048
width=720
height=576
frame_rate_idx=3
cbr_brate=6000
vbr_brate_avg=410
vbr_brate_min=0
vbr_brate_max=8808
seq_endcode=1
dvd=0
half_width=0
half_height=0
lum_level=0
aspect_ratio=2
gop_m=3
gop_nm=4
gop_hdr=12
seq_hdr=1
all_closed_gop=0
fix_gop_length=0
samples_per_sec=44100
stereo=2
brate_idx=7
crc=1
progressive=0
alternate_scan=1
intra_dc_prec=2
encode_mode=0
vmode=1
fast_mode=0
quality_prec=24
timecode=0x0000000
vid_file0=G:\DVD\JUNGS2\D2VAVS\V01000500006001.m2v
vid_file1=G:\DVD\JUNGS2\D2VAVS\V01000500006001.m2v
vid_out=1
vaf_out=1
opv_q_factor=20
opv_brate_min=0
opv_brate_max=8808
vbr_bias=25
vbr_pass=2
use_filter=0
filter_val=6
non_linear=1
top_first=0
mpeg1=0
mpeg1_cps=1

[file]
name=G:\DVD\JUNGS2\D2VAVS\V01000500006001.avs
frame_first=0
frame_last=1
encode_first=0
encode_last=1


++++++++++++

rebuilder created the content

hank315
24th February 2005, 15:40
That are a lot of options :)

But maybe it could all be done a lot easier.
Tried the next, RB was set to Quenc mode and let it point to HC.exe.
Modified HC so it catches the arguments, this is what came out:
http://hank315.dyndns.org/args1.jpg

This could be used to start HC direct with some other options in the ini file.
But please correct me if I'm wrong...

manolito
24th February 2005, 18:05
Yes, of course this would be the most elegant way to make HC useable under DVD Rebuilder or any application that supports QuEnc. Catch the command line arguments, just ignore the ones HC does not use, take the valid arguments and override the corresponding settings in the HC.INI file.

Some problems might occur with HC settings that QuEnc does not have like AutoGOP. DVD Rebuilder does not have a user setting for GOP length in QuEnc mode, but it does set the GOP length anyway. If you decide to support the GOP argument, AutoGOP will be no longer available.

For my little HC_CLI utility I decided to only support the minimum set of parameters that are absolutely essential, those are
Input file
Output file
Average Bitrate
Max Bitrate
Aspect Ratio
Interlaced
Everything else must be set in the HC.INI file.

Looking forward for a command line version of HC....

Cheers
manolito

DMagic1
3rd March 2005, 05:57
I just tried this with RB and the HC window opened but did nothing else. It appears the first segment to be encoded wasn't put into HC and the encode button wasn't pressed.

Also tried the beta 0.01 and on my AMD machine it says it wont run. The gui versions will run but I already stated my problem using those.

Also I don't see a HC.ini. Is there suppose to be one?

manolito
3rd March 2005, 14:31
HC_CLI only works with the non-GUI version of HC. For HC_CLI to work correctly you need these two files:
http://hank315.dyndns.org/HC.zip
http://hank315.dyndns.org/HC_0.01.zip

The GUI versions do not have a file HC.INI, so far they only take their settings interactively from the GUI.

But maybe you just want to wait a little. Hank315 is working on command line support for HC which will make HC compatible with QuEnc.

Cheers
manolito

DMagic1
3rd March 2005, 19:48
So is there anyway around HC stating that my AMD processor isn't compatible with HC?

hank315
3rd March 2005, 19:53
So is there anyway around HC stating that my AMD processor isn't compatible with HC?What kind of AMD processor is it?

jdobbs
4th March 2005, 00:38
@hank315

You want me to add support for this encoder directly into DVD-RB?

DMagic1
4th March 2005, 23:23
Originally posted by hank315
What kind of AMD processor is it?

Its my older AMD Thunderbird 1.4.

dragongodz
5th March 2005, 01:48
AMD Thunderbird 1.4.
the older, cli versions, of HC checked for both MMX and SSE. the Thunderbirds of course do not have full SSE(ISSE only) so fail the test. however hank315 said HC does only use ISSE so he changed the checking in the gui version, so that should work, try it and see.

so really you will have to wait until a new cli version comes out or buy a cpu that has full SSE. :)

DMagic1
5th March 2005, 01:55
Originally posted by dragongodz
the older, cli versions, of HC checked for both MMX and SSE. the Thunderbirds of course do not have full SSE(ISSE only) so fail the test. however hank315 said HC does only use ISSE so he changed the checking in the gui version, so that should work, try it and see.

so really you will have to wait until a new cli version comes out or buy a cpu that has full SSE. :)

Yea the gui works but I can't use the CL with the gui.

dragongodz
5th March 2005, 05:45
Yea the gui works but I can't use the CL with the gui.
which would be why i said
so really you will have to wait until a new cli version comes out or buy a cpu that has full SSE.
no ? ;)