PDA

View Full Version : HC_D2S - New plugin for DVD2SVCD


manolito
23rd December 2007, 22:23
HC_D2S is a plugin which improves the integration of the HC encoder into DVD2SVCD.


Features:

1. One-Pass VBR encodes with prediction (uses GetCQ by Amnon82)

2. Adaptive One-Pass VBR without the need for prediction

3. Hybrid One-Pass VBR (Combination of the above)

4. Improved command line support for 2-pass VBR encodes


Download link:
http://scifi.pages.at/manolito/HC_D2S/HC_D2S.zip


Before you give this plugin a try, you should be familiar with DVD2SVCD and with HCenc. It also helps if you have some understanding how 1-pass VBR works and about its limitations. (Users of D2SRoBa will feel right at home...)


Make sure to read the manual before you install the plugin.


Have fun
manolito

//EDIT//
Starting with version 0.24 (Beta) HC now includes its own 1-pass VBR mode which is FAR superior to my modest approach which makes my plugin obsolete.
The current HC_D2S plugin still improves the integration of HC into DVD2SVCD, so it can't hurt to check it out...

ChickenMan
24th December 2007, 01:29
Fantastic :) just what was needed and is working well for me. Thanks.

Fishman0919
24th December 2007, 03:31
Excellent work.

manolito
24th December 2007, 17:39
Thanks guys,

and Merry Christmas and a Happy New Year to everybody!

Cheers
manolito

bionic
24th December 2007, 18:34
Very nice christmas gift :)

Great work, its an excellent plugin :)

Seasons greetings :)

manolito
28th December 2007, 13:43
Anyone doing batch encodes with DVD2SVCD? I don't, so I probably overlooked a problem with HC_D2S which can only happen in batch encodes.

Until now the audio path is "hard coded", you have to enter the path into Prediction.ini which I think will not work in batch mode. The new version has a routine which tries to find the audio streams automatically.

If you leave the setting for Audio_Path empty (or delete the setting or enter some garbage) then the plugin will do its best to search for the audio files. The search is performed in this order:
a) Audio_Path entry in Prediction.ini
b) Video output folder
c) Subfolders of video folder
d) One level up from video folder
e) All subfolders of this folder

I believe this logic should cover most situations, but it would be nice if someone could confirm this by doing a couple of batch conversions.

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

A happy new year to everyone...
Cheers
manolito

bionic
29th December 2007, 00:42
Ive done two batches, both with two encodes of aprox 50MB 23.97 fps clips.
First batch(with audio path set in prediction.ini)
Came out ok
Second batch(no audio path set)
Also ok.

Ill do some more later when i have time :)

ChickenMan
1st January 2008, 15:19
I did a small 2 file batch conversion. No audio path set in the INI file and all worked well. My audio is always in my video folder.

Keep up the good work :)

manolito
1st January 2008, 22:25
Thanks bionic and Chickenman.

So I believe that this audio search routine is stable. I will update the readme and reupload.

Cheers
manolito

bionic
2nd January 2008, 02:11
Did another batch with 5 clips, no audio path set in prediction.ini
All files encoded to the same target dir.
All 5 encodes came out ok.

Also did a three clip batch with no audio path set in prediction.ini
But with audio path in d2s set to an audio sub dir (of the main target dir).
All 3 came out ok.

So it seems you nailed it.
Great work, thanks again and happy new year :)

Nick
2nd January 2008, 13:48
All working this end too.
Added to the plugins sticky.
I promise I will get round to updating AC3Enc soon to make it more friendly with this plugin :)

manolito
7th March 2008, 19:12
Changes:

Added support for 0.5% and 1% sample size

Added a couple of sanity checks for "Prediction.ini" entries

HCenc 0.22.1 now supports exit codes. If HC is killed during a prediction encode, the whole prediction cycle is aborted immediately.

SmartDialog now gets killed before the actual encode starts. This makes it possible to work with console windows while encoding.


Use the download link from the first post of this thread...


// Edit: Added some error checks. Please redownload...

Cheers
manolito

manolito
11th March 2008, 15:18
Changes:

Added workaround for the GetCQ issue that the HC folder name must not contain space characters. Now the whole prediction runs in a newly created temp folder.

It is no longer necessary to rename HCenc_xxx.exe to HCenc.exe (though still recommended). If the plugin does not find the file HCenc.exe in the HC folder, it will copy any file with the filespec HCenc*.exe to HCenc.exe.

Added a very basic installer (WinRAR based).


If I do not get any bug reports this will most likely be the final version. Use the download link from the first post.


Cheers
manolito

bionic
13th March 2008, 17:08
Great, thanks :)
Ill do some test encodes asap.

bionic
13th March 2008, 22:14
Did 5 encodes, using also Nics ac3 plugin, all came out great.

So green light and thumbs up from me :)

manolito
13th March 2008, 22:46
Thanks :)

Cheers
manolito

manolito
23rd March 2008, 23:32
Found a little trick to speed up the prediction process:

If you set "Speed_Tweak=1" in Prediction.ini the plugin will split the prediction process into two phases. During the first phase a sample size of 0.5% will be used. The CQ value found by this phase will then be used by the second phase (which uses the specified sample size) as the initial CQ value.

In my tests I got speed gains of sometimes more than 50% compared to the conventional prediction method. Use download link from first post...

Cheers
manolito

manolito
25th July 2008, 21:56
In addition to the Predictive OPV mode now two new OPV modes are available. I call them Adaptive OPV and Hybrid OPV.

Adaptive OPV works without using prediction by dynamically changing the quantizer during the encode based on the current size mismatch. For the general concept take a look here:
http://forum.doom9.org/showthread.php?p=1147382#post1147382

