Log in

View Full Version : AVStoDVD Support Thread


Pages : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 [50] 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68

manolito
26th February 2014, 01:51
Beautiful, thanks...:D

Fishman0919
13th March 2014, 02:54
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.

Yes... I've found that ffmpeg will over shoot the max bitrate by 700-800... sometimes more.

That's why in my 2-pass setting I set the max to 7500k.. add 700-800 and your at 8300k'ish

manolito
13th March 2014, 12:18
That's why in my 2-pass setting I set the max to 7500k

Yeah, I did notice this setting, and for average bitrates below 3500k it makes perfect sense. But I use the 1-pass VBR mode for much higher bitrates, so I wanted this value to be a little higher...

The overshooting in ffmpeg is much more benign than in good old QuEnc, though. For QuEnc I could never use a max bitrate above 8000k, even with only 1 audio track @ 224k. Somehow ffmpeg handles the VBV buffer in a much better way than QuEnc, because for the same actual max rate MuxMan often chokes on the QuEnc encode while it handles the ffmpeg encode just fine.



Cheers
manolito

blueriver
18th March 2014, 06:09
I agree... somewhat.

Faster... no

Better... On most stuff I encode below 3500k, I feel Yes. Anything above 3500k, mostly No.

Calling ffmpeg for multi passes can be done with just 1 command line bat file with different settings.

ffmpeg.exe -i "####.avs" -framerate 23.976 -aspect 16:9 -dc # -g 12 -maxrate 7500k -q:v 2 -b_strategy 2 -brd_scale 2 -bf 2 -profile:v 4 -pass 1 -passlogfile ffmpeg -an -f mpeg2video pass1.m2v

ffmpeg.exe -i "####.avs" -framerate 23.976 -aspect 16:9 -dc # -g 12 -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 2 -passlogfile ffmpeg -an -f mpeg2video pass2.m2v

But this is just a thought for the back burner.



in a few days ago......... i update bitdefender with latest version, then HC encoder crashed in second Pass

i just read the script for 2 pass ffmpeg encoder for low bitrate,
where do i put this script when i have multiple video input

thanks in advance

manolito
18th March 2014, 12:53
The easiest way to use Fishman's script from within AVStoDVD is to use my little plugin...
http://forum.doom9.org/showthread.php?p=1663423#post1663423


Cheers
manolito

blueriver
18th March 2014, 16:52
thanks for the link
I already downloaded it

my format is NTSC

what can i do with 3files

manolito
18th March 2014, 17:53
There is a "Readme.pdf" in the archive...


Cheers
manolito

blueriver
18th March 2014, 19:33
wow thanks, i just test a short video .....it so great!
but
i want to encode multiple files (2800 to 3000 bitrate for each)
doesnt work ..... it been aborted

so what wrong with the bitrate?
and can we add multiple files

appreciated

http://i57.tinypic.com/nbp3ko.jpg

manolito
19th March 2014, 00:52
Just to be sure I just checked it again: Multiple files are no problem with the plugin, works perfectly here.

There is nothing wrong with the bitrate, but according to your screenshot you did not check the "Use Ffmpeg HQ Options" checkbox. This means that you are using the 1-pass VBR mode. If you want 2-pass mode you have to check this HQ option.

You say the conversion was aborted. Do you have any error message?

The nice thing about using a batch file for the plugin is that anyone with some basic knowledge about batch file scripting can modify the plugin according to his/her needs. In your case HCenc does not work, so you probably want to use ffmpeg for all bitrates. Then you have to decide which ffmpeg mode should be used depending on the bitrate. If you need help modifying the batch file just tell me your preferences...



Cheers
manolito

manolito
19th March 2014, 14:19
Here is an example how you could modify your settings for using ffmpeg exclusively:

First of all go to Preferences -> Video and lock ffmpeg for all bitrates.
http://i59.tinypic.com/330ai5u.jpg
Make sure you have "Save current preferences as Default" activated.

Now load ff_vbr.bat into an editor and edit the section under the :doit label.

Original:
:doit
REG QUERY HKEY_CURRENT_USER\Software\AVStoDVD /v VideoProfileLevel1 >"%out_path%$temp.txt"
FOR /F "usebackq tokens=3" %%a IN ("%out_path%$temp.txt") DO SET /A threshold=%%a
IF EXIST "%out_path%$temp.txt" DEL "%out_path%$temp.txt"

IF %bitrate% LSS 3500 IF %hq%==1 GOTO 2pass
IF %bitrate% GTR %threshold% GOTO dont_touch

_ffmpeg.exe%CMDLINE%
GOTO :EOF

Modified:
:doit

IF %bitrate% GTR 6500 GOTO dont_touch
IF %bitrate% LSS 3500 GOTO 2pass
IF %hq%==1 GOTO 2pass

_ffmpeg.exe%CMDLINE%
GOTO :EOF

Save the file and enjoy...:D


The modified version has the following behavior:

1. For bitrates above 6500 kbps the original CBR mode is used.

2. For bitrates below 3500 kbps the high quality 2-pass mode is always used no matter if HQ mode is checked or not.

3. For bitrates between 3500 kbps and 6500 kbps it depends if the HQ checkbox is checked or not. If HQ is checked then you will get 2-pass VBR, if not the encoding will be done in 1-pass VBR mode.


