Log in

View Full Version : ReClock DirectShow filter : try it !


Pages : 1 2 [3] 4 5 6 7 8 9 10 11 12 13 14

gabest
16th December 2002, 15:29
Interesting, it really works correctly in the debug build.

edit: no, not always...

edit2: Why are the timestamps always start:-1, stop:-1? I think in this case ac3 stream runs through the graph without waiting for the samples to complete their playing time. It seems that the ac3 parser filter forgets to attach the timestamps and no other filter corrects this by calculating the real length from the number of samples and the frequency.

edit3: When the sound starts looping in the dvd menu, there is nothing going through the ac3 filter. It must be something in reclock doing this. Why is it playing the same audio buffer again and again when no samples arriving? (btw, the last sample had start:-1 on it, and was a discontuinity)

ogo
16th December 2002, 18:00
edit: no, not always...
Gloups :(

edit2: Why are the timestamps always start:-1, stop:-1? I think in this case ac3 stream runs through the graph without waiting for the samples to complete their playing time. It seems that the ac3 parser filter forgets to attach the timestamps and no other filter corrects this by calculating the real length from the number of samples and the frequency.
I agree with you

edit3: When the sound starts looping in the dvd menu, there is nothing going through the ac3 filter. It must be something in reclock doing this. Why is it playing the same audio buffer again and again when no samples arriving? (btw, the last sample had start:-1 on it, and was a discontuinity)
It's playing the same sound again and again because DirectSound use a circular audio buffer : when it's not feeded in time, it will start to play sound of the past again and again ...
I checked the samples arriving in reclock (not with ac3filter but with intervideo audio decoder). If i remember well, the last one had normal start and end times (nothing special), and all samples had discontinuity=1 (i'll check again tonight)

gabest
17th December 2002, 05:17
Are you sure all samples were a discontinuity? IsDiscontinuity() is somewhat evilish, you can't write if(pSample->IsDiscontinuity()) {...} since it returns S_OK or S_FALSE.

ogo
17th December 2002, 11:04
Oups ... you're right.

All samples i received return IsDiscontinuity() = S_FALSE (ie 1). I must suffer from C++ Pavlov syndrom Isxxx() means for me "return bool".

I checked again with intervideo. IsDiscontinuity is always FALSE when i return to root menu. However when i seek a DVD, i receive a discontinuity for the first sample after seek. It must be a threading problem, because a soon as i click on something in the root menu, i receive the BeginFlush() i should have received before.

Speaking of seek, you noticed strange clicks or noise when seeking DIVX or DVD. This is corrected in next version of reclock.

I have also a little problem to submit to you for MPC. The bottom line is never drawn on my PC (i see some garbage in it). I'm using winxp sp1 dx 8.1, geforce 3, detonator 41.09

gabest
17th December 2002, 11:13
With which renderer is it happening?

ogo
17th December 2002, 11:49
i'm not at home, i'll tell you tonight :)

i have also a little media file that hangs MPC, i'll see if i can send it to you by email. Do you accept big emails ?

BTW do you know how i can use DVD navigator with graphedit ? i don't understand how to connect it ... It works with video, but not with audio (it says it can't connect its ac3 output to ac3filter). Do i miss something ?

gabest
17th December 2002, 11:56
I don't think I can accept anything bigger than a megabyte, but I will send you my ftp address.

about the ac3filter, did you try this version I posted here? Also, 0.6b is already out at sf.net with the modifications needed to connect to the dvd navigator.

ogo
17th December 2002, 16:41
I don't think I can accept anything bigger than a megabyte, but I will send you my ftp address.
Ok i'll see that

I made some quick tests with ac3filter 0.6b. Pure ac3 filter playback problem is still there, and now it even make graphedit crash ...

gabest
17th December 2002, 16:46
I think this part of the code is causing the crash:ac3filter.cpp, line 238:

