Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > (HD) DVD, Blu-ray & (S)VCD > One click suites for DVD backup and DVD creation

Reply
 
Thread Tools Search this Thread Display Modes
Old 27th March 2014, 20:56   #2481  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,419
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 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.
qyot27 is offline   Reply With Quote
Old 28th March 2014, 00:34   #2482  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
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... )

clsid's post
http://forum.doom9.org/showthread.ph...24#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
manolito is offline   Reply With Quote
Old 28th March 2014, 00:59   #2483  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by manolito View Post
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.
Groucho2004 is offline   Reply With Quote
Old 28th March 2014, 02:54   #2484  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
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
manolito is offline   Reply With Quote
Old 28th March 2014, 10:57   #2485  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by manolito View Post
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.

Quote:
Originally Posted by manolito View Post
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.

Last edited by Groucho2004; 28th March 2014 at 15:19.
Groucho2004 is offline   Reply With Quote
Old 10th April 2014, 07:03   #2486  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
@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...0LAVFilters.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...



Cheers
manolito
manolito is offline   Reply With Quote
Old 10th April 2014, 13:06   #2487  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Quote:
Originally Posted by manolito View Post
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?
Guest is offline   Reply With Quote
Old 10th April 2014, 23:53   #2488  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
Quote:
Originally Posted by neuron2 View Post
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
manolito is offline   Reply With Quote
Old 11th April 2014, 20:07   #2489  |  Link
MrC
AVStoDVD Dev
 
MrC's Avatar
 
Join Date: Apr 2006
Location: Italy
Posts: 1,302
@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
__________________
MrC

AVStoDVD Homepage
AVStoDVD @ Doom9 Forum
MrC is offline   Reply With Quote
Old 12th April 2014, 03:38   #2490  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
Quote:
Originally Posted by manolito View Post
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
manolito is offline   Reply With Quote
Old 12th April 2014, 13:59   #2491  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Third option: normalize the audio in an external application.
Guest is offline   Reply With Quote
Old 13th April 2014, 01:08   #2492  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
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

Last edited by manolito; 13th April 2014 at 01:13.
manolito is offline   Reply With Quote
Old 13th April 2014, 01:36   #2493  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Quote:
Originally Posted by manolito View Post
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.

Quote:
Originally Posted by manolito View Post
...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.

Last edited by Guest; 13th April 2014 at 02:27.
Guest is offline   Reply With Quote
Old 13th April 2014, 03:27   #2494  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
Quote:
Originally Posted by neuron2 View Post
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...


Quote:
Originally Posted by neuron2 View Post
(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:
Quote:
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:
Quote:
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.


Quote:
Originally Posted by neuron2 View Post
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
manolito is offline   Reply With Quote
Old 13th April 2014, 03:48   #2495  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Quote:
Originally Posted by manolito View Post
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.

Quote:
Originally Posted by manolito View Post
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?

Quote:
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.

Last edited by Guest; 13th April 2014 at 03:59.
Guest is offline   Reply With Quote
Old 13th April 2014, 05:53   #2496  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
Quote:
Originally Posted by neuron2 View Post
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.

Quote:
Originally Posted by neuron2 View Post
Good luck with your projects.
Thanks, same to you...


Cheers
manolito
manolito is offline   Reply With Quote
Old 13th April 2014, 14:13   #2497  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
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.

Last edited by Guest; 13th April 2014 at 14:47.
Guest is offline   Reply With Quote
Old 14th April 2014, 16:44   #2498  |  Link
dsmbr
Registered User
 
Join Date: Jan 2012
Posts: 8
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 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.

Last edited by dsmbr; 14th April 2014 at 17:12.
dsmbr is offline   Reply With Quote
Old 15th April 2014, 04:22   #2499  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
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...


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

Last edited by manolito; 15th April 2014 at 09:34.
manolito is offline   Reply With Quote
Old 15th April 2014, 13:01   #2500  |  Link
MrC
AVStoDVD Dev
 
MrC's Avatar
 
Join Date: Apr 2006
Location: Italy
Posts: 1,302
@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
__________________
MrC

AVStoDVD Homepage
AVStoDVD @ Doom9 Forum
MrC is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 19:34.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.