Hybrid Mode is a combination of predictive and adaptive modes to get the best of both worlds: Constant Quality plus accurate sizing.


This is from the HC_D2S manual:

Adaptive 1-pass mode:

Edit "Prediction.ini" and set Adaptive_Mode to 1 and Hybrid_Mode to 0.

For very low bitrate encodes you should check "Use extreme settings" in DVD2SVCD
under Encoder / Adv. Settings. This will change the value for INITIAL_Q to from 3.50
to 6.00 and also lift the upper CQ limit in Aggressive Mode.

The idea behind this mode is pretty simple:
Divide the encode into a fixed number of segments, encode the first segment with a "safe"
initial CQ (default is 3.50), compare the resulting size to the desired size, change the
CQ value accordingly, encode the next segment using the new CQ value, repeat
until the end of the source is reached. A simple log file will be created in the work folder
which can be helpful to compare CQ jumps.

I tried to find some "general purpose" settings for this mode which will work all the time.
These default parameters are the result of more than one hundred DVD2DVD and
AVI2DVD encodes. My desired target size is 97% to 99% of a DVD blank.
The default settings will not work well for encoding smaller clips.


Hybrid 1-pass mode:

Edit "Prediction.ini" and set Hybrid_Mode to 1. Set Sample_% to 0.5 and set Max_Runs
to 10 or even as low as 5.


This method combines prediction with adaptive mode to get the best of two worlds. It works like this:

1. Make a quick and dirty CQ prediction using 0.5% sample size and limiting the number of sample
encodes to 10 or even lower.

2. Use this CQ value as the INITIAL_Q in Adaptive Mode. Set SKIP_PERCENT to 40, set
SEGMENTS to 200. CLAMP_UPPER and CLAMP_LOWER are set to 0.60 and 0.50.

This way a big portion of the movie is encoded with a constant CQ, and for the other portion of
the movie the CQ range is highly restricted while still (hopefully) reaching the exact target size.


____________________________________________________________________

Discussion of the three OPV modes:

Predictive Mode:
Prediction is never totally accurate. If you do reach the exact target size then the quality of
the encode will be excellent. But you could also end up with an encode which is considerably
oversized or undersized depending on the movie characteristics.

Adaptive Mode:
This is the fastest mode. You will (in most cases) get a correctly sized encode, but bitrate
distribution is not optimal. This is because the quantizer can only get adjusted after a sizing
error already occurred. So the correction is always a few steps behind. Plus there will be
some overcorrection in many cases because reaching the target size is the main priority in
this mode. Still I was always pleasantly surprised by the high visual quality HC
delivers using Adaptive Mode.

Hybrid mode:
This is my preferred mode. It is only slightly slower than Adaptive Mode because
prediction does not have to be too precise here. Still you get almost "Constant Quality"
while at the same time the desired target size will be reached in most cases.


Download link is in the first post of this thread.

Enjoy
manolito

//Edit: I will regularly upload new versions with some tweaked settings without a big announcement, so it is a good idea to check for new versions here and then...

Darksoul71
3rd September 2008, 15:05
@manolito:
Some of your OPV modes are producing a lot of MPG segments which are later merged
via binary copy. This causes the same "problem" as I had with HCEnc^n and QuEnc^n.

As each segment is encoded as single movie weīll see (for example) timecode running
1 - 10 Minutes. Merging those segments to a whole MPEG2 file can cause problems
with DVD mastering tools or muxers.

Examples:
TMPEG DVD Author was only detecting the playtime of one segment when using two instances
instead of the whole movie (e.g. 45 minutes instead of 90 minutes). Pretty bad..esp if you
like to set a chapter point every 5 minutes and are only able to do so for the first half of
the movie :D

The ImagoMuxer stopped muxing at half of the playtime.
May be the timecode could cause hickups during playback in a standalone
player ? I donīt know....

I do not know if this is a problem for the use in DVD2SVCD but may I point
out that DGPulldown is a nice solution to this (potential) problem ?

Here is an example CL:
"C:\Eigene Dateien\AutoIt Projekte\HCEnc^n v0.1.6\DGPulldown.exe" "D:\D2VAVS\FitDVD_blade_1569_kBit.m2v" -o "D:\D2VAVS\FitDVD_blade_1569_kBit.fixed.m2v"

The result will be a MPEG2 file with corrected timestamps which will nicely mux with any muxer out there.

This should nicely integrate into your batchfile.

You can grab DGPulldown here:
http://neuron2.net/dgpulldown/dgpulldown.html

Cheers,
D$

manolito
3rd September 2008, 16:47
Hi D$,

thanks for your tip, but so far after more than 100 encodes I never had a problem with muxing or authoring. Mostly I use Muxman, but also Imago and two different versions of Mplex. Maybe what might save me is that I tell HC to set the sequence end code only for the very last segment?

Anyway, I do have and use DGDecode all the time for PAL2NTSC conversions. Great tool!

Thanks again and cheers
manolito

Darksoul71
3rd September 2008, 23:33
Hi manolito,

I did some research and found a one year old posting of me in the HCEnc^n thread discribing the problem:
http://forum.doom9.org/showpost.php?p=1054228&postcount=29

Centurione pointed out the setting in regard to seq end code as well:
http://forum.doom9.org/showpost.php?p=1057743&postcount=41

I think I added this to HCEnc^n as well after this posting.

If you only use the resulting file within DVD2SVCD I think everything is fine.
Binary merged M2V files without corrected timecode can cause problems
with other tools though.

Thatīs all I wanted to point out.. :)

Keep up your good work..

Cheers,
D$