Feel free to modify this behavior according to your needs, it's easy... :cool:


Cheers
manolito

blueriver
20th March 2014, 20:05
thanks for nice scripts, i like it,

i want to encode FFmpeg with 2 pass on low bitrate video

There is nothing wrong with the bitrate, but according to your screenshot you did not check the "Use Ffmpeg HQ Options" checkbox. This means that you are using the 1-pass VBR mode. If you want 2-pass mode you have to check this HQ option.
------- even i check mark on option but still error

In your case HCenc does not work, so you probably want to use ffmpeg for all bitrates. <<<< You right


this is my log:

<3/20/2014 1:56:50 PM>
START PROCESS
<>

<3/20/2014 1:56:50 PM>
PROJECT SETTINGS

DVD Video Standard: NTSC
DVD Titles number: 2
DVD Size: 1900/1900 MB (100%)
DVD Output Setup: MPEG2 Streams
DVD Label: DVD
DVD Menu: No Menu
Output Folder: C:\Users\LANY\Videos
Delete Temp Assets Files: Yes
Delete Temp Working Files: Yes
Edit Command Parameters: No
Post Process Task: Show Progress Status window

PREFERENCES

MultiThread: 1
AVS Video Source Filter: A2DSource
AVS Audio Source Filter: A2DSource
AVS UpSize/DownSize Filter: Lanczos4Resize/Spline16Resize
Frame Adjust Strategy: 1
PAL SpeedUp: 0
Video Resolution: 0
Video BitRate Min: 2500
Video BitRate Level 1: 2500
Video Profile Level 2: 2500
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: 192
Keep DVD Compliant Audio: 1
Normalize Audio: 0
Auto Delay Audio: 1
DVD Audio Language (Primary): EN - English
DVD Audio Language (Secondary): EN - English
DVD Subs Language (Primary): EN - English
DVD Subs Language (Secondary): EN - English
DVD Subs Font: Tahoma 16pt (255,255,255)
Chapters Interval: 5
Use Source Chapters: 1
DVD Burning Drive: F: ATAPI iHAS124 Y BL0V
DVD Burning Speed: 4x
Auto Erase DVD RW: 1
Unload ActiveMovie library: 0
Adjust ffdshow at runtime: 1
Save General Settings: 0
<>

<3/20/2014 1:56:50 PM>
TITLE 1 SOURCE FILES
Video: S:\10_.mkv
Info: AVC - 3686 kbps - 1280x720 - DAR 1.778 - 29.97 fps (CFR) - Progressive - 41:26 minutes - 74510 frames
[MediaInfoLib - v0.7.61]
<>

<3/20/2014 1:56:50 PM>
AVISYNTH SCRIPT
Import("C:\Program Files (x86)\AVStoDVD\Lib\A2DSource.avsi")

Video = A2DVideoSource("S:\10_.mkv", CacheFolder="D:\Temp\AVStoDVD", FrameRate=29.97, VFR=false)

Video = Video.ConvertToYV12()
Video = Video.Spline16Resize(720,480)

Return Video
<>

<3/20/2014 1:56:50 PM>
START VIDEO ENCODING OPERATIONS
Encoding Profile: FFmpeg CBR 1-pass
Target Video FileSize: 950.4 MB
Encoding Parameters: -i "D:\Temp\AVStoDVD\DVD_0_Title_01_10__1.avs" -threads 8 -aspect 16:9 -c:v mpeg2video -b:v 3207k -minrate 3207k -maxrate 3207k -bufsize 2000k -dc 8 -bf 2 -mbd rd -trellis 2 -cmp 2 -subcmp 2 -y "C:\Users\LANY\Videos\DVD_0_Title_01_10_.m2v"
<>



when i click start the message popup :

http://i58.tinypic.com/2duebrl.png



please help , I dont know what to do.
I like your scripts and AVStoDVD very very much


sorry for late reply , i was so buzy on the last 2 days

appreciated!

manolito
20th March 2014, 21:04
Unfortunately the AVStoDVD log file is not very eloquent in this case...

My first guess would be that the plugin is not installed correctly. Please open the "AVStoDVD\ffmpeg" folder in Explorer. Make sure that under "Folder Options" you specified that all file extensions should be displayed. Compare your folder content with this screen shot:
http://i57.tinypic.com/ke93cn.jpg

Check the file sizes. "_ffmpeg.exe" should have the biggest size, "ffmpeg.exe" and "ff_vbr.bat" should be just a few kilobytes in size.

If this does not give any results, I will have to send you a modified ff_vbr.bat with some "@echo on" and "pause" commands so the error messages will be visible.


Cheers
manolito

blueriver
20th March 2014, 23:03
yes , please modify a script for me,

i check FFmpeg folder is same as your pic.

- changed a2dsource.avis in folder LIB

manolito
20th March 2014, 23:48
Just to rule out that it has something to do with the modified a2dsource.avsi, I would suggest that you change the video source filter (under "Preferences") from a2dsource to DirectShowSource or FFMpegSource and try another encode.

I will make a debug ff_vbr.bat for you tomorrow.


Cheers
manolito

blueriver
21st March 2014, 03:13
may i ask do i need to setup anything from FFdshow,
i think windows change codec or dll ,
in folder SysWOW64 , I add msvcp80.dll & msvcr71.dll