void
AC3Filter::new_sample()
{
DbgLog((LOG_TRACE, 3, "AC3Filter::new_sample"));
if (sample) sample->Release(); // <---- 2, crash

if FAILED(InitializeOutputSample(input_sample, &sample)) // <---- 1,
sometimes InitializeOutputSample fails and "sample" stays filled with memory
garbage
{
sample = NULL; // <---- 3: add this line to fix it
throw "Get delivery buffer failed";
}
(I sent this to xvalex in email)

ogo
17th December 2002, 19:04
Gabest, i made some tests with graphedit with :
- intervideo audio decoder
- intervideo video decoder
- reclock
- video renderer
- dvd navigator

Guess what ? The problem i see in MPC does not reproduce here. When i go back to the root menu, i receive my BeginFlush() and sound is stopped correctly (no looping). I also checked with ac3filter, and it is fine too (apart for the crash you corrected)

What do you think of this ?

gabest
17th December 2002, 19:27
How did you call the dvd navigator functions in graphedit?

ogo
17th December 2002, 19:39
How did you call the dvd navigator functions in graphedit?
Click play, then open the properties page of dvd navigator
to go to the root menu, highlight "root menu", then click apply (i does not always work), then click "SE" to start the movie. Wait for some sound, the highlight again "root menu" and click apply. it should go back to root menu

For my avi file with problem, forget it, it makes explorer crash when i ask properties. It also makes virtualdub crash. So it's just a bad avi :)

For the bottom line problem, i had to try many times and concluded that :
- it seems to only happen if i choose "System default" as video renderer :confused:
- it seems to only happen if i choose "Stretch to window"

ogo
17th December 2002, 19:58
update: for the looping sound problem. You even don't need graphedit : simply play the DVD with MPC, and use DVD navigator from the filter list. Then go back to "root menu" with DVD navigator and bingo sounds stop correctly ...

gabest
17th December 2002, 20:00
I think you can consider the "looping sound bug" solved... If I add the DVD_CMD_FLAG_Flush to the call it plays perfectly alright. Now, I just don't know why it was already ok with the other MS renderers.

gabest
17th December 2002, 20:46
Added this flushing flag to a few places and the seeking and menu navigation also seems to go faster now: http://vobsub.edensrising.com/mpc2kxp6413.zip.

ogo
18th December 2002, 00:50
Oh great :) Thanks Gabest

Will you have a look inside ac3filter for the "pure" file issue ? You said in a earlier post that the bug was not always appearing in debug build.

For reclock i just have to have a look into win98 problems and it will be finished :)

Chibi Jasmin
18th December 2002, 01:32
I didn't really understand, if you guys noticed, but the dvd menu looping thing also happens with ZoomPlayer and Intervideo Video/Audio...just in case...

gabest
18th December 2002, 11:33
ogo: Ok, I'm going to dive into ac3filter's code again... but you could also check reclock since it works well with the other audio renders.For reclock i just have to have a look into win98 problems and it will be finished LOL, that's what you think :D

Chibi Jasmin: Who knows, maybe zoomplayer also forgets to use this flag. Blight, are you listening? :)

ogo
18th December 2002, 12:25
gabest, i really think it's a problem in ac3filter. The sample times i receive are bad : i always receive the same two values for starttime and stoptime, except for the first sample. My renderer thinks those time are times of the past, then it schedule to sample to play them as soon as they are received (because they are too "old"). That's why the sound plays at full speed (unsynced).

