View Full Version : AVStoDVD Support Thread
qyot27
10th January 2014, 13:12
As a note, I believe that the Blu-ray specs allow for 23.976 in all regions. For that matter, I think the same is also true of 25, but I'm not as sure on that (and I have no discs that it might occur on to verify it, either).
Personally, in that situation, I'd override it and make it convert to PAL. Less of a framerate difference and such, and no quibbling over whether you have to account for a denominator of 1001 or 1000 when trying to do a chapter conversion (also, '30fps' is often used as a shorthand for anything with a numerator of 30000, just like '24fps' is sometimes for 24000 numerators - because 30000/1000 isn't compliant with the DVD spec, the shorthand is probably what you're seeing there).
manolito
16th January 2014, 20:39
Here's a somewhat delayed Xmas present for Fishman0919...:)
I made a small wrapper for ffmpeg.exe which enables 1-pass and also 2-pass VBR encodes using ffmpeg. The 2-pass command line is taken from this post:
http://forum.doom9.org/showthread.php?p=1651880#post1651880
Here is the readme:
ffmpeg VBR modes for AVStoDVD
------------------------------------
This small utility allows 1-pass VBR and high quality 2-pass VBR encodes
using ffmpeg under AVStoDVD.
Installation:
1. Go to the "AVStoDVD\FFmpeg" folder and rename the original "ffmpeg.exe"
to "_ffmpeg.exe". This name is hard coded into the script and cannot
be changed.
2. Extract the two files "ffmpeg.exe.vbr" and "ff_vbr.bat" into this folder,
then rename "ffmpeg.exe.vbr" to "ffmpeg.exe".
Usage:
With the AVStoDVD default settings nothing changes at all (hopefully).
For medium and lower bitrates the HCenc encoder is used by default.
If you override this setting and force ffmpeg CBR, now ffmpeg will operate
in 1-pass VBR mode instead.
If your bitrate is below 3500k AND you have activated the ffmpeg high
quality mode, ffmpeg will run in a high quality 2-pass VBR mode.
(command line parameters courtesy of Fishman0919)
Download here: //EDIT// Link removed
I have tested it quite a bit with ffmpeg version 2.1.1, on my Windows XP machine it is very stable. I do not know however if renaming ffmpeg.exe in a folder under "program files" will work under Win7 or Win8. If it doesn't, you probably know the usual workarounds (Take Ownership or install AVStoDVD outside of program files). The script itself only writes into the specified output folder which should not be a problem.
The provided "ffmpeg.exe.vbr" is just a compiled batch file which only calls ff_vbr.bat. Not too elegant, but "ffmpeg.exe" is hard coded into the AVStoDVD executable, and I really did not want to patch the executable.
There are a couple of things I noticed while I made this thing, maybe one of you guys has some answers:
I noticed that AVStoDVD sets a buffer size of 2000k by default. According to the DVD specs this is a little high, it should be 1835k according to Hank315. Is there a special reason for this?
In 2-pass mode using Fishmans parameters, ffmpeg issues a warning:
ME_MAP size may be a little small for the selected diamond size
Is this something serious or should I ignore it?
When I was comparing 1-pass VBR mode to good old QuEnc I noticed that ffmpeg has a tendency to undersize quite a bit, sometimes by almost 20%. This was for an already low bitrate of 3900k. While QuEnc 1-pass and HCenc 1-pass both had no problems, ffmpeg only reached a bitrate of a little over 3000k.
I then tried to specify a minimum quantizer of 1, but it did not help very much. Are there any parameters I can use to avoid this undersizing without compromising speed?
Whatever, please test my little tool and let me know what should be improved....
Cheers
manolito
Fishman0919
17th January 2014, 02:03
Thank you kind sir.... I'll give this a try tonight :)
ME_MAP size may be a little small for the selected diamond size
That because I set the diamond size to 5... ffmpeg think 3 should be enough. little gain for little speed lost. -pre_dia_size 5 -dia_size 5
When I was comparing 1-pass VBR mode to good old QuEnc I noticed that ffmpeg has a tendency to undersize quite a bit, sometimes by almost 20%. This was for an already low bitrate of 3900k. While QuEnc 1-pass and HCenc 1-pass both had no problems, ffmpeg only reached a bitrate of a little over 3000k.
I then tried to specify a minimum quantizer of 1, but it did not help very much. Are there any parameters I can use to avoid this undersizing without compromising speed?
-lmin 0.01 -mblmin 1 -qmin 1 -qmax 31
Let ffmpeg go down to 0.01 quantizer
ffmpeg.exe -i "####.avs" -framerate 23.976 -aspect 16:9 -dc # -g 12 -maxrate 7500k -b_strategy 2 -brd_scale 2 -bf 2 -profile:v 4 -lmin 0.01 -mblmin 1 -qmin 1 -qmax 31 -maxrate 7500k -b:v ####k -bf 2 -pre_dia_size 5 -dia_size 5 -qcomp 0.7 -qblur 0 -preme 2 -me_method dia -sc_threshold 0 -sc_factor 4 -bidir_refine 4 -profile:v 4 -mbd rd -mbcmp satd -precmp satd -cmp satd -subcmp satd -skipcmp satd -pass 1 -passlogfile ffmpeg -an -f mpeg2video pass1.m2v
...would be a good 1 pass
EDIT:
If your bitrate is below 3500k AND you have activated the ffmpeg high
quality mode, ffmpeg will run in a high quality 2-pass VBR mode.
(command line parameters courtesy of Fishman0919)
?? Where would I do that?
@ECHO off
SET FF_DRIVE=%~d0
SET FF_PATH=%~p0
SET ORIGINAL=%*
SET CMDLINE=
SET /A bitrate=8500
SET hq=0
manolito
17th January 2014, 10:55
Thanks Fishman for the tips, time for some more testing...
?? Where would I do that?
Here:
http://i43.tinypic.com/24v7l1v.jpg
The hq variable is initialized to 0 first, then if the "-trellis" parameter is detected in the commandline issued by AVStoDVD it is changed to 1.
IF %1==-trellis SET hq=1
.....
IF %bitrate% LSS 3500 IF %hq%==1 GOTO 2pass
I could have omitted the initialization, but then the hq check would have to be:
IF !%hq%==!1
Cheers
manolito
manolito
17th January 2014, 14:21
Yes, the -lmin and -mblmin parameters really did the trick. No more undersizing in 1-pass VBR mode.
The ffmpeg defaults for both values are 236, so I figured that 0.01 or 1 could be a little agressive. So I did some tests with a 5min chunk of a critical source. I set the bitrate to 4000k, and without the -lmin and -mblmin parameters the encode came out at 2898k.
With values of 0.01 and 1 I did get 4000k, but in darker scenes the bitrate was much higher than with HCenc 1-pass. After playing around a little bit I found that the sweet spot for both -lmin and -mblmin values lies at 170 for me.
I already modified the batch file and uploaded it, this is the link:
//EDIT// Link removed
Cheers
manolito
Fishman0919
18th January 2014, 05:58
Yes, the -lmin and -mblmin parameters really did the trick. No more undersizing in 1-pass VBR mode.
The ffmpeg defaults for both values are 236, so I figured that 0.01 or 1 could be a little agressive. So I did some tests with a 5min chunk of a critical source. I set the bitrate to 4000k, and without the -lmin and -mblmin parameters the encode came out at 2898k.
With values of 0.01 and 1 I did get 4000k, but in darker scenes the bitrate was much higher than with HCenc 1-pass. After playing around a little bit I found that the sweet spot for both -lmin and -mblmin values lies at 170 for me.
I already modified the batch file and uploaded it, this is the link:
http://www7.zippyshare.com/v/81023194/file.html
Cheers
manolito
Thanks for the updated batch... :)
Sweet spot 170?... 1.70, .170
EDIT: IF %1==-maxrate SET CMDLINE=%CMDLINE% -maxrate 8500k -qmin 1 -lmin 170 -mblmin 170
I believe/thought the default for both was 3... it's been awhile. Odd that 170 works well for you... seems a bit high... but if it works :D
The bitrate is probably higher then HC in darker scenes because ffmpeg uses the Mpeg Standard maxtic by default and isn't using AQM... trying to retain more detail.
In my testing I found that FFMpeg is OK at best in 1 pass encoding.... unless you turn all the setting to the max and bring the encoding to a crawl.
With AVStoDVD v2.7.2... I get no option...
http://i467.photobucket.com/albums/rr37/fishman0919/AVStoDVD_zps3e58bb85.jpg (http://s467.photobucket.com/user/fishman0919/media/AVStoDVD_zps3e58bb85.jpg.html)
manolito
18th January 2014, 09:04
Thanks for the updated batch... :)
Sweet spot 170?... 1.70, .170
EDIT:
I believe/thought the default for both was 3... it's been awhile. Odd that 170 works well for you... seems a bit high... but if it works :D
Hi Fishman,
from the ffmpeg 2.2.1 help:
-lmin <int> E..V.. minimum Lagrange factor (VBR) (from 0 to INT_MAX) (default 236)
-mblmin <int> E..V.. minimum macroblock Lagrange factor (VBR) (from 1 to 32767) (default 236)
Some more tests make it appear as if there is a hard switch between the values of 170 and 180. Using 180 makes ffmpeg behave just as if the defaults of 236 are used, i.e. heavy undersizing. Weird...
BTW what the hell is the "Lagrange Factor"? I thought that I already knew a little bit about MPEG2 encoding, but obviously I was wrong. :o
The bitrate is probably higher then HC in darker scenes because ffmpeg uses the Mpeg Standard maxtic by default and isn't using AQM... trying to retain more detail.
In my testing I found that FFMpeg is OK at best in 1 pass encoding.... unless you turn all the setting to the max and bring the encoding to a crawl.
I only need the 1-pass VBR mode for encodes where the source quality is already questionable, and my first objective is that it must fast. Faster than HCenc 1-pass. And this is the case with your help now, I am happy with it. :)
With AVStoDVD v2.7.2... I get no option...
You are looking at the wrong place...:devil:
This option is not under "Preferences", it is under "View/Edit Title Settings" for each loaded source file.
Cheers
manolito
manolito
18th January 2014, 13:58
Sweet spot 170?... 1.70, .170
EDIT:
Quote: IF %1==-maxrate SET CMDLINE=%CMDLINE% -maxrate 8500k -qmin 1 -lmin 170 -mblmin 170
I believe/thought the default for both was 3... it's been awhile. Odd that 170 works well for you... seems a bit high... but if it works
OK, I think I found the explanation for these odd values.
From the ffmpeg manual:
The four options lmin, lmax, mblmin and mblmax use ’lambda’ units, but you may use the QP2LAMBDA constant to easily convert from ’q’ units: ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
The value of the QP2LAMBDA constant is 118. You are still using the Q units while the current ffmpeg versions use the lambda units.
Here is a small conversion table:
Q Lambda
_________________________________________________
Default 2 236
lmin 0.01 1.18
mblmin 1 118
My sweet
spot 1.44 170
Seems like I should make more tests to see if I really should use the same values for lmin and mblmin for my "sweet spot". And your 2-pass command line should probably be modified also by adding "*QP2LAMBDA" to your values.
Cheers
manolito
manolito
18th January 2014, 16:49
Alright, another (and hopefully final) version of my tool...;)
//EDIT// Link removed
For the quick 1-pass VBR mode I changed -lmin to 175 and left -mblmin at its default value of 236. Works well on my test files.
I also took the liberty to convert the 2-pass parameters from the old q units to lambda units. Now it looks like:
-lmin 1.18 -mblmin 118
Cheers
manolito
Fishman0919
18th January 2014, 21:25
Hi Fishman,
from the ffmpeg 2.2.1 help:
Some more tests make it appear as if there is a hard switch between the values of 170 and 180. Using 180 makes ffmpeg behave just as if the defaults of 236 are used, i.e. heavy undersizing. Weird...
BTW what the hell is the "Lagrange Factor"? I thought that I already knew a little bit about MPEG2 encoding, but obviously I was wrong. :o
I only need the 1-pass VBR mode for encodes where the source quality is already questionable, and my first objective is that it must fast. Faster than HCenc 1-pass. And this is the case with your help now, I am happy with it. :)
You are looking at the wrong place...:devil:
This option is not under "Preferences", it is under "View/Edit Title Settings" for each loaded source file.
Cheers
manolito
A multivariable calculus technique.
LINK (http://wmueller.com/precalculus/families/lagrange.html)
EDIT: A few test runs and all seems to be working fine... thank you for your work ;)
Fishman0919
19th January 2014, 07:20
I did a couple of tests on 2 pass encodings with -lmin 1.18 -mblmin 118
The Hobbit: An Unexpected Journey (BluRay)
ffmpeg -lmin 1.18 -mblmin 118 - 4.24g
ffmpeg -lmin 0.01 -mblmin 1 - 4.33g
HC - 4.32g
Saving Private Ryan (BluRay)
ffmpeg -lmin 1.18 -mblmin 118 - 4.26g
ffmpeg -lmin 0.01 -mblmin 1 - 4.32g
HC - 4.32g
-lmin 1.18 -mblmin 118 seems to have a hard time with dark movies... I'll play with the setting to find a point where it works for 2 pass encodings.
I also added the Standard Matrix to the command line... works better with encodings below 3500k. Will do some testing to see if QuEnc's QLB matrix will work better.
Mpeg Standard Matrix (Default)
-intra_matrix "8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83" -inter_matrix "16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16"
Standard Matrix.
-intra_matrix "8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83" -inter_matrix "16,17,18,19,20,21,22,23,17,18,19,20,21,22,23,24,18,19,20,21,22,23,24,25,19,20,21,22,23,24,26,27,20,21,22,23,25,26,27,28,21,22,23,24,26,27,28,30,22,23,24,26,27,28,30,31,23,24,25,27,28,30,31,33"
QLB Matrix
-intra_matrix "8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,37,39,22,22,26,27,29,34,38,42,22,26,27,29,32,36,40,50,26,27,29,32,36,40,50,61,26,27,29,35,40,50,59,75,27,29,35,40,50,59,75,89" -inter_matrix "16,17,18,19,20,21,22,23,17,18,19,20,21,22,23,25,18,19,20,21,22,23,24,26,19,20,21,22,23,24,26,28,20,21,22,23,25,26,28,29,21,22,23,24,26,28,29,31,22,23,24,26,28,29,31,34,23,24,25,28,29,31,34,38"
manolito
19th January 2014, 10:47
Thanks Fishman for your tests. The reason I modified your original values was that I thought you had used them assuming they were "q" units.
For lower bitrate encodes I am a big fan of the MANONO matrices. Maybe you can include them in your tests.
Manono1
-intra_matrix "8,8,8,9,11,13,14,17,8,8,9,11,13,13,14,17,8,8,11,12,13,14,17,94,9,11,13,13,14,17,17,94,11,11,13,13,14,17,94,94,13,13,14,16,17,20,94,94,13,13,14,17,94,94,94,94,13,14,17,94,94,94,94,94" -inter_matrix "12,12,13,14,15,16,22,26,12,13,14,15,16,22,26,32,13,14,15,16,22,26,32,41,14,15,16,22,26,32,41,53,15,16,22,26,32,41,53,94,16,22,26,32,41,53,70,94,22,26,32,41,53,70,94,94,26,32,41,53,94,94,94,94"
The MANONO 2 matrix (aka Sony Medium) is also very good, it is less radical at the higher frequencies.
Manono2
-intra_matrix "8,12,13,14,15,16,19,22,12,13,14,15,16,19,22,26,13,14,15,16,19,22,26,32,14,15,16,19,22,26,32,41,15,16,19,22,26,32,41,53,16,19,22,26,32,41,53,70,19,22,26,32,41,53,70,94,22,26,32,41,53,70,94,127" -inter_matrix "12,12,13,14,15,16,19,22,12,13,14,15,16,19,22,26,13,14,15,16,19,22,26,32,14,15,16,19,22,26,32,41,15,16,19,22,26,32,41,53,16,19,22,26,32,41,53,70,19,22,26,32,41,53,70,94,22,26,32,41,53,70,94,127"
I will leave the testing of the 2-pass parameters to you, because I have a hard time making out small differences on my old CRT tv set. Looking forward to your results...:)
Cheers
manolito
MrC
19th January 2014, 15:42
manolito, Fishman0919, what about adding the 'ffmpeg_vbr.zip' package to the AddOns stuff (https://sourceforge.net/projects/avstodvd/files/avstodvd_addons/) on SourceForge? Just tell me when you are confident and satisfy enough. Of course it would be better to have the option available directly in AVStoDVD. Another item in the ToDo list. ;)
Meanwhile 2.7.3 release is finally out (https://sourceforge.net/projects/avstodvd/files/avstodvd/AVStoDVD%202.7.3/). Change log:
- Some bugs fixed
- Added 'Preferred DirectShow Codecs Setup' section
- Added SetACL 2.0.3.0 (LGPL by Helge Klein) to AVStoDVD package
- Improved framerate conversion section of AviSynth script generation routine
- Updated A2DSource.avsi to properly handle non-mod4 width sources (thanks to manolito)
- FFmpeg updated to 2.1 (git-9244a68)
;)
Bye
soneca
19th January 2014, 19:15
Thanks MrC! :cool:
Fishman0919
20th January 2014, 04:28
manolito, Fishman0919, what about adding the 'ffmpeg_vbr.zip' package to the AddOns stuff (https://sourceforge.net/projects/avstodvd/files/avstodvd_addons/) on SourceForge? Just tell me when you are confident and satisfy enough. Of course it would be better to have the option available directly in AVStoDVD. Another item in the ToDo list. ;)
Meanwhile 2.7.3 release is finally out (https://sourceforge.net/projects/avstodvd/files/avstodvd/AVStoDVD%202.7.3/). Change log:
- Some bugs fixed
- Added 'Preferred DirectShow Codecs Setup' section
- Added SetACL 2.0.3.0 (LGPL by Helge Klein) to AVStoDVD package
- Improved framerate conversion section of AviSynth script generation routine
- Updated A2DSource.avsi to properly handle non-mod4 width sources (thanks to manolito)
- FFmpeg updated to 2.1 (git-9244a68)
;)
Bye
Awesome... thanks for the update.
I did a few more test and found that -lmin 0.75 -mblmin 50 seem to work very well on my test movies... bitrates hitting the target. Dark scene still look good without bitrates peaking to high. I also noticed that moving grass and still walls look better... -lmin 1.18 -mblmin 118 may have looked somewhat better on these but seemed to fail in the dark areas.
I'm running a couple more movies right now but -lmin 0.75 -mblmin 50 seems pretty good for 2 pass encodings.
Fishman0919
20th January 2014, 08:41
I think the settings for FFMpeg are are pretty good now for 2 pass encoding. Quality is good, speed is good and it's hitting the target bitrate for bright and dark movies.
I stayed with the Standard Matrix because of compatibility with some DVD players and it just seemed to work well with FFMpeg below 3500k.
I think I dialed in the setting pretty good on my test with "Man of Steel" BluRay encoded at 3200k. A bitrate view of HC026_beta_16-06-2011, CCE-Basic 2.70 01.16 and ffmpeg-2.1.1
http://i467.photobucket.com/albums/rr37/fishman0919/bitrates_zpsc1a7dd22.jpg (http://s467.photobucket.com/user/fishman0919/media/bitrates_zpsc1a7dd22.jpg.html)
Here are my 2 pass settings...
@ECHO on
_ffmpeg.exe -i %in% -aspect %aspect% -dc %dc% -g 12 -maxrate 7500k -q:v 2 -b_strategy 2 -brd_scale 2 -bf 2 -profile:v 4 -intra_matrix "8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83" -inter_matrix "16,17,18,19,20,21,22,23,17,18,19,20,21,22,23,24,18,19,20,21,22,23,24,25,19,20,21,22,23,24,26,27,20,21,22,23,25,26,27,28,21,22,23,24,26,27,28,30,22,23,24,26,27,28,30,31,23,24,25,27,28,30,31,33" -pass 1 -passlogfile "%out_path%ffmpeg" -an -f mpeg2video %il% "%out_name%_pass1.m2v"
_ffmpeg.exe -i %in% -aspect %aspect% -dc %dc% -g 12 -lmin 0.75 -mblmin 50 -qmin 1 -qmax 31 -maxrate 7500k -b:v %bitrate%k -bf 2 -pre_dia_size 5 -dia_size 5 -qcomp 0.7 -qblur 0 -preme 2 -me_method dia -sc_threshold 0 -sc_factor 4 -bidir_refine 4 -profile:v 4 -mbd rd -mbcmp satd -precmp satd -cmp satd -subcmp satd -skipcmp satd -intra_matrix "8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83" -inter_matrix "16,17,18,19,20,21,22,23,17,18,19,20,21,22,23,24,18,19,20,21,22,23,24,25,19,20,21,22,23,24,26,27,20,21,22,23,25,26,27,28,21,22,23,24,26,27,28,30,22,23,24,26,27,28,30,31,23,24,25,27,28,30,31,33" -pass 2 -passlogfile "%out_path%ffmpeg" -an -f mpeg2video %il% %out%
manolito
20th January 2014, 11:31
Thanks a lot Fishman. Those bitrate views look excellent to me. I think that I will also add the standard matrix to the 1-pass VBR mode. AFAIK the MPEG Standard matrix with all non-intra coefficients set to 16 was never a good choice for DVD encodes, at least this is what I read about all the common MPEG2 encoders.
Maybe even the high bitrate CBR mode would profit from using the standard matrix. I will add it in my next upload.
manolito, Fishman0919, what about adding the 'ffmpeg_vbr.zip' package to the AddOns stuff on SourceForge? Just tell me when you are confident and satisfy enough.
I like the idea, thank you for your trust...;)
It looks like Fishman has finalized the 2-pass parameters, so this part is probably final. I will add the standard matrix to the 1-pass VBR mode, and maybe the standard matrix is also a better choice for the CBR mode. I will need your advice on this. Finally I probably should polish the documentation a little bit and convert it to PDF.
Also did you notice my question about the buffer size of 2000k in CBR mode? Any special reason for this slightly higher size?
And of course thanks for the new version, I will install it right away and run a few tests. Also letting you know that I have been using LAV filters (0.60 and 0.60.1) for some time now without any issues. I cannot test the correct channel assignment though, the LAV mixer is disabled by default, and I kept it that way.
Cheers
manolito
manolito
20th January 2014, 14:09
Here we go...
//EDIT// Link removed
I added Fishman's new parameters to the 2-pass section, 1-pass VBR also uses the standard matrix, and for the default 1-pass CBR mode I also added the standard matrix, but left it deactivated for now.
If you want to try the standard matrix in 1-pass CBR mode, open the batch file with an editor, go to the label ":dont_touch" and delete the "REM" in front of the corresponding line. Save the file and have fun...
Cheers
manolito
Fishman0919
21st January 2014, 04:33
Here we go...
http://www32.zippyshare.com/v/59964280/file.html
I added Fishman's new parameters to the 2-pass section, 1-pass VBR also uses the standard matrix, and for the default 1-pass CBR mode I also added the standard matrix, but left it deactivated for now.
If you want to try the standard matrix in 1-pass CBR mode, open the batch file with an editor, go to the label ":dont_touch" and delete the "REM" in front of the corresponding line. Save the file and have fun...
Cheers
manolito
Thank You!
manolito
22nd January 2014, 12:58
New findings:
It seems that the error when using DGindex was not my fault. The hidden ffmpeg call for NUL output has these parameters:
-i "I:\AVSInfo.avs" -f rawvideo -y NUL
I did intercept these parameters and called _ffmpeg.exe with correct parameters, but I still got a timeout error whenever the MPEG2 source file was longer than 1 minute.
Next I removed my VBR tool completely and tried to use DGindex on a 10 minutes long MPEG2 file, and again I got the timeout error.
Conclusion: Even if my computer is old and slow, this timeout error should not happen. Using ffmpeg for NUL encoding seems to be VERY much slower than the former AVS2AVI method. Using DGindex is completely impossible on my computer. Either the timeout must be removed, or something other than ffmpeg should be used for this (AVSmeter?).
So I will leave my VBR tool as it is for the moment, just keep in mind to avoid using DGindex.
Cheers
manolito
manolito
22nd January 2014, 16:59
Alright, after several more hours of testing this is what I came up with:
I used the new version 2.73 for my tests, everything worked without problems. One question, though:
- Improved framerate conversion section of AviSynth script generation routine
What does this exactly mean? I could not see any difference compared to the latest alpha test versions.
I did go back to ffdshow and Haali for my tests, and there are still problems when trying to convert non-mod4 MPEG files. ffmpegsource2 throws an error, so I made a modified A2DSource.avsi which reverts to DirectShowSource with forced YUY2 output as a last resort. This not needed when using LAV filters.
The modified files plus a test MPEG source file are here:
//EDIT
Links not valid any more
Now my ffmpeg-VBR tool:
I uploaded a new version with the following changes:
1-pass VBR maxrate reduced to 8000k. In one of my tests I made MuxMan choke on a source with 2 high bitrate audio tracks (PCM plus 448k AC3). The slightly reduced maxrate took care of it.
For the DGindex issue I modified the ffmpeg.exe.vbr stub to make the ffmpeg folder the active folder before doing anything else. The parameters -i "I:\AVSInfo.avs" -f rawvideo -y NUL are passed to _ffmpeg.exe correctly. But unless your computer is very fast you might still get a timeout error. In this case just avoid DGindex...:p
//EDIT// Link removed
//EDIT// Added some custom quant matrices and edited the readme. Please redownload...
The plugin is now available permanently on the AVStoDVD SourceForge page:
http://sourceforge.net/projects/avstodvd/files/avstodvd_addons/ff_vbr.bat%20(ffmpeg%20VBR%20modes)/
Cheers
manolito
Guest
22nd January 2014, 17:54
The only thing you can do right now is to either not use DGindex I don't fully understand your issue but if you think there is something I can change in DGIndex to help with it, please let me know and I will get right on it. There should be no reason for people to avoid DGIndex.
manolito
22nd January 2014, 21:44
Uh Oh, what did I do...:o
Hi Don, thanks for chiming in. I would never say anything to the effect of "Avoid to use DGIndex". What I wanted to say in this case is "If you are experiencing timeout errors while using DGIndex from within AVStoDVD, unfortunately the only thing you can do right now is to avoid using DGIndex and use the standard approach (DirectShowSource or ffmpegsource2)".
DGIndex works perfectly, there is nothing you can do to make it work even better under AVStoDVD. The timeout error occurs after DGIndex has done its thing.
If you are interested, here's a short explanation. Normally AVStoDVD uses a source filter selection routine which tries AVISource, DirectShowSource and ffmpegsource2. The exception is when an MPEG2 source file is detected. In this case a window pops up strongly recommending to use DGIndex. Only if the user declines the standard approach is used.
Right after DGIndex has finished, AVStoDVD calls a routine to gather some information about the source files. This involves calling some encoder where the output is redirected to the NUL device. It used to be AVS2AVI, but after some issues with it MrC switched to ffmpeg. (Qyot027 suggested to use AVSMeter IIRC). All this happens hidden to the user, there is no visible window. And there is a timeout of 60 seconds built into this routine.
Now comes my little plugin which extends the ffmpeg capabilities to include 1-pass VBR and 2-pass VBR modes. To do this I had to use some ugly tricks to hack into ffmpeg.exe, because AVStoDVD itself is not very "hack friendly". All paths and file names of helper applications are hard coded into the executable. So I had to be really careful not to break any other ffmpeg uses (like demuxing and audio encoding) while trying to expand video encoding.
So when I first got this timeout error my first thought was of course that I had screwed up somewhere, probably failing to pass the intercepted parameters correctly. But it turned out that I was (almost) not to blame at all, the timeout error also turned up when my plugin was completely uninstalled.
So this is not a DGIndex issue at all, it is an AVStoDVD issue. I hope I didn't bother you too much with the details, Thanks for offering your help...;)
Cheers
manolito
Guest
22nd January 2014, 21:52
I don't understand your description of why the problem occurs only with DGIndex.
manolito
23rd January 2014, 11:47
It only happens when using DGIndex as the source filter because this information gathering routine is only executed after indexing with DGIndex.
The old CLI command was:
"C:\Programmi\AV\AVStoDVD Dev\Avs2Avi\avs2avi.exe" "C:\Programmi\AV\AVStoDVD Dev\Lib\AVSInfo Example.avs" -c "null" -o n
But MrC changed it to the current:
"C:\Program Files\AVStoDVD\FFMpeg\ffmpeg.exe" -i "I:\AVSInfo.avs" -f rawvideo -y NUL
And this last routine takes forever on my computer, so I get a timeout error for any MPEG2 source file longer than 1 minute.
I can't say that I fully understand why this routine is necessary. It is executed in a hidden mode, and it is not well documented. For all other source filters this routine is not executed, it seems only to be necessary when using DGIndex.
Cheers
manolito
Groucho2004
23rd January 2014, 12:46
Right after DGIndex has finished, AVStoDVD calls a routine to gather some information about the source files. This involves calling some encoder where the output is redirected to the NUL device. It used to be AVS2AVI, but after some issues with it MrC switched to ffmpeg. (Qyot027 suggested to use AVSMeter IIRC). All this happens hidden to the user, there is no visible window. And there is a timeout of 60 seconds built into this routine.
I don't understand why an external tool like ffmpeg has to be involved for retrieving the info from an avs file. It's just a few lines of code to do that. Examples for coding this are out there.
MrC
23rd January 2014, 14:13
Let's make some clarifications.
I have written an AviSynth script to analyze properties of .avs input files (A2DInfo.avsi).
The A2DInfo function must be somehow called.
The less invasive method to call it is to use the "null" output with avs2avi.exe or the "-y NUL" with ffmpeg.exe
From release 2.7.1 I have replaced avs2avi with ffmpeg for that purpose, in order to reduce the quantity of third part software distributed with AVStoDVD
To read .d2s files properties I create an .avs file that open the .d2s. Hence the same A2DInfo function is used
DGIndex is not involved in this issue, because DGIndex is only used to index mpeg2 input files and to create the .d2s file.
I was not aware that the d2s->avs->A2DInfo->ffmpeg chain is troublesome for slow systems. I can increase the timeout from 60s to 120s. Or have avs2avi come in help in case of timeout.
Of course I am open to change anything necessary to improve the AVStoDVD reliability and ease-of-use.
;)
Bye
MrC
23rd January 2014, 14:25
I used the new version 2.73 for my tests, everything worked without problems. One question, though:
What does this exactly mean? I could not see any difference compared to the latest alpha test versions.
Better handling of interlaced source.
PullDown only if source is (originally or made) progressive.
Release 2.7.2
VideoStandardStr = "pal_video"
[...]
If VideoStandard = NTSC Then
VideoStandardStr = "ntsc_video"
[...]
End If
' Adjust FPS
If FPS < 2 / 3 * InputFPS Then
Str = "Video = Video.ChangeFPS(""" & VideoStandardStr & """)" & vbCrLf
Else
Str = "Video = Video.ConvertFPS(""" & VideoStandardStr & """)" & vbCrLf
End If
If .InputVideoInfo.FrameRateMode = "CFR" Then
Select Case Round(InputFPS - FPS, 3)
Case Is = 0
Str = ""
Case Is > 0
If InputFPS = 2 * FPS Then
Str = "Video = Video.SelectEven()" & vbCrLf
Else
Str = "Video = Video.ChangeFPS(""" & VideoStandardStr & """)" & vbCrLf
End If
Case Is < 0
Select Case InputFPS
Case 23.976, 24, 25, 29.97, 30, 50, 59.94, 60 'only these fps are mpeg2 compliant
Str = "#Using DGPulldown/HCenc to upsize FPS" & vbCrLf
End Select
If Preferences.PALSpeedUp = True And FPS = 25 And InputFPS = 23.976 Then
Str = "#Using AssumeFPS() to upsize FPS" & vbCrLf 'see below
End If
End Select
End If
Release 2.7.3
' Adjust FPS
If InStr(1, Create_AVSScript, "LeakKernelBob(") <> 0 Then
If VideoStandard = PAL Then
sFPS = "50"
Else
sFPS = "59.94"
End If
Else
If VideoStandard = PAL Then
sFPS = "25"
Else
sFPS = "29.97"
End If
End If
Str = "Video = Video.ChangeFPS(" & sFPS & ")" & vbCrLf
If FPS < 2 / 3 * InputFPS Then
Str = "Video = Video.ConvertFPS(" & sFPS & ")" & vbCrLf
End If
If .InputVideoInfo.FrameRateMode = "CFR" Then
Select Case Round(InputFPS - FPS, 3)
Case Is = 0
Str = ""
Case Is > 0
If InputFPS = 2 * FPS Then
Str = "Video = Video.SelectEven()" & vbCrLf
End If
Case Is < 0
If InputInterlaced = False Or .AVSDeInterlace = True Then
Select Case InputFPS
Case 23.976, 24, 25, 29.97, 30, 50, 59.94, 60 'only these fps are mpeg2 compliant
Str = "#Using DGPulldown/HCenc to upsize FPS" & vbCrLf
End Select
If Preferences.PALSpeedUp = True And FPS = 25 And InputFPS = 23.976 Then
Str = "#Using AssumeFPS() to upsize FPS" & vbCrLf 'see below
End If
End If
End Select
End If
;)
Bye
manolito
23rd January 2014, 17:11
Hi MrC,
thanks for the detailed explanation of the new routine for handling interlaced content. Since I almost never do NTSC conversions I probably would have never noticed it...
Regarding the timeout error I get when converting MPEG2 sources using DGIndex, I really wanted to find out what's going on, and the result is pretty clear:
It is NOT my slow computer, it is ffmpeg.
I went back to AVStoDVD version 2.70 which still uses AVS2AVI, and with this version I got no problems at all. Even a big 4.35 GB MPEG2 source file did not cause a timeout.
So why is ffmpeg so damned slow when using "null" output? I also tried a couple of different ffmpeg versions, but this did not make any difference.
One thing I don't understand is why can't you use the same method for gathering this source information which you also use for the other source filters? Is there some info in the d2v file which you cannot get from the MPEG file? Since forcing DirectShowSource or ffmpegsource2 for these files works, and all the necessary information can be retrieved, this should also work when using DGIndex. Get the information from the MPEG2 file and use the d2v just for decoding.
Whatever, I think that just increasing the timeout value is not a good idea. Some other method should be used. Just my two cents...;)
Cheers
manolito
Groucho2004
23rd January 2014, 17:37
I have written an AviSynth script to analyze properties of .avs input files (A2DInfo.avsi).
The A2DInfo function must be somehow called.
The less invasive method to call it is to use the "null" output with avs2avi.exe or the "-y NUL" with ffmpeg.exe
I took some time and looked at the code that you use to gather the AVS info. No offence, but it gives me the creeps. Running ffmpeg in a timed loop and then brutally killing it - yikes.
I suggest you use AVSMeter with the "-i" switch instead of ffmpeg or avs2avi. It just reads the script, gathers the info and then exits without reading any frames (so you don't have to kill it).
An even better option would be to skip the "A2DInfo.avsi" thing altogether and write the avs properties directly to a text file. I might even have the code for that somewhere.
MrC
23rd January 2014, 19:43
thanks for the detailed explanation of the new routine for handling interlaced content. Since I almost never do NTSC conversions I probably would have never noticed it...
We are lucky to live in a PAL country. ;)
Regarding the timeout error I get when converting MPEG2 sources using DGIndex, I really wanted to find out what's going on, and the result is pretty clear:
It is NOT my slow computer, it is ffmpeg.
I went back to AVStoDVD version 2.70 which still uses AVS2AVI, and with this version I got no problems at all. Even a big 4.35 GB MPEG2 source file did not cause a timeout.
So why is ffmpeg so damned slow when using "null" output? I also tried a couple of different ffmpeg versions, but this did not make any difference.
May I say that the issue is ffmpeg *on* slow computers? I have currently a core i5 @ 3.1GHz (desktop) and a core 2 Duo @ 1.8GHz (laptop), no issue on both.
BTW, going back to avs2avi may be a good option, also to preserve the functionality of the ffmpeg vbr tool. :)
One thing I don't understand is why can't you use the same method for gathering this source information which you also use for the other source filters? Is there some info in the d2v file which you cannot get from the MPEG file? Since forcing DirectShowSource or ffmpegsource2 for these files works, and all the necessary information can be retrieved, this should also work when using DGIndex. Get the information from the MPEG2 file and use the d2v just for decoding.
The reason should be found in my laziness: after creating the d2s index file, I remove the original mpeg2 input file and add the newly created d2s, just as a user would add it. Hence same routine for indexed mpeg2 and direct d2s feeds.
Another option could be to parse the d2s file, retrieve the mpeg2 source pathname and get the mediainfo details from that.
manolito, could you please test some avs files as input files? The more complex, the better. Please advise if you get timeout on your system.
;)
Bye
MrC
23rd January 2014, 19:52
I took some time and looked at the code that you use to gather the AVS info. No offence, but it gives me the creeps. Running ffmpeg in a timed loop and then brutally killing it - yikes.
No offence, I know that my coding ability is quite embarassing. :o
BTW, the loop is just needed to implement the timeout. If the ffmpeg (avs2avi) call ends before timeout, then the loop in interrupted without brutal killing. The following KillRunningProcess is just inserted for safety reason.
I suggest you use AVSMeter with the "-i" switch instead of ffmpeg or avs2avi. It just reads the script, gathers the info and then exits without reading any frames (so you don't have to kill it).
Thanks for the suggestion, I will surely take a look at AVSMeter. :)
An even better option would be to skip the "A2DInfo.avsi" thing altogether and write the avs properties directly to a text file. I might even have the code for that somewhere.
Well, A2DInfo.avsi does generate a txt file... code can be improved, please advise if you find a more efficient way (AVSMeter, maybe?).
;)
Bye
manolito
24th January 2014, 00:03
BTW, going back to avs2avi may be a good option, also to preserve the functionality of the ffmpeg vbr tool. :)
Oh, my VBR tool works just fine, even with the hidden ffmpeg routine...:D
After I experienced the timeout failure, I first suspected that my tool was to blame. But this was not the case. My fake ffmpeg.exe stub intercepts the command line parameters correctly and passes them to the batch file. And the batch file makes sure that whenever there is no video bitrate parameter present, it will call the original ffmpeg.exe with the original command line.
BTW as far as I am concerned, my VBR tool is final. Fishman has no complaints, and all test conversions I did with it came out nicely.
manolito, could you please test some avs files as input files? The more complex, the better. Please advise if you get timeout on your system.
;)
Bye
Will do, just not tonight...:p
Cheers
manolito
manolito
24th January 2014, 14:04
Will do, just not tonight...:p
Reporting back with my test results:
Yes, I can provoke a timeout error after loading a complex AVS script into AVStoDVD 2.73. A "normal" AVS file with just a little resizing and sharpening is no problem, but after adding almost a dozen other filters and a slow deinterlacer to the script I got a timeout error each and every time.
This happened regardless if my VBR tool was installed or not. And going back to AVStoDVD version 2.70 took care of the issue reliably.
So it is true: ffmpeg does not love my slow computer...:rolleyes:
Cheers
manolito
MrC
24th January 2014, 16:25
Reporting back with my test results:
Yes, I can provoke a timeout error after loading a complex AVS script into AVStoDVD 2.73. A "normal" AVS file with just a little resizing and sharpening is no problem, but after adding almost a dozen other filters and a slow deinterlacer to the script I got a timeout error each and every time.
This happened regardless if my VBR tool was installed or not. And going back to AVStoDVD version 2.70 took care of the issue reliably.
So it is true: ffmpeg does not love my slow computer...:rolleyes
Thanks for the precise report, manolito, as usual.
Next AVStoDVD release will take care of slower systems, either with AVSMeter or back to avs2avi, but probably it is time to think about an upgrade.
;)
Bye
manolito
25th January 2014, 11:53
but probably it is time to think about an upgrade.
;)
Bye
Yeah, I know, I have a retro personality. I get attached to technical things over the years (my motorcycle is from 1991...)
Cheers
manolito
MrC
31st January 2014, 11:19
I suggest you use AVSMeter with the "-i" switch instead of ffmpeg or avs2avi. It just reads the script, gathers the info and then exits without reading any frames (so you don't have to kill it).
Hi Groucho, I have tested AVSMeter and, wow, it does its job in a very efficient way. Good piece of sw.
I have found only a drawback to adopt it: from what I have understood, AVSMeter analyze only the video stream, not the audio stream, such as channels number, sampling frequency and time. Is it possible to do that or to add it in future releases?
Many thanks (if you want I can move this post to the AVSMeter support thread).
;)
Bye
Groucho2004
31st January 2014, 11:42
I have found only a drawback to adopt it: from what I have understood, AVSMeter analyze only the video stream, not the audio stream, such as channels number, sampling frequency and time. Is it possible to do that or to add it in future releases?
Once you run AVSMeter it collects all information from a script, video and audio. It simply does not report any audio related information.
If you are running AVSMeter instead of ffmpeg or avs2avi (with your adinfo.avsi script), this will not make any difference.
However, if you want to parse the log file AVSMeter produces I would have to add the audio information as well. (I'll probably do that for the next version).
MrC
31st January 2014, 15:37
Let's continue with PMs
;)
Bye
manolito
20th February 2014, 06:12
I spent quite some time trying to analyze this issue, as it only becomes apparent for longer source files. All I can say right now is that the PAL-Speedup routine seems to be broken, since it always results in a bad sync error (audio is off by several seconds at the end of a 2 hour clip).
My source was a regular progressive NTSC clip @ 23,976fps. It made no difference if the source was XviD AVI / MP3 or MPEG2 / AC3.
Normally I use good old DVD2SVCD for such conversions (it uses BeSweet to convert audio), and PAL speedup works flawlessly. But when I tried to convert the same files using AVStoDVD I always got these sync errors.
Using the default DGPulldown method works, but I really hate the judder on horizontal pans it creates.
When I first got these sync errors I thought that SSRC might be the culprit, but replacing it with ResampleAudio made no difference. Next thing I tried was using TimeStretch, but this also did not solve it. Replacing WAVI+Aften with ffmpeg+Aften was futile just as well.
My last desperate attempt was to install AviSynth 2.58 instead of 2.57, but this also was unsuccessful.
Conclusion:
I have no idea if it is AviSynth itself or the implementation within AVStoDVD, but fact is that PAL speedup is broken in AVStoDVD.
Here is a log file for such a conversion where I had already replaced SSRC with ResampleAudio:
<18.02.2014 01:11:04>
START PROCESS
<>
<18.02.2014 01:11:04>
PROJECT SETTINGS
DVD Video Standard: PAL
DVD Titles number: 1
DVD Size: 4450/4450 MB (100%)
DVD Output Setup: DVD-Ordner
DVD Label: DVD
DVD Menu: No Menu
Output Folder: I:
Delete Temp Assets Files: Yes
Delete Temp Working Files: Yes
Edit Command Parameters: No
Post Process Task: Fortschrittsfenster anzeigen (Voreinstellung)
PREFERENCES
MultiThread: 1
AVS Video Source Filter: A2DSource
AVS Audio Source Filter: A2DSource
AVS UpSize/DownSize Filter: Spline36Resize/Spline36Resize
Frame Adjust Strategy: 1
PAL SpeedUp: 1
Video Resolution: 0
Video BitRate Min: 2000
Video BitRate Level 1: 2000
Video Profile Level 2: 2000
Video BitRate Max: 8500
Keep DVD Compliant Video: 1
AC3 Audio Encoder: 0
Force FFmpeg for Long Audio: 1
DVD Audio Format: 0
DVD Audio BitRate: 224
Keep DVD Compliant Audio: 1
Normalize Audio: 0
Auto Delay Audio: 1
DVD Audio Language (Primary): DE - German
DVD Audio Language (Secondary): EN - English
DVD Subs Language (Primary): DE - German
DVD Subs Language (Secondary): EN - English
DVD Subs Font: Tahoma 16pt (255,255,255)
Chapters Interval: 5
Use Source Chapters: 1
DVD Burning Drive: H: BENQ DVD DD DW1620 B7W9
DVD Burning Speed: 8x
Auto Erase DVD RW: 0
Unload ActiveMovie library: 0
Adjust ffdshow at runtime: 1
Save General Settings: 0
<>
<18.02.2014 01:11:04>
TITLE 1 SOURCE FILES
Video: I:\test.mpg
Info: MPEG-2 Video - 4979 kbps - 720x480 - DAR 1,778 - 23,976 fps (CFR) - Progressive - 1:52:33 hours - 161930 frames
Audio 1: I:\test.mpg
Info: AC3 - 224 kbps - CBR - 2 ch - 48000 Hz - 16 bit - 1:52:24 hours (-6 ms delay)
[MediaInfoLib - v0.7.58]
<>
<18.02.2014 01:11:04>
AVISYNTH SCRIPT
Import("E:\Programme\AVStoDVD\Lib\A2DSource.avsi")
Video = A2DVideoSource("I:\test.mpg", CacheFolder="I:", FrameRate=23.976, VFR=false)
Audio = A2DAudioSource("I:\test.mpg", CacheFolder="I:")
Video = Video.ConvertToYV12()
Video = Video.Spline36Resize(720,576)
#Using AssumeFPS() to upsize FPS
Audio = Audio.DelayAudio(-0.006)
AudioDub(Video, Audio)
AssumeFPS("pal_film", sync_audio=true).ResampleAudio(48000)
<>
<18.02.2014 01:11:04>
START VIDEO ENCODING OPERATIONS
Encoding Profile: FFmpeg CBR 1-pass
Target Video FileSize: 4174,1 MB
Encoding Parameters: -i "I:\DVD_0_test_1.avs" -threads 1 -aspect 16:9 -c:v mpeg2video -b:v 5406k -minrate 5406k -maxrate 5406k -bufsize 2000k -dc 9 -y "I:\DVD_0_test.m2v"
<>
<18.02.2014 04:47:28>
END VIDEO ENCODING OPERATIONS
Video Source Filter: A2DSource (DirectShowSource)
Created File: I:\DVD_0_test.m2v (4142,1 MB)
OUTPUT VIDEO INFO: MPEG-2 Video - 5364 kbps - 720x576 - DAR 1,778 - 25 fps (CFR) - Progressive - 1:47:57 hours - 161928 frames
<>
<18.02.2014 04:47:30>
START AUDIO ENCODING OPERATIONS (Track 1)
Wavi+Aften Parameters: "I:\DVD_0_test_1.avs" - | "E:\Programme\AVStoDVD\Aften\aften.exe" -b 224 -pad 0 -dynrng 5 -bwfilter 0 - "I:\DVD_0_test_1.ac3"
<>
<18.02.2014 05:08:27>
END AUDIO ENCODING OPERATIONS (Track 1)
Audio Source Filter: A2DSource (DirectShowSource)
Created File: I:\DVD_0_test_1.ac3 (173 MB)
OUTPUT AUDIO INFO: AC3 - 224 kbps - CBR - 2 ch - 48000 Hz - 16 bit - 1:47:57 hours (0 ms delay)
<>
<18.02.2014 05:08:27>
START DVD AUTHORING OPERATIONS
BatchMux Parameters: -arglist "I:\DVD_0_BatchMux.ini"
BatchMux ini file:
-d "I:\DVD_0\VIDEO_TS"
-mxp "I:\DVD_0_MuxMan.mxp"
-l "I:\DVD_0_MuxMan.log"
-muxman "E:\Programme\AVStoDVD\MuxMan"
-prio LOW
-palette "I:\DVD_0_Palette.txt"
-v "I:\DVD_0_test.m2v"
-vidmode LB
-a1 "I:\DVD_0_test_1.ac3"
-a1lang de
-cellfr "I:\DVD_0_test_Chapters.txt"
-progfr "I:\DVD_0_test_Chapters.txt"
-chapfr "I:\DVD_0_test_Chapters.txt"
<>
<18.02.2014 05:26:33>
END DVD AUTHORING OPERATIONS
Created Folder: I:\DVD_0 (4404,7 MB)
CHECK DVD SIZE
DVD Folder (actual) Size: 4404,7 MB
vs Estimated Size: 4450 MB -> 1,0% undersize
vs Assets Size: 4315,1 MB -> OK
<>
<18.02.2014 05:26:34>
Log file created by AVStoDVD Release 2.7.3
<>
Any ideas?
Cheers
manolito
MrC
20th February 2014, 17:52
@manolito
I keep in my test clips library one MKV (AVC+DTS) and one AVI (XviD+MP3) as progressive 23.976fps samples. I get no out-of-sync with them. I use default AVStoDVD encoding settings (except for the PAL-SpeedUp option, of course), use ffdshow as directshow decoder and AviSynth 2.5.8. Hence we have to figure out what is the configuration that is causing the issue.
Just a brainstorm to fix:
- try with FFMpegSource for video, audio or both
- try with HCenc
- be sure that ffdshow (or LAVFilter) is decoding the audio track
- remove the DelayAudio statement
Always check with the Preview tool instead of encoding the whole project.
If the out-of-sync happens also with a small portion of the mpg file, please upload it so that I can test it.
Let me know
;)
Bye
manolito
23rd February 2014, 05:10
Always check with the Preview tool instead of encoding the whole project.
If this worked I would already have found the reason for this issue...:D
But unfortunately my computer is way too slow for real time MPEG2 encoding. The AVStoDVD preview gives me an idea if I will get useable audio and video from the encode, but checking A/V sync is absolutely impossible.
Here is an update:
I restarted from scratch and used a progressive PAL DVD I had created from a TV capture. I converted it to an NTSC XviD AVI @23.976fps file using ffmpeg.
Converting this file with AVStoDVD worked all the time, no matter which encoder I used. The source filter was AVISource, for Audio DirectshowSource was used with ffdshow as the decoder.
Next I converted this AVI file to an NTSC MPEG2 file using ffmpeg again. No pulldown was used. The MPEG2 file played fine in all my software players (VLC, MPC-HC and WMP).
This file caused a bad audio sync problem with the AVStoDVD default settings. Remember that I could not use DGIndex because this will give me a timeout error. I declined the indexing request so the standard method was used. A2DSource selected DirectShowSource for audio and video, and ffdshow was the decoding filter.
I used this version of ffdshow:
ffdshow_rev4504_20130312_clsid.exe
I activated MPEG2 decoding using libavcodec (mpeg2codec was removed in this version), and I also selected "All Supported" for raw video and audio. All other settings were left at their default settings. These are the settings jdobbs requests for BD-Rebuilder. I had activated AVStoDVDs option to adjust ffdshow settings at runtime.
Could this have something to do with the "Detect Soft Telecine" option in ffdshow? I am not quite sure where to go from here. I could either modify the source MPEG2 file to use pulldown, I could try to modify some ffdshow settings, I could uninstall ffdshow and use lavfilters instead, or I could force ffmpegsource...
Will report back after some further tests...
Cheers
manolito
MrC
23rd February 2014, 23:00
This file caused a bad audio sync problem with the AVStoDVD default settings. Remember that I could not use DGIndex because this will give me a timeout error. I declined the indexing request so the standard method was used. A2DSource selected DirectShowSource for audio and video, and ffdshow was the decoding filter.
We know, DSS is surely not the best choice to frameserve a mpeg2 stream. FFMS2 at least is frame accurate.
About the AviSynth/DGIndex source timeout error, would you try this "very" alpha 2.7.4 release (https://sites.google.com/site/avstodvdmain/AVStoDVD_274_Alpha_140222_exe_only.7z)? I have replaced the original AviSynth source properties detection routine with a new one, replacing A2DInfo.avsi with AVSMeter, courtesy from Groucho2004. It should be much faster, with vintage hardware too.
;)
Bye
manolito
23rd February 2014, 23:47
Thanks for the test version, will try it tonite...:D
Meanwhile I ran 2 more conversions using the NTSC MPEG2 file, and I am very surprised by the results:
First time I forced ffmpegsource for video and audio. Got a bad sync error again.
Then I uninstalled Haali and ffdshow and used lavfilters 0.60.1 with all settings at their default values. A2DSource picked DirectShowSource for both video and audio, and this time the result was in perfect A/V sync.
What is going on here? Could it be this setting?
http://i60.tinypic.com/1424n80.jpg
I remember that ffdshow also has this checkbox, but it was off by default. Should I do another conversion with ffdshow with this checkbox activated?
Cheers
manolito
manolito
24th February 2014, 01:14
Short feedback for the new "very alpha" version:
No timeout errors any more, gathering the info is just as fast as with the older version 2.70. Thanks...:)
I did not do a complete encode, but I did find a difference in the created AviSynth script between the alpha version and version 2.70. My source was the NTSC MPEG2 clip, PAL speedup and Auto Audio Delay were both enabled.
Version 2.70
Import("E:\Programme\AVStoDVD\Lib\A2DSource.avsi")
LoadPlugin("E:\Programme\AVStoDVD\DGIndex\DGDecode.dll")
Video = MPEG2Source("I:\test.d2v")
# Audio is frameserved by AviSynth just for Preview and Edit purposes.
Audio = A2DAudioSource("I:\test T80 2_0ch 224Kbps DELAY -5ms.ac3", CacheFolder="I:")
Video = Video.ConvertToYV12()
Video = Video.Spline36Resize(720,576)
Video = Video.ConvertFPS("pal_video")
AudioDub(Video, Audio)
Version 2.74 "very" alpha
Import("E:\Programme\AVStoDVD\Lib\A2DSource.avsi")
LoadPlugin("E:\Programme\AVStoDVD\DGIndex\DGDecode.dll")
Video = MPEG2Source("I:\test.d2v")
Audio = A2DAudioSource("I:\test T80 2_0ch 224Kbps DELAY -5ms.ac3", CacheFolder="I:")
Video = Video.ConvertToYV12()
Video = Video.Spline36Resize(720,576)
#Using AssumeFPS() to upsize FPS
AudioDub(Video, Audio)
AssumeFPS("pal_film", sync_audio=true).SSRC(48000)
Version 2.70 ignores the PAL speedup option, it uses ConvertFPS instead. The new alpha version does the PAL speedup, but I cannot find audio delay adjustment. Is this done later outside of AviSynth?
Anyways, AVSMeter seems to work perfectly.
Cheers
manolito
//EDIT//
BTW I found a confusing line in the German translation.
Could you please correct the following line and replace "Sperre" by "Erzwinge"
240070 Erzwinge gewähltes Video-Profil für alle Bitraten (NICHT empfohlen)
Thanks
manolito
24th February 2014, 10:59
What is going on here? Could it be this setting?
http://i60.tinypic.com/1424n80.jpg
Well, I gave it a shot and changed the setting in the ffdshow configuration
http://i62.tinypic.com/33zebex.png
but no luck, still getting the same sync error.
For the new "very" alpha version, PAL speedup works without sync errors after using DGIndex on the source file. But the automatic audio delay correction is not working, after indexing is finished the input window shows no delay for the audio even if the demuxed audio file name has the delay value in it.
Looks like getting the delay info from AVSMeter is not (yet) working. Maybe you can extract the delay from the audio file name instead...
Back to the sync problems...
My conclusion from almost a week of doing test conversions goes like this:
If the source is an NTSC MPEG2 file AND you are using PAL speedup during the conversion, the only way to get a result with perfect Audio/Video sync is to either use DGIndex or DirectShowSource with lavfilters installed.
If you use DirectShowSource together with ffdshow or you use ffmpegsource2, you will end up with a bad out-of-sync result.
Remember this only happens for PAL speedup, the DGPulldown method is not affected.
Cheers
manolito
Groucho2004
24th February 2014, 12:50
Looks like getting the delay info from AVSMeter is not (yet) working. Maybe you can extract the delay from the audio file name instead...
I might be missing something here but how would you use Avisynth to determine the audio delay? Avisynth does not export any function for this purpose.
MrC
24th February 2014, 20:55
manolito, thanks for the extensive testing. I will try to replicate the out-of-sync issue with FFMS2 and/or DSS+ffdshow with a mpeg2 ntsc-film.
Good to read that the standard DGIndex approach does work properly.
About the delay (very small indeed), I will try to add the delay detection by parsing the demuxed audio filename, when a d2v+ac3(mp2) project is involved. No way to detect delay when source file is an AviSynth script: as Groucho already said, AviSynth is not capable to output that info.
;)
Bye
PS. Thanks for the German update!
manolito
25th February 2014, 03:42
Thanks MrC,
one question I forgot:
When you changed from ResampleAudio to SSRC, did you include a fallback to ResampleAudio if the source framerate is rejected by SSRC?
http://forum.doom9.org/showthread.php?p=1623850#post1623850
Cheers
manolito
MrC
25th February 2014, 11:12
one question I forgot:
When you changed from ResampleAudio to SSRC, did you include a fallback to ResampleAudio if the source framerate is rejected by SSRC?
http://forum.doom9.org/showthread.php?p=1623850#post1623850
Yes, I did, it doesn't cover all the situations, but actually most.
Select Case .InputAudioInfo(AudioNum).SampleRate
Case "48000"
Create_AVSScript = Create_AVSScript & ".SSRC(48000)" & vbCrLf
Case Else 'SSRC does not accept all input samplerates
Create_AVSScript = Create_AVSScript & ".ResampleAudio(48000)" & vbCrLf
End Select
;)
Bye
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.