manolito
21st March 2014, 11:01
The AVStoDVD help has a comprehensive section upon how to set up ffdshow. RTFM... ;)

Otherwise I have no idea how to configure AVStoDVD under 64-bit Windows, you need to ask MrC. I believe that the Visual C runtime DLLs are not needed for AVStoDVD, but you do need the Visual Basic runtime files.

Generally I suggest that before debugging the VBR plugin you should make absolutely sure that AVStoDVD works without the plugin. Please delete ffmpeg.exe and ff_vbr.bat from the AVStoDVD\FFMpeg folder and rename _ffmpeg.exe back to ffmpeg.exe. Then start a conversion and force ffmpeg as the encoder.

Only if this conversion works it will make sense to debug the plugin. The plugin does work for several users, so I am suspicious that it could be something about your specific system.



Cheers
manolito

manolito
21st March 2014, 14:23
@MrC

I found a HD Transport Stream (a BBC broadcast) in another thread which AVStoDVD cannot handle on my system:
http://forum.doom9.org/showthread.php?p=1674190#post1674190
I first tried to repack it to MKV but MKVMergeGui cannot open it. Repairing the stream with TSDoctor took care of this problem, but whatever decoder I pick in AVStoDVD (I tried ffdshow, ffms2 and DSS2 Mod), I always get some horizontal trembling of the video, and audio is not in sync.

So far the only method I found to convert this file to MPEG2 is to use ffmpeg (current version 2.1.4) directly without AviSynth. It does throw warnings at the start of the file and it reports 56 frame dups, but the result looks nice and audio is in sync.

Any ideas how AVStoDVD can be convinced to process such files correctly?


Cheers
manolito

blueriver
21st March 2014, 19:09
The AVStoDVD help has a comprehensive section upon how to set up ffdshow. RTFM... ;)



Generally I suggest that before debugging the VBR plugin you should make absolutely sure that AVStoDVD works without the plugin. Please delete ffmpeg.exe and ff_vbr.bat from the AVStoDVD\FFMpeg folder and rename _ffmpeg.exe back to ffmpeg.exe. Then start a conversion and force ffmpeg as the encoder.



Cheers
manolito

YEAH when i use the original ffmpeg.exe .. it worked
blut i dun deleted ff_vbr.bat , and keep modify A2DSource.avsi
so would you check for me
it encoded with 2 pass or filter that you mentioned


<3/21/2014 11:45:29 AM>
START PROCESS
<>

<3/21/2014 11:45:29 AM>
PROJECT SETTINGS

DVD Video Standard: NTSC
DVD Titles number: 2
DVD Size: 1920/1920 MB (100%)
DVD Output Setup: MPEG2 Streams
DVD Label: DVD
DVD Menu: No Menu
Output Folder: D:\Temp
Delete Temp Assets Files: Yes
Delete Temp Working Files: Yes
Edit Command Parameters: No
Post Process Task: Show Progress Status window

PREFERENCES

MultiThread: 1
AVS Video Source Filter: FFMpegSource
AVS Audio Source Filter: A2DSource
AVS UpSize/DownSize Filter: Lanczos4Resize/Spline16Resize
Frame Adjust Strategy: 1
PAL SpeedUp: 0
Video Resolution: 0
Video BitRate Min: 2500
Video BitRate Level 1: 2500
Video Profile Level 2: 2500
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: 192
Keep DVD Compliant Audio: 1
Normalize Audio: 0
Auto Delay Audio: 1
DVD Audio Language (Primary): EN - English
DVD Audio Language (Secondary): EN - English
DVD Subs Language (Primary): EN - English
DVD Subs Language (Secondary): EN - English
DVD Subs Font: Tahoma 16pt (255,255,255)
Chapters Interval: 5
Use Source Chapters: 1
DVD Burning Drive: F: ATAPI iHAS124 Y BL0V
DVD Burning Speed: 4x
Auto Erase DVD RW: 1
Unload ActiveMovie library: 0
Adjust ffdshow at runtime: 1
Save General Settings: 0
<>

<3/21/2014 11:45:29 AM>
TITLE 1 SOURCE FILES
Video: S:\10.mkv
Info: AVC - 3686 kbps - 1280x720 - DAR 1.778 - 29.97 fps (CFR) - Progressive - 41:26 minutes - 74510 frames
[MediaInfoLib - v0.7.61]
<>

<3/21/2014 11:45:29 AM>
AVISYNTH SCRIPT
LoadPlugin("C:\Program Files (x86)\AVStoDVD\Lib\ffms2.dll")

Video = FFVideoSource("S:\10.mkv", track=-1, seekmode=0)

Video = Video.ConvertToYV12()
Video = Video.Spline16Resize(720,480)

Return Video
<>

<3/21/2014 11:45:29 AM>
START VIDEO ENCODING OPERATIONS
Encoding Profile: FFmpeg CBR 1-pass
Target Video FileSize: 960.5 MB
Encoding Parameters: -i "D:\Temp\AVStoDVD\DVD_2_Title_01_10_1.avs" -threads 8 -aspect 16:9 -c:v mpeg2video -b:v 3241k -minrate 3241k -maxrate 3241k -bufsize 2000k -dc 8 -bf 2 -mbd rd -trellis 2 -cmp 2 -subcmp 2 -y "D:\Temp\DVD_2_Title_01_10.m2v"
<>