gabest
18th December 2002, 13:41
It is the problem of the ac3 parser because it doesn't set the time on the samples, but you could easily correct it if you were manually accumlating the times when this happens. I've just tried this with my audio switcher and it worked fine that way (http://vobsub.edensrising.com/mpc2kxp6414.zip). Also, I believe that such a workaround fix could help your renderer out in a few other but similar graph configurations.

ogo
18th December 2002, 14:33
Yes you're right. Didn't know a renderer could have to create its own sample times ...

Anyway here is a part of my ScheduleSample method. Do you think it is sufficient to do that (it works fine with pure ac3 files) :

BOOL CReClock::ScheduleSample(IMediaSample *pMediaSample)
{
REFERENCE_TIME StartSample;
REFERENCE_TIME EndSample;

// Is someone pulling our leg
if (pMediaSample == NULL) return FALSE;

// Get the next sample due up for rendering. If there aren't any ready
// then GetNextSampleTimes returns an error. If there is one to be done
// then it succeeds and yields the sample times. If it is due now then
// it returns S_OK other if it's to be done when due it returns S_FALSE
HRESULT hr = GetSampleTimes(pMediaSample, &StartSample, &EndSample);
if (FAILED(hr)) return FALSE;

/////////////////// FIX FOR MISSING SAMPLE TIMES

// Sample is due for rendering now (no timestamps). We have to calc our own
// timestamps
if (hr == S_OK)
{
// Not sure if this is necessary
if (pMediaSample->IsDiscontinuity() == S_OK)
m_nextStart = 0;

ULONGLONG l_estimatedLen = ((ULONGLONG)10000000 * (ULONGLONG)pMediaSample->GetActualDataLength()) / ((ULONGLONG)m_audioFormat.Format.nBlockAlign * (ULONGLONG)m_audioFormat.Format.nSamplesPerSec);

StartSample = m_nextStart;
m_nextStart += (REFERENCE_TIME)l_estimatedLen;
EndSample = m_nextStart;

hr = S_FALSE;
}
// Sample has a timestamp. Take it as the last known
else if (hr == S_FALSE)
m_nextStart = EndSample;

/////////////////// END OF FIX FOR MISSING SAMPLE TIMES

gabest
18th December 2002, 16:10
Well, mine looks like this:REFERENCE_TIME rtStart, rtStop;
if(SUCCEEDED(pIn->GetTime(&rtStart, &rtStop)))
{
rtStart += m_rtAudioTimeShift;
rtStop += m_rtAudioTimeShift;
pOut->SetTime(&rtStart, &rtStop);

m_rtNextStart = rtStart;
}
else
{
pOut->SetTime(&m_rtNextStart, &m_rtNextStop);
}

WAVEFORMATEX* wfe = (WAVEFORMATEX*)pInPin->CurrentMediaType().pbFormat;
int bps = wfe->wBitsPerSample>>3;
int len = pIn->GetActualDataLength()/(bps*wfe->nChannels);

m_rtNextStart += 10000000i64*len/wfe->nSamplesPerSec;
m_rtNextStop = m_rtNextStart + 1;There are a few minor differencies.

1. I wouldn't trust the stop times, they are not necessarily the beginning of the next sample. While debugging ac3filter, I could see that they are only set to start+1, just like I do now.

2. Instead of checking pMediaSample->IsDiscontinuity(), I check the return value of GetTime(..) and make the workaround depend on this.

edit: looking at my code again, I could also write "m_rtNextStop += 10000000i64*len/wfe->nSamplesPerSec;" there in the last line :)

Chibi Jasmin
18th December 2002, 20:16
Originally posted by gabest
Chibi Jasmin: Who knows, maybe zoomplayer also forgets to use this flag. Blight, are you listening? :)

Just to make it clear, I meant in conjunction with ReClock only. With Default DirectSound it works fine...so is this a problem of ZoomPlayer or Reclock? :D

ogo
18th December 2002, 23:34
I would say ZoomPlayer but i'm biaised :)

Anyway version 0.98 is available on my website !

All known bugs are corrected, except the win98 problems. Please send me some feedback if you want a working ReClock on win98 (maybe version 0.98 does work on win98)

Did you see guys we are currently competing for the longest thread in the "general discussion forum" ?

:D

Chibi Jasmin
20th December 2002, 02:21
Maybe you, ogo or gabest, can mail the fix for the Intervideo looping thing to blight?

And how do we get on with the issue of 'may not correct the good video clock on dual head/2 ramdac cards?'. Any progress on this one?

ogo
21st December 2002, 17:04
And how do we get on with the issue of 'may not correct the good video clock on dual head/2 ramdac cards?'. Any progress on this one?
I've not been able to get my hands on a G450 (only a G200). I'll make some tests on my notebool (it has a dual head M6 mobility video card), and i'll report results !

In the meantime Merry Christmas & Happy new year :D

Chibi Jasmin
22nd December 2002, 02:39
Same to you :)

ogo
22nd December 2002, 15:44
Version 0.98b is out on my website.

It fixes some problems with dual head Radeon video cards, and may also fix problems with other dual head video cards.
I also give new instructions in the readme to use successfully dual head videocards with ReClock.

Chibi Jasmin could you test again ReClock on your G450 with these instructions ? Thanks