<3/21/2014 11:59:43 AM>
END VIDEO ENCODING OPERATIONS
Created File: D:\Temp\DVD_2_Title_01_10.m2v (960.5 MB)
OUTPUT VIDEO INFO: MPEG-2 Video - 3241 kbps - 720x480 - DAR 1.778 - 29.97 fps (CFR) - Progressive - 41:26 minutes - 74509 frames
<>

<3/21/2014 11:59:43 AM>
TITLE 2 SOURCE FILES
Video: S:\11_.mkv
Info: AVC - 3686 kbps - 1280x720 - DAR 1.778 - 29.97 fps (CFR) - Progressive - 41:23 minutes - 74443 frames
[MediaInfoLib - v0.7.61]
<>

<3/21/2014 11:59:43 AM>
AVISYNTH SCRIPT
LoadPlugin("C:\Program Files (x86)\AVStoDVD\Lib\ffms2.dll")

Video = FFVideoSource("S:\11_.mkv", track=-1, seekmode=0)

Video = Video.ConvertToYV12()
Video = Video.Spline16Resize(720,480)

Return Video
<>

manolito
21st March 2014, 20:02
OK, here is a debug version of ff_vbr.bat:
http://www58.zippyshare.com/v/42784311/file.html

Reinstall the plugin as before, but this time use the debug version of ff_vbr.bat.

Two things will be different:
1. You will see the ffmpeg command line, so you can make a screen shot of the command window.

2. All ffmpeg output is redirected to the file ff_vbr.log in the output folder. This log file should contain all error messages which ffmpeg issues.


Good luck...
manolito

blueriver
21st March 2014, 20:28
sorry when i use your modified ffmpeg.exe
doesnt work, same message error

http://i59.tinypic.com/6rlj10.jpg

lof from ff_vbr.log
'_ffmpeg.exe' is not recognized as an internal or external command,
operable program or batch file.
'_ffmpeg.exe' is not recognized as an internal or external command,
operable program or batch file.


I prefer 2 pass

thanks so much

manolito
21st March 2014, 21:45
Alright, we are making progress...

The message
'_ffmpeg.exe' is not recognized as an internal or external command, operable program or batch file.
means that ff_vbr.bat is executed correctly, but the renamed original _ffmpeg.exe cannot be executed.

Are you sure you renamed the original ffmpeg.exe correctly?
Another possible reason could be Windows permissions. There is a little tool called "WinOwnership" by Josh Cell Software which lets you take ownership of files and folders.

Another possible reason could be that some antivirus software on your computer blocks my fake ffmpeg.exe because it is a compiled batch file. Some AV software stupidly assumes that compiled batch files are generally evil and should be blocked. Try to exclude the AVStoDVD folder from your antivirus software.

As a last resort you could try to install ASVStoDVD to a folder which is not monitored by Windows. Instead of "C:\Program Files\AVStoDVD" you could install it to "C:\AVStoDVD". Maybe worth a try.

Otherwise I have pretty much run out of ideas what could cause your problems.

Good luck
manolito

MrC
21st March 2014, 22:53
@blueriver

some ground rules:

- AVStoDVD is a 32bit application. It works on 64bit systems.
- No need of VC runtime libs, VB stuff is included in the installer package
- AVStoDVD needs 32bit codecs, i.e. ffdshow 32bit
- If you have installed ffdshow 64bit, AVStoDVD will NOT use it
- After installing ffdshow 32bit, use the 'Codecs'/'Preferred DirectShow Codecs Setup' to select it as preferred decoder for the media to decode.

@manolito

thanks for the link, I will test it ASAP.

;)

Bye

blueriver
21st March 2014, 23:23
to :manolito

i reinstall to C; but still no hope

to MrC,

i checked ffdshow is in folder :C:\Program Files (x86)\ffdshow

after updated windows and bitdefender i cant encode 2 pass hcenc and ffmpg


now all i can do is go with ffmpg 1 pass i think ( i havent test 1 padd Hcenc yet)
i appreciated Mr Manolito go with me to debug avstodvd

i am here

and wat I do next, please show me, thanks

http://tinypic.com/view.php?pic=243rgrc&s=8#.Uyy8BoWApsk

manolito
22nd March 2014, 00:38
@MrC

Thanks for looking into this file. I forgot that you might not have TS Doctor, and maybe you don't want to clutter up your computer with the trial version. So here is the same file processed by TS Doctor:
http://www25.zippyshare.com/v/13268540/file.html


@blueriver

Your link to the screenshot does not work.

Another thing you can try:
Calling _ffmpeg.exe from the ff_vbr.bat obviously results in an error message. You should try what happens if you call _ffmpeg.exe manually from the command line.

Open a command window and navigate to the AVStoDVD\FFmpeg folder (use cd Commands). Then call _ffmpeg.exe and tell me what happens. Do you get an error message again, or do you get the usual version information?

And if Bitdefender makes HCenc crash, maybe it also gets in the way with the VBR plugin. Uninstall Bitdefender completely and see if it makes a difference.


Cheers
manolito

blueriver
22nd March 2014, 13:09
wowow it works now, thanks alot
i rename original to _ffmpeg.exe as you said
i thought the script dont call ffmpeg.exe so I rename to other for me to remember

now it can run with 2 pass ,thanks for mr Manolito spend alot of time with me to fix it

may I ask 1 more question:

when i click start it popup windows: http://tinypic.com/usermedia.php?uo=fNkd6hpTbcMbtu49ZjA4N4h4l5k2TGxc#.Uy15B4WApsk

should I check yes always ... and does it affect to others video converter software ?

manolito
22nd March 2014, 15:03
This popup window is caused by your ffdshow settings. You have specified that only applications which you entered into the white list can call ffdshow. You should click "Yes, Always" and "Don't ask me again".

BTW your last 2 tinypic links do not display in my good old Opera 12 browser, I have to use Chrome to see them. Bummer...

I'm glad that my plugin now works for you...
Probably my Readme.pdf is not clear enough. :devil:


Cheers
manolito

blueriver
25th March 2014, 19:33
@MrC

I hope next version, would you setup 2pass for ffmpeg and setup FFmpeg HQ Options (filter) on preference page
so i can set default not to setup for each EPS

appricated your works!

manolito
26th March 2014, 20:51
@blueriver

I have no idea if supporting ffmpeg 2-pass natively is anywhere on MrC's todo list, but I agree that for the ffmpeg HQ option a second checkbox to save the setting as the default (just like for the HCenc settings) would be useful.

In the meantime if you do not want to set the HQ checkbox for every single file in the source list, just use my modification of the ff_vbr.bat from a week ago:
:doit

IF %bitrate% GTR 6500 GOTO dont_touch
IF %bitrate% LSS 3500 GOTO 2pass
IF %hq%==1 GOTO 2pass

_ffmpeg.exe%CMDLINE%
GOTO :EOF

If you want ffmpeg 2-pass mode for all encodes below 6500k, use this modification:
:doit

IF %bitrate% GTR 6500 GOTO dont_touch
GOTO 2pass



@MrC

For this problematic HD transport stream the only reliable solution I found is to remux the file to MP4 using the current ffmpeg version 2.1.4 with just the -vcodec copy -acodec copy parameters. The resulting file is recognized by MediaInfo as VFR with no audio delay, and ffdshow handles it just fine.

After replacing ffdshow with the current LAVFilters 0.61.1 the original file (not the fixed version) was loaded correctly by DirectShowSource. But audio delay still remained problematic.

BTW if you want to experiment with LAVFilters, the current version has an issue with AviSynth 2.5x. See this post by clsid:
http://forum.doom9.org/showthread.php?p=1675124#post1675124


Cheers
manolito

MrC
27th March 2014, 16:04
@blueriver

thanks for the suggestion, next release will for sure have a default ffmpeg HQ settings saving option and a mention of manolito's routine to implement ffmpeg vbr 2pass encoding.

@manolito

thanks for the hint about the problematic ts file and for the latest LAV Filters issue with AviSynth 2.5x. I am playing a little bit with LAV Filters and, well, they are really interesting. Very probably AVStoDVD release 2.7.4 will still deliver ffdshow as suggested codecs suite, but with 2.8.0 I could drop Haali and ffdshow vs LAV Filters.

Release 2.7.4 is 99.9% ready, but unfortunately I am in Taiwan for my job for 2 weeks, hence there is a little delay to publish it.

;)

Bye

manolito
27th March 2014, 16:51
Enjoy your trip... :D


Cheers
manolito