OGO

Chibi Jasmin
22nd December 2002, 17:00
Hi there...

The instructions don't make any sense for the Matrox way of doing things...it would compromise the whole use of the dual head thing having a (maybe even minimized) playback window on the desktop (monitor) and fullscreen output on tv. I am not even sure, if TV as primary display would work, and even if, I would not be willing to use it that way...the special playback mode of Matrox cards (DVDMax) I am talking of gives way better playback quality than any cloning or fullscreening on primary display or whatever, so what you describe is not usable or at least not usable without compromising usability and image quality on Matrox cards. I consider it not an option, sorry to say that...I can't comment on any other cards.

BTW: I have a G400 Dual Head, not G450.

Seems there is some further investigation needed into the dependency of two video clocks (do even two clocks exist?) on the Matrox cards.

I didn't have too many problems though, the way it is...maybe we don't even need to adjust anything...I don't have too much jerkiness with or without clock correction so it's hard to say, if something is actually successfull or even needed...maybe the Matrox TV-Out thing automatically adjusts itself to some extent to the video frame rate? Who knows...I don't...

ogo
23rd December 2002, 20:24
The instructions don't make any sense for the Matrox way of doing things...it would compromise the whole use of the dual head thing having a (maybe even minimized) playback window on the desktop (monitor) and fullscreen output on tv. I am not even sure, if TV as primary display would work, and even if, I would not be willing to use it that way...the special playback mode of Matrox cards (DVDMax) I am talking of gives way better playback quality than any cloning or fullscreening on primary display or whatever, so what you describe is not usable or at least not usable without compromising usability and image quality on Matrox cards
Maybe i'm wrong, but from what i've read, DVDMax is the same thing that "Theater mode" on Radeon videocards, ie stretching of an Overlay surface in full screen on your TV. For sure Radeon in theather mode doesn't work with ReClock, because i can't obtain informations on the clock used internally by the video card. That's why i suggest to use TV as a primary display (and in this case ReClock has access to the clock).
For what i saw with my eyes on a Radeon on a $1500 TV, quality is exactly the same in theather mode or primary tv display (it's always an overlay surface displayed on TV). The only important thing in primary mode, is to carefully choose screen resolution and to activate "overscan mode" which oddly is an hidden registry setting. BUT i can't speak for G400 cards, cause i didn't have one in my hands :)

Seems there is some further investigation needed into the dependency of two video clocks (do even two clocks exist?) on the Matrox cards.
Radeon cards have two RAMDACS. The only problem in your case is to have access to the clock of the TV RAMDAC. In the case of the Radeon, you get access to it in "primary tv" mode.

I didn't have too many problems though, the way it is...maybe we don't even need to adjust anything...I don't have too much jerkiness with or without clock correction so it's hard to say, if something is actually successfull or even needed...
It really depends on your hardware. I saw very different clock deviations on the PC's i used for the tests. Some of them needed huge correction, others didn't. The worst i saw was a PC that was skipping one frame every 20 seconds in PAL, and the best one frame every ... 30mn
However i observed that the RAMDAC used for TV was always more precise than the RAMDAC used for the monitor.

I submitted for the third time my work to doom9 webmaster, but i still didn't get any response. Maybe i'm sending my e-mail to the wrong adress. Is submission@doom9.net correct ? In the past i had a direct e-mail adress to contact doom9 but i lost it. Could some admin help me (or give me a response). Thanks in advance ;)

Sumster
24th December 2002, 08:47
First comment!

RECLOCK is amazing! For the first time, DIVX movies are playing back smoothly on my Radeon card! After months of trying to fix my jerky panning scenes, they are finally smooth as silk!! I should mention, I run my monitor at 85Hz and my DIVX are at 23.976, therefore Media adaptation does not work. DESPITE THIS, media are playing back much smoother than before (which I assume is due to the more accurate external clock).

When I use TV-out on my Radeon, it sets both my monitor and tV-OUT to 60Hz automatically. I do not need framerate adaptation for my media, as RECLOCK seems to make things smoother even without media adaptation.

My main issue was using SPDIF out to my external receiver. That is the main reason I mux AC3 files with my DIVX. Is there any way to use RECLOCK to simply act as a more accurate external clock using the default directsound device??? This way, video would be smoother, and the audio would sync along with the smoothened video. I do not want any changes to the digital SPDIF stream, DRC, etc... just utilize the external clock function in DirectX 8 with the Default Directsound driver so that SPDIF could be enabled.

Is this possible??

Thanks again for all of your work!

Sumster

Sumster
24th December 2002, 08:56
Or more simply put....

Can you disable RECLOCK as an actual audio renderer, and simply use it as a more accurate external clock for VMR9 and the default directsound renderer?

Thanks!

billou2k
24th December 2002, 09:11
Hi there
thanks to Ogo and Gabest for that work that looks great.. but unfortunatly I cant test it as Geocities realised you've got too much success ;-)
could it be host in doom9 server or another temporary place?
Great work guys
Bye

billou2k
24th December 2002, 10:37
Looks like eventually I could access the file...
So I must said I am amazed by your tool Ogo,
it is really a pain relief!
Until now I thought that my hardware was the only reason to jerkiness (xp 1800+ radeon8500 sb audigy... shame...)so i was somehow resigned in that crappy jerkiness.
But everything is solved now so a GREAT Thanks to you and all those helping you.
Keep up the excellent work!

ogo
24th December 2002, 12:45
Thanks for your positive comments :)

Sorry for the problems with Geocities. Didn't knew the bandwidth limit was so low. I asked my ISP to give me access to some space. It will take a few days ...