qyot27
27th March 2014, 20:56
Not that I've tested with AVStoDVD, but it appears to be an issue with AviSynth, period. Not specifically 2.5. Reason being, I attempted to use it with AviSynth+ and if I tried using DirectShowSource to open the video, it would just hang. It's not that LAV Filters seems to not like AviSynth (since if you use other source filters like FFMS2 it works fine), it may actually be a conflict purely between LAV Filters and DirectShowSource, and even more specifically, it only happened when I tried to open the script in Windows Media Player 6.4. It opened correctly if I used mpv (http://mpv.srsfckn.biz/) to test the script (linked to lachs0r's mpv builds for the convenience of others; I build my own).

My [wild] guess about what's causing it would be that it's creating some kind of recursion problem. Firstly, I don't remember LAV Filters ever exposing the AviSynth splitter to the end user before, but even at that, you're looking at a chain of DLLs: if you open the script in a DirectShow-based player, LAV Filters opens and splits the script, by loading libavformat (avformat-lav-55.dll), which loads AviSynth.dll, which loads DirectShowSource.dll, which loads LAV Filters to do the splitting/decoding of the source file (which would almost certainly incur avformat-lav-55.dll a second time). This is probably confusing DirectShow by hitting some kind of DLL limit (as per being DirectShow-based it has to try opening the same copy of LAV Filters, and subsequently the same avformat-lav-55.dll, twice). mpv wouldn't be affected by this because it doesn't rely on DirectShow, it relies directly on libavformat: so mpv uses its own copy of libavformat to load AviSynth.dll, which loads DirectShowSource.dll, which uses LAV Filters (which uses avformat-lav-55.dll). That mpv and LAV Filters would be using different libavformat binaries (mpv's highly likely to be statically linked* into mpv itself) and mpv not invoking LAV Filters twice might have something to do with it working there.

*also generally the case with the libavformat copy that exists in FFMS2, or even LSMASHSource; on Windows, those source filters are almost always statically linked to their dependency libraries, so there's little-to-no confusion about which is which and in what order.

I could be absolutely wrong about the real cause, so don't take this as authoritative. It's just a guess (and wouldn't serve to explain why ffdshow would be unaffected by it**). But to compare it to looking at a mirror reflected in another mirror would not be a totally inaccurate way to describe how it appears to be set up in this particular case of using DirectShowSource as your source filter. Stare at it too long and it starts messing with your head.

**beyond the obvious point that ffdshow used versions of libavformat that were far too old to support loading AviSynth.dll dynamically, so ffdshow itself may have loaded AviSynth.dll (the configuration reading as 'AviSynth' rather than 'libavformat' when you configure it seems to bear this out, although I can't be sure); it'd still have to deal with the situation of the fact that AVISource or DirectShowSource could call ffdshow, unless setting ffdshow's configuration that way actually made it act as a pass-through.

manolito
28th March 2014, 00:34
Thanks a lot for this extensive explanation (though I have to admit that I will need to reread your post a few times to be able to understand it... :stupid: )

clsid's post
http://forum.doom9.org/showthread.php?p=1675124#post1675124
solved the problem completely under AVStoDVD. Does that mean that after applying this Registry patch the LAV splitter is not used any more for AVS input?

Whatever, I am in the situation that I use some older applications which are not maintained any more (like DVD2SVCD) that are not compatible with AviSynth 2.6. I cannot even use 2.58, the last working version is 2.57. All would be well if several versions of AviSynth could be used on a per-application basis, but obviously this is not possible.

Still I do try to keep my system as much up-to-date as possible, and this also means that I would like to replace ffdshow with LAVFilters (because LAVFilters handle a lot of problematic source files which ffdshow does not). Right now the best compromise for me looks like using LAVFilters together with DSS2Mod, it even handles files which ffms2 cannot.



Cheers
manolito

Groucho2004
28th March 2014, 00:59
All would be well if several versions of AviSynth could be used on a per-application basis, but obviously this is not possible.
Of course it's possible. Switching Avisynth versions could even be done with a simple batch file.

manolito
28th March 2014, 02:54
You mean putting the desired avisynth.dll into the application folder? Or keeping several versions of avisynth.dll in the system32 folder under different names and copy the desired version to avisynth.dll via batch file?

I remember trying these methods a long time ago, and it did not work. I always had to reboot to load the desired version.


Cheers
manolito

Groucho2004
28th March 2014, 10:57
You mean putting the desired avisynth.dll into the application folder? Or keeping several versions of avisynth.dll in the system32 folder under different names and copy the desired version to avisynth.dll via batch file?
The latter.
If you are using the auto-load directory, you would also have to exchange these files (directshowsource.dll, etc.) - or - have a auto-load directory for each Avisynth version and change the pointer(s) in the registry.

I remember trying these methods a long time ago, and it did not work. I always had to reboot to load the desired version.
Works for me. There is no reason that would require a reboot. However, if you are using Windows 7 or Vista, the safety mechanisms might not allow you to do anything in the system directory. Just put avisynth.dll and DevIL.dll in a directory to which the PATH variable points.

manolito
10th April 2014, 07:03
@MrC

Hope you had a good time in Taiwan and that you got back home safely...

In the meantime I experimented a little bit using different source filter configurations (mainly playing with the HD transport stream from RedDwarf1), and the results are quite interesting.


Regarding LAVFilters there is a new version 0.61.2 which solves the crash issue with AviSynth. Still there is something strange going on with the AVStoDVD preview. It does not crash any more, but it opens several instances of LAV filters, and when exiting the preview I get an error message (DeleteIfExist - Access denied). Using clsid's reg fix which disables LAV splitter for AviSynth solves this problem.


Back to the problematic HD transport stream. I finally got it working under AVStoDVD, there is even no need to fix the stream using TSDoctor. This is what I had to do:

Use LAV Video source and LAV splitter instead of ffdshow and Haali. I kept ffdshow Audio filter to make use of AVStoDVDs ability to adjust the mixer settings at runtime, but if this feature is not needed, LAV Audio works just fine, too.

Replace DirectShowSource with DSS2 mod.
http://xvid4psp.googlecode.com/files/DSS2%20mod%20%2B%20LAVFilters.7z
It has a preroll parameter for interlaced transport streams, but for this progressive source file I kept the preroll value at the default of 0. IMO this is a perfect replacement for DirectShowSource (Video only).


With this setup I got perfect video output, but A/V sync was still a problem. After many tests I am quite sure that AviSynth is to blame for this.

The source file has a DVD compliant AC3 audio track. When I used Direct Audio Stream Copy I got perfect sync. Using FFmpeg safe mode for audio also resulted in perfect sync. Only when using an audio mode which used AviSynth while also modifying the audio by specifying Normalizing I got a sync problem.

When I disabled Normalizing and Delay correction, I again got perfect sync no matter which audio conversion method I used. I conclude that manipulating the audio within AviSynth is the reason for these sync problems.

(MediaInfo reports an audio delay of 1135 ms for this file. From my experience I have learned that I cannot trust MediaInfo when it reports such huge delays. So I did ignore this audio delay.)


Alright, for the time being my preferred source filter setup is DSS2 mod using LAV Video, LAV Splitter and ffdshow Audio. This also takes care of the non-mod4 issue, no need to use ffms2 for such files any more. If someone has other problematic source files, please upload them somewhere... :cool:



Cheers
manolito

Guest
10th April 2014, 13:06
After many tests I am quite sure that AviSynth is to blame for this.
...
When I disabled Normalizing and Delay correction, I again got perfect sync no matter which audio conversion method I used. I conclude that manipulating the audio within AviSynth is the reason for these sync problems.

(MediaInfo reports an audio delay of 1135 ms for this file. From my experience I have learned that I cannot trust MediaInfo when it reports such huge delays. So I did ignore this audio delay.) That says to me it was the incorrect delay value correction that caused the problem, not simply manipulating in Avisynth itself. From what you say, it is MediaInfo that is the culprit, not Avisynth. Did I misunderstand you?

manolito
10th April 2014, 23:53
That says to me it was the incorrect delay value correction that caused the problem, not simply manipulating in Avisynth itself. From what you say, it is MediaInfo that is the culprit, not Avisynth. Did I misunderstand you?

Yes you did, I believe I was not clear enough in my explanation...

The file I was talking about comes from your DGDecIM thread, it cannot be opened by apps like MKVMerge, MP4Box or AVIDemux. FFMpeg all by itself handles it well, it creates a perfect DVD compliant MPEG2 file without any sync problems from it.

Trying to process this file with AVStoDVD revealed two problems: DirectShowSource using ffdshow could not handle the video part, and audio was out of sync.

The video problems could be overcome by replacing DirectShowSource with DSS2 mod and using LAVFilters instead of ffdshow. But there was still the audio sync problem.

AVStoDVD has several methods to process the audio. FFMpeg safe mode bypasses AviSynth altogether for audio conversion. The other methods do use AviSynth (Wavi + Aften, FFMpeg + Aften and FFMpeg with AviSynth but without Aften).

For the methods which use AviSynth there are two methods implemented which manipulate the audio before encoding. These are Normalizing and Automatic Delay Correction. Both can be turned on or off either globally or for each individual source file.


And these are the audio sync results for the various methods:

FFMpeg Safe Mode: OK
(With this method audio manipulation is not available)

Any other method with Normalizing and Delay Correction OFF: OK

Same methods with Normalizing ON: Sync Error

Having Automatic Delay Correction ON or OFF made no difference. In both cases there was a sync problem.


So it is not just a MediaInfo problem reporting an incorrect audio delay value. Normalizing the audio stream within AviSynth is enough to desync audio and video.

I did my tests using AviSynth 2.57, I will repeat these tests with AviSynth 2.60 (pretty easy now with Groucho's switcher).



Cheers
manolito

MrC
11th April 2014, 20:07
@manolito

thanks again for the heavy tests and detailed reports. These are hard times for my job, free time has become sooo thin. Release 2.7.4 is ready, at least as alpha. It includes the FFmpeg HQ params option in the Preferences. Do you believe I just cannot find 15 mins to pack the installer and upload it on SourceForge?

About LAVFilters: very likely, it will replace ffdshow and Haali from release 2.8.0

About DSS2 mod: I will take a look, for sure. Do you know where to find 25h days?

;)

Bye

manolito
12th April 2014, 03:38
So it is not just a MediaInfo problem reporting an incorrect audio delay value. Normalizing the audio stream within AviSynth is enough to desync audio and video.

I did my tests using AviSynth 2.57, I will repeat these tests with AviSynth 2.60 (pretty easy now with Groucho's switcher).



Here is an update, and after many more test runs I think I nailed down the reason for these sync issues... ;)


First of all, this has nothing to do with different versions of AviSynth. I tried 2.57, 2.58 and 2.60A5, and this made no difference.

The problem seems to be caused by a combination of 3 different facts:
1. The source file is "problematic", some would call it "broken".
2. DirectShowSource was used as the audio source filter.
3. AviSynth's Normalize() function is a 2-pass thing. After determination of the peak level a seek operation to the start of the file is performed before doing the actual audio processing.


Usually in AVStoDVD it is safe to use DirectShowSource for audio because audio is handled in a strictly linear mode. Frame accurate seeking is normally not required. For this reason you get perfect sync as long as Normalize() is not invoked.

At least for problematic files like the one in question the seek operation to the start of the file is not accurate when using DirectShowSource. So we get a sync error.
(Maybe it would be possible for AviSynth to use a different approach for Normalize() which does not involve seeking. Like store the peak value somewhere, then reset/reload the source file and start processing it without any seek operations. But this probably won't happen...)


Now the solutions:
We obviously need a frame accurate audio source filter which could be ffms2 or LSMASH. Unfortunately the original source file is rejected by both of them. Only thing that helps is to fix the source file with TSDoctor first.

After using the fixed source file and forcing ffms2 as the audio source filter I get a perfect conversion without sync errors.

The second solution is to repack the fixed source file into an MKV container. (MKVMerge does not accept the original source file). Using the MKV file as the source does not require to use ffms2 as the audio source filter, DirectShowSource works just fine.



Cheers
manolito

Guest
12th April 2014, 13:59
Third option: normalize the audio in an external application.

manolito
13th April 2014, 01:08
Oh yes, but this is a design decision MrC made a long time ago.

Personally I would prefer if audio was processed outside of AviSynth (using SoX and DelayCut or eac3to or even good old BeSweet). But AVStoDVD is written in VB6 and not very hack-friendly. Audio is extracted from AviSynth using Wavi or FFmpeg and then piped to Aften. The command line is hard coded into the executable, no way to inject something different without patching the executable.


BTW (a little OT) would you have any links to problematic source files which normally can only be handled by your source filters? Like interlaced HD transport streams? The reason I ask is that I would like to make AVDtoDVDs source file handling as good as possible without using hardware dependent source filters. Thanks...


Cheers
manolito

Guest
13th April 2014, 01:36
But AVStoDVD is written in VB6 and not very hack-friendly. I suppose a serious developer won't want to make hacks, so it is not a problem.

...would you have any links to problematic source files which normally can only be handled by your source filters?
Just look for streams that the other decoders barf on. (What is all this remuxing to MKV nonsense?) DGDecNV/IM will handle them fine. Also note, DGDecIM is not limited to HW decoding.

manolito
13th April 2014, 03:27
Just look for streams that the other decoders barf on.

Seems to be surprisingly difficult to find interlaced AVC samples by googling. So I pulled everything I could get from your DGDecIM thread, this will keep me busy for some time...


(What is all this remuxing to MKV nonsense?) DGDecNV/IM will handle them fine.

Well, I sure did not invent this. From the ffms2 documentation:
Decoding some M2TS files using Haali's splitter will cause massive blocking and other corruption issues. You can work around the issue either by remuxing the file to MKV
And from the DSS2 mod doc:
Or repack your file to something more seekable. Or use DGDecNV.
And my own tests showed that when DirectShowSource caused sync problems with the TS file, after repacking to MKV the sync problems were gone using DirectShowSource.


Also note, DGDecIM is not limited to HW decoding.

Thanks for the hint, I did not know this...
But it turns out that I could not use it on my computer even if I had a license. Running dgindexim from the command line to get a machine ID just throws an error message "Not a valid Win32 application". Probably because my CPU does not support SSE2.

And in any case, MrC made it quite clear a couple of years ago (when he dropped support for the CCE encoder) that he will only support free tools in the future.


Cheers
manolito

Guest
13th April 2014, 03:48
Right now the best compromise for me looks like using LAVFilters together with DSS2Mod, it even handles files which ffms2 cannot. It seems you already have access to the problematic streams.

Well, I sure did not invent this. From the ffms2 documentation:,,, No sensible tool would require the user to remux the input stream. As I keep asking, is it so hard to demux a transport stream?

Probably because my CPU does not support SSE2.

And in any case, MrC made it quite clear a couple of years ago (when he dropped support for the CCE encoder) that he will only support free tools in the future.
You're free to limit your options in whatever way you like. Good luck with your projects.

manolito
13th April 2014, 05:53
As I keep asking, is it so hard to demux a transport stream?

Demux a HD AVC transport stream if you do not own DGDecNV or DGDecIM? Please enlighten me...

I tried with your deprecated DGAVCDec and got a raw h264 video stream which was not accepted by AVStoDVD as a valid input. Trying to demux using mkvextract crashed the program. And if I have to use MKVToolnix at all then it is just as fast to remux to MKV as it is to just demux the input.

Good luck with your projects.

Thanks, same to you... :cool:


Cheers
manolito

Guest
13th April 2014, 14:13
I was not advising you to demux the stream and input the ES. I was lamenting the state of the broken internal transport stream demuxers in some well-known source filters. Probably OT for this thread so I leave it.

dsmbr
14th April 2014, 16:44
I have A/V-desync problems as well.

http://pastebin.com/cg9fBjFV

I was just looking for a simple solution to put a media-file on a DVD.

The different output-methods didn't make any difference (M2V/ISO/...). How could they.

I followed this guide (http://imouto.my/watching-h264-videos-using-compute-unified-device-architecture-cuda/) for watching things on my PC, but else I don't even know how to set preferred encoders/decoders outside of MPC-HC.

I'm not good with GraphStudio and such kind of tools.

This makes me really depressed since I don't really know where to start.

manolito
15th April 2014, 04:22
Hi dsmbr and welcome to the forum!

The log you posted looks OK to me. Hard to tell what causes your sync problem without a sample source file... :rolleyes:


Things you can try:

Under Preferences->AviSynth you can force to use FFmpegsource for video and audio instead of A2DSource. And under Audio you should also try to force reencoding the audio (untick "Keep DVD compliant audio tracks").


The second part of your post should not have anything to do with sync problems. The guide is about hardware assisted decoding and playback of HD files. If you have installed ffdshow on your computer, AVStoDVD uses it in conjunction with DirectShowSource. And ffdshow has DXVA support for several years now, you must probably activate it in the ffdshow video setup. But for video conversion the difference in speed is rather small because encoding is normally the bottleneck, not decoding.


If you do not make any progress with your sync problem, you should try if you can reproduce it with a very short file, and then you can upload the file somewhere.



Good luck
manolito

MrC
15th April 2014, 13:01
@dsmbr

in addition to manolito' suggestions, could you also check with 'Codecs'/'Build DirectShow Filters Graph' what filters your system is using to split and decode the MKV file?

;)

Bye