I must go (it's Christmas now and i go back to my family). I won't have access to Internet for a few days, so i'll answer your questions when i'll be back (27/12) !

In the meantime happy Christmas to all :D

Chibi Jasmin
24th December 2002, 13:30
Originally posted by ogo
Maybe i'm wrong, but from what i've read, DVDMax is the same thing that "Theater mode" on Radeon videocards, ie stretching of an Overlay surface in full screen on your TV. For sure Radeon in theather mode doesn't work with ReClock, because i can't obtain informations on the clock used internally by the video card.

It's the same for G400...

Originally posted by ogo

That's why i suggest to use TV as a primary display (and in this case ReClock has access to the clock).
For what i saw with my eyes on a Radeon on a $1500 TV, quality is exactly the same in theather mode or primary tv display (it's always an overlay surface displayed on TV). The only important thing in primary mode, is to carefully choose screen resolution and to activate "overscan mode" which oddly is an hidden registry setting. BUT i can't speak for G400 cards, cause i didn't have one in my hands :)


This however is no solution for the G400 for reasons I tried to explain above...it compromises usability and quality(!). If there's no way to have access to the tv-clock on G400, it's a problem, I guess...
I perfectly understand your suggestion, and I also understand, why it's not usable or at least a very bad compromise...

Originally posted by ogo


Radeon cards have two RAMDACS. The only problem in your case is to have access to the clock of the TV RAMDAC. In the case of the Radeon, you get access to it in "primary tv" mode.


Yeah, getting the tv-clock is the problem...but there should be a way to get access to it without switching around with displays and resolution and setting tv as primary display. Otherwise, it's bad...hope you find something...or try to get your hands on a G400 for testing or something like that :) But first have a nice christmas...catch ya l8er!

BTW: I still have Reclock crashing sometimes on starting to play a dvd (seems to crash while graph building) with zoomplayer.

Shootist
25th December 2002, 10:38
Sorry, this site is temporarily unavailable!

Maybe time to move to a better web with more traffic? I want to get it too. Didn`t find it with google...

Membrax
25th December 2002, 12:52
Hi all!
I really need reclock ... but I can't access the website!
If someone could send it to me (dr_alexx@hotmail.com)
I could up it to my site !
Thanks! Merry Christmas ;)

Chibi Jasmin
25th December 2002, 14:56
Originally posted by Membrax
Hi all!
I really need reclock ... but I can't access the website!
If someone could send it to me (dr_alexx@hotmail.com)
I could up it to my site !
Thanks! Merry Christmas ;)

I just sent it to you.

nikthebak
25th December 2002, 15:09
Yes, maybe it would be a good thing to make ReClock doom9 hosted. Anything even remotely popular IST officially DEATH when hosted on GeoCities...

However, I'm having some problems with ReClock and TV out with my Radeon 7200. When TV-out is activated (sets the refresh rate to 50 Hz for monitor), media players hang when opening a video clip. Seems like ReClock can't recognize the refresh rate used.

Membrax
25th December 2002, 19:37
Thanks mate !!!!
I didn't have the time to test it yet (in france we eat a lot for christmas ;) )

Download :
hp://membrax.free.fr/ReClockV0.98b.rar

enjoy !

ogo
26th December 2002, 22:45
Back from Christmas :)

Sorry for the problems with geocities. Thanks to some space given by my ISP i have setup a new permanent website. It's located here (http://ogo.nerim.net/reclockfilter) !

I have received some bug reports (mainly lockup problems), and will look into them.

OGO

cca
27th December 2002, 11:22
The latest versions of AC3Filter support PCM 24bit and PCM Float as output but ReClock does not support this. Ogo, can you add this modes to ReClock?

nikthebak
27th December 2002, 14:06
OK, I just solved the ReClock locking up problem with TV-out enabled. The solution was to enable ONLY the TV-out. The lockup occured only when both monitor and TV-outs were enabled.

However, other problem emerged, ReClock locks when DirectVobSub is enabled.

ogo
27th December 2002, 14:35
Yes there are some reports of lockups :
- with DirectVobSub
- with ZoomPlayer beta 3
- with some media files

I'm looking into these problems. I'm currently scratching my head on a "case" here :)

I have not included support for PCM24 or PCM float now. They are really a hassle to add. Do you REALLY think it would be useful ? In which case ?

I have also been asked to add AC3 SP/DIF support which i think would be more interesting. I could add it but i'm quite sure there will be synchronisation issues with video, and i don't have a hardware AC3 decoder in my hands to test (however i have sp/dif on my soundcard). Someone is making some tests for me.

Anyway Gabest or Valex could you give me some hints on how to add SP/DIF support in the renderer (the media type is not the problem, i just need info for the playback part) ??? Thanks

gabest
27th December 2002, 14:40
Sorry, I have absolutely no idea about how to output anything using dsound :o

ogo
27th December 2002, 22:55
Christmas, Christmas ...

A new version is available (0.98c). It fixes a lockup problem (no new features)

Gabest> Got some infos about AC3. dsound is pure s... cause i must use Waveout to get AC3 working ... It means rewritting some stuff :(

:)

sillKotscha
28th December 2002, 02:33
Hi ogo,

first of all thanks for your ds_filter. Keep up your good work! I've tried it and it work very well - but, yes a little but :( - today I've tested your filter on some short *.mpg clip and unfortunately it cuts off the sound at the beginning and at the end...

I think it's due to your filter because after uninstalling everthing was as expected, I mean I could hear all of it.

It is a very short clip and I've uploaded it, so maybe you can test it and afterwards tell me that I'm dumb or find out that it's really due to your filter.

Thanks in advance

Sill

test clip (http://www.sahnau.de/skotscha/voll%20s%fc%df.rar) = (856k)

Xenoproctologist
29th December 2002, 13:27
This filter seems interesting, but the pitch shifts are murder to those of us with perfect pitch (or in my case, near-perfect pitch). Since (according to your readme) you won't do true audio resampling, could you provide persistant Media Adaptation Speed settings so I can at least force the framerate to the video's original speed?

ogo
29th December 2002, 14:03
sillKotscha> This cutted sound is due to the preload time of reclock which is much longer than the preload time of the directsound audio renderer (500ms versus maybe 50-100ms). Such a big latency is necessary to allow smooth pitch changes of the sound. Maybe i'll provide a setting to allow lower latency in future versions, but for now i can't do nothing for that

Xenoproctologist> The audio speed MUST be changed in order to stay in sync with the video. There is no way to go around this. So resampling is mandatory. You can use "hardware resampling" if it works fine with your soundcard. This will give you original quality sound. To my knowledge no human being can hear pitch differences as low as 10hz :)
If you want a constant pitch sound, just disable clock correction. You will loose the accurate clock (which is what reclock was made for), and reclock will just act as a framerate changer for your media (ie 23,976->25 fps adaptation for example). But this is a way to use it i really don't recommend.