Author Topic: BassVideo  (Read 340544 times)

quickmic

  • Posts: 255
Re: BassVideo
« Reply #700 on: 23 Feb '09 - 10:05 »
I replaced "Call BASS_PluginLoad("BassVideo.DLL", 0)" with your code sample, but BassVideo is loaded.
I got a handle of the Plugin.

kenshin1101

  • Posts: 545
Re: BassVideo
« Reply #701 on: 23 Feb '09 - 10:06 »
I replaced "Call BASS_PluginLoad("BassVideo.DLL", 0)" with your code sample, but BassVideo is loaded.
I got a handle of the Plugin.

try use BassVideo_StreamCreateFile the handle is same as Bass_StreamCreateFile

quickmic

  • Posts: 255
Re: BassVideo
« Reply #702 on: 23 Feb '09 - 10:12 »
No difference  :(

kenshin1101

  • Posts: 545
Re: BassVideo
« Reply #703 on: 23 Feb '09 - 10:16 »
No difference  :(
then you must wait for my codec release, haha,
maybe next month T_T, i was too busy at work

quickmic

  • Posts: 255
Re: BassVideo
« Reply #704 on: 23 Feb '09 - 10:19 »
No problem. Thx for your support.

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BassVideo
« Reply #705 on: 23 Feb '09 - 15:11 »
bassAAC and bassVideo have problems in combination.... (I tested with an MP4-file)

Are you using the latest BASS_AAC version? If so, please upload a troublesome file to have a look at here...

   ftp.un4seen.com/incoming/

.DynamicAmpHandle = BASS_ChannelSetFX(.StreamDecode, BASS_FX_DX8_COMPRESSOR, 0)
Call BASS_FXSetParameters(.DynamicAmpHandle, .DynamicAmp)
... In case I use the second way of order, the DynamicAmpHandle returns 0.
If I use the first way of order of the Plugins, the sound is correct amplificated but, as I told, no videoscreen.

That's strange. BASS_ChannelSetFX doesn't care what type of stream it is, so that shouldn't make any difference to it. What happens if you try to use a BASS_FX effect instead, eg. BASS_FX_BFX_COMPRESSOR2?

Also, if you call BASS_ChannelGetInfo on the stream, what info do you get?

BASS_ErrorGetCode return 0.

Just to be sure, are you calling BASS_ErrorGetCode straight after the failed BASS_ChannelSetFX call, with no other BASS calls in-between?

quickmic

  • Posts: 255
Re: BassVideo
« Reply #706 on: 24 Feb '09 - 07:58 »
Hi. I have upload 3 files, but it "feels" strange. After upload, I cannot see the files on FTP. Is this normal, and does it work?

I have also tested with bassFX. This one works correct. It gave me a handle back.
But have a look at the testplayer I uploaded.
"Public Sub PlayerInit()" is one of the importent parts. see comments...
"Public Sub PlayerLoad(data As PlayerData)" is the second importent part.


BASS_ErrorGetCode was callled directly after the ".DynamicAmpHandle = BASS_ChannelSetFX(.StreamDecode, BASS_FX_DX8_COMPRESSOR, 0)"
« Last Edit: 24 Feb '09 - 08:11 by quickmic »

Erazer

  • Posts: 441
Re: BassVideo
« Reply #707 on: 24 Feb '09 - 08:01 »
I cannot see the files on FTP. Is this normal, and does it work?
Yes.

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BassVideo
« Reply #708 on: 24 Feb '09 - 17:03 »
I have also tested with bassFX. This one works correct. It gave me a handle back.
But have a look at the testplayer I uploaded.
"Public Sub PlayerInit()" is one of the importent parts. see comments...
"Public Sub PlayerLoad(data As PlayerData)" is the second importent part.

What does BASS_ChannelGetInfo say when BASS_ACC is handling the file and when BassVideo is handling it?

Meanwhile, here's a BASS_AAC update to try...

   www.un4seen.com/stuff/bass_aac.dll

Similarly to the earlier BASSWMA update, it adds a config option to determine whether it should play the audio from MP4 video files...

Code: [Select]
#define BASS_CONFIG_MP4_VIDEO 0x10700

It's enabled by default, so you'll want to disable it (via BASS_SetConfig value=FALSE) when using BassVideo.

quickmic

  • Posts: 255
Re: BassVideo
« Reply #709 on: 25 Feb '09 - 07:54 »
BASS_ChannelGetInfo give me correct infos. Samplerate, channels is ok in both ways. No difference if bassAAC or BassVideo decodes.
Your new version of AAC works correct. If I disable the video in AAC, I can set AAC-Plugin before bassvideo in the "load-order" and still watch the video.


Independent of these problems, I have found another problem.
Sometimes I got a negative duration of some video-files using...
PlayerData(2).Duration = BASS_ChannelGetLength(PlayerData(2).StreamDecode, BASS_POS_BYTE)

It happens, as I have seen, on very long videos. Most times if I load a DVD, but it is also possible if I use a normal video which is long.
Maybe a overflow or something like that?



Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BassVideo
« Reply #710 on: 25 Feb '09 - 16:41 »
BASS_ChannelGetInfo give me correct infos. Samplerate, channels is ok in both ways. No difference if bassAAC or BassVideo decodes.

Are the "flags" the same too?

Also, just to be sure, you're saying that you can successfully set the BASS_FX_DX8_COMPRESSOR effect on the stream when BASS_AAC is handling it but not when BassVideo is? That's puzzling, but equally puzzling is the 0 error code, as I can't see any way for that to happen. Are you absolutely certain that the error code is 0?

Independent of these problems, I have found another problem.
Sometimes I got a negative duration of some video-files using...
PlayerData(2).Duration = BASS_ChannelGetLength(PlayerData(2).StreamDecode, BASS_POS_BYTE)

It happens, as I have seen, on very long videos. Most times if I load a DVD, but it is also possible if I use a normal video which is long.
Maybe a overflow or something like that?

Yep, that does sound like an overflow. The BASS_ChannelGetLength return value is unsigned 64-bit, but you appear to be using VB, which unfortunately means that you will only see the lower 32 bits. The negative value will be due to VB treating it as a signed value, which further limits you to 31 bits. Perhaps it's possible to get VB to treat it as an unsigned value instead?

quickmic

  • Posts: 255
Re: BassVideo
« Reply #711 on: 25 Feb '09 - 17:55 »
I tested again and here on my home-computer I got an error 6 back (decoding on bassvideo). But I'm almost sure, that at my computer at work gave the result as I posted...

If I use "chan = BASS_StreamCreateFile(BASSFALSE, StrPtr(cmd.filename), 0, 0, BASSVIDEO_AUTO_RESIZE Or BASS_SAMPLE_FLOAT)"
Error = 0... No error
Case I use "chan = BASS_StreamCreateFile(BASSFALSE, StrPtr(cmd.filename), 0, 0, 0)"
Error = 6... Unsupported sample format

... I hope there was nothing mixed up at my work PC  ::). The result as I posted was the result with the VB-example from kenshin1101.
Here at home I tested with my main project.

But I think, error 6 is the problem. I also reprogrammed everything (Equalizer and compressor) to bassFX. There is no problem at all, and I will let it this way. So for me there is no hurry to fix that.


Quote
Yep, that does sound like an overflow. The BASS_ChannelGetLength return value is unsigned 64-bit, but you appear to be using VB, which unfortunately means that you will only see the lower 32 bits. The negative value will be due to VB treating it as a signed value, which further limits you to 31 bits. Perhaps it's possible to get VB to treat it as an unsigned value instead?

OhOh... Not good. I can correct the values "manually" if I add "2147483648" (2^31) if the value is negative and convert it to a "single" varibale in VB6. But this very bad. All APIs of bass needs long-varibales, so I have always "drive" in two ways. I cannot send the correct single-values to the APIs of bass.

ie.
If want the time...
Seconds = BASS_ChannelBytes2Seconds64(PlayerData(2).StreamDecode, PlayerData(2).Duration, 0)
... I have to give bass the negative duration value. Then the result is ok, but sending the "correct"-single value isn't possible.

And 32bit (even its unsigned) is also only ok for 4GB (DVD). If I think in future to bluray-video....

But it seems there is no other way  :-\
« Last Edit: 25 Feb '09 - 19:14 by quickmic »

quickmic

  • Posts: 255
Re: BassVideo
« Reply #712 on: 26 Feb '09 - 07:13 »
Ok, I tested again. Error 6 is the problem.

kenshin1101

  • Posts: 545
Re: BassVideo
« Reply #713 on: 26 Feb '09 - 07:54 »
Ok, I tested again. Error 6 is the problem.

my example provide no error in my computer at all

quickmic

  • Posts: 255
Re: BassVideo
« Reply #714 on: 26 Feb '09 - 08:38 »
I think this problem is not solvable at the moment, if I'm the only one who have problems. As I said, I have now bassFX in use, and this works perfect.

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BassVideo
« Reply #715 on: 27 Feb '09 - 13:38 »
I tested again and here on my home-computer I got an error 6 back (decoding on bassvideo). But I'm almost sure, that at my computer at work gave the result as I posted...

If I use "chan = BASS_StreamCreateFile(BASSFALSE, StrPtr(cmd.filename), 0, 0, BASSVIDEO_AUTO_RESIZE Or BASS_SAMPLE_FLOAT)"
Error = 0... No error
Case I use "chan = BASS_StreamCreateFile(BASSFALSE, StrPtr(cmd.filename), 0, 0, 0)"
Error = 6... Unsupported sample format

... I hope there was nothing mixed up at my work PC  ::). The result as I posted was the result with the VB-example from kenshin1101.
Here at home I tested with my main project.

But I think, error 6 is the problem. I also reprogrammed everything (Equalizer and compressor) to bassFX. There is no problem at all, and I will let it this way. So for me there is no hurry to fix that.

Error code 6 is BASS_ERROR_FORMAT, which means that the effect didn't like the stream's sample format. So I suspect there was some difference in the format between BASS_AAC and BassVideo. See the BASS_CHANNELINFO (including "flags") to confirm that.

And 32bit (even its unsigned) is also only ok for 4GB (DVD). If I think in future to bluray-video....

But it seems there is no other way  :-\

Perhaps you could use VB.Net? I think that supports 64-bit types.

quickmic

  • Posts: 255
Re: BassVideo
« Reply #716 on: 3 Mar '09 - 10:45 »
Sorry for the delay.

Here a list... values are in decimal, NOT hex!


Test1: Decoding on bassvideo with used bassmix (upmix to 4 channel):

PluginHandle(1) = BASS_PluginLoad("bassvideo.dll", 0)
PluginHandle(3) = BASS_PluginLoad("bassAAC.dll", 0)
.
.
.
.StreamDecode = BASS_StreamCreateFile64(0, "c:\1.mp4", 0, 0, 0, 0, BASS_STREAM_DECODE Or BASS_STREAM_PRESCAN)
.Stream = BASS_Mixer_StreamCreate(48000, 4, 0)
Call BASS_Mixer_StreamAddChannel(.Stream, .StreamDecode, BASS_MIXER_MATRIX Or BASS_MIXER_BUFFER)
Call BassVideo_SetSync(.StreamDecode, .Stream)
.
.
MsgBox ttt.FLAGS
MsgBox ttt.chans
MsgBox ttt.ctype
MsgBox ttt.filename
MsgBox ttt.freq
MsgBox ttt.origres
MsgBox ttt.plugin
MsgBox ttt.sample
->Result:
flags 2097152
chans 4
ctype 69888
filename 0
freq 44100
origres 16
plugin 27656192

.
.
.DynamicAmpHandle = BASS_ChannelSetFX(.StreamDecode, BASS_FX_DX8_COMPRESSOR, 0)
->Result:
.DynamicAmpHandle=0


Test2: Decoding on bassAAC with used bassmix (upmix to 4 channel):

PluginHandle(3) = BASS_PluginLoad("bassAAC.dll", 0)
PluginHandle(1) = BASS_PluginLoad("bassvideo.dll", 0)
.
.
.
.StreamDecode = BASS_StreamCreateFile64(0, "c:\1.mp4", 0, 0, 0, 0, BASS_STREAM_DECODE Or BASS_STREAM_PRESCAN)
.Stream = BASS_Mixer_StreamCreate(48000, 4, 0)
Call BASS_Mixer_StreamAddChannel(.Stream, .StreamDecode, BASS_MIXER_MATRIX Or BASS_MIXER_BUFFER)
Call BassVideo_SetSync(.StreamDecode, .Stream)
.
.
MsgBox ttt.FLAGS
MsgBox ttt.chans
MsgBox ttt.ctype
MsgBox ttt.filename
MsgBox ttt.freq
MsgBox ttt.origres
MsgBox ttt.plugin
MsgBox ttt.sample
->Result:
flags 2097152
chans 2
ctype 68353
filename 63418352
freq 44100
origres 0
plugin 268435456

.
.
.DynamicAmpHandle = BASS_ChannelSetFX(.StreamDecode, BASS_FX_DX8_COMPRESSOR, 0)
->Result:
.DynamicAmpHandle<>0



Test3: Decoding on bassvideo:

PluginHandle(1) = BASS_PluginLoad("bassvideo.dll", 0)
PluginHandle(3) = BASS_PluginLoad("bassAAC.dll", 0)
.
.
.
.StreamDecode = BASS_StreamCreateFile64(0, "c:\1.mp4", 0, 0, 0, 0, 0)
.
.
MsgBox ttt.FLAGS
MsgBox ttt.chans
MsgBox ttt.ctype
MsgBox ttt.filename
MsgBox ttt.freq
MsgBox ttt.origres
MsgBox ttt.plugin
MsgBox ttt.sample
->Result:
flags 16
chans 4
ctype 69888
filename 0
freq 44100
origres 16
plugin 61407232

.
.
.DynamicAmpHandle = BASS_ChannelSetFX(.StreamDecode, BASS_FX_DX8_COMPRESSOR, 0)
->Result:
.DynamicAmpHandle=0




Test4: Decoding on bassAAC:

PluginHandle(3) = BASS_PluginLoad("bassAAC.dll", 0)
PluginHandle(1) = BASS_PluginLoad("bassvideo.dll", 0)
.
.
.StreamDecode = BASS_StreamCreateFile64(0, "c:\1.mp4", 0, 0, 0, 0, 0)
.
.
Call BASS_ChannelGetInfo(.StreamDecode, ttt)
.
.
MsgBox ttt.FLAGS
MsgBox ttt.chans
MsgBox ttt.ctype
MsgBox ttt.filename
MsgBox ttt.freq
MsgBox ttt.origres
MsgBox ttt.plugin
MsgBox ttt.sample
->Result:
flags 16
chans 2
ctype 68353
filename 4060720
freq 44100
origres 0
plugin 268435456

.
.
.DynamicAmpHandle = BASS_ChannelSetFX(.StreamDecode, BASS_FX_DX8_COMPRESSOR, 0)
->Result:
.DynamicAmpHandle<>0



-----------------------------------------
A change to .NET isn't possible. There are too much VB6-specific commands and also a lot of DirectX-stuff, so the automatic convertion from VB6 to VB.net of visual studio 2008 is not working. After a convertion there are so much bugs, that a complete reprogramming is almost faster  :P
But now I have modified the commands to get the 32bit unsignd values (as I described (two ways)). So up to 4GB is now everything working correctly.


Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BassVideo
« Reply #717 on: 3 Mar '09 - 15:15 »
Test3: Decoding on bassvideo:
...
chans 4

Test4: Decoding on bassAAC:
...
chans 2

There you go then :)

The DX8 effects do not support multi-channel, hence the BASS_ERROR_FORMAT error when attempting to set the BASS_FX_DX8_COMPRESSOR effect on the 4 channel BassVideo stream.

quickmic

  • Posts: 255
Re: BassVideo
« Reply #718 on: 3 Mar '09 - 16:55 »
Yes..

That make sense, and bring some light in this tricky problem. But there is still something strange.. The orginial 1.mp4-video is 2 channel as I remember.... 'Will check it again tomorrorw. The "chans" returns me what? The original channels of the mp4 or the modified stuff after bassmix (upmixed to 4 channels)?

Bassvideo give me always 4 channels, no matter if upmix or not, and bassacc gives me always 2 channels. That makes no sense to me. I also verify this again.

kenshin1101

  • Posts: 545
Re: BassVideo
« Reply #719 on: 4 Mar '09 - 01:24 »
Yes..

That make sense, and bring some light in this tricky problem. But there is still something strange.. The orginial 1.mp4-video is 2 channel as I remember.... 'Will check it again tomorrorw. The "chans" returns me what? The original channels of the mp4 or the modified stuff after bassmix (upmixed to 4 channels)?

Bassvideo give me always 4 channels, no matter if upmix or not, and bassacc gives me always 2 channels. That makes no sense to me. I also verify this again.

this base on the filter you install on your system
i have no idea when i release my codec pack he he

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: BassVideo
« Reply #720 on: 4 Mar '09 - 16:56 »
That make sense, and bring some light in this tricky problem. But there is still something strange.. The orginial 1.mp4-video is 2 channel as I remember.... 'Will check it again tomorrorw. The "chans" returns me what? The original channels of the mp4 or the modified stuff after bassmix (upmixed to 4 channels)?

BASS_ChannelGetInfo will tell you about the stream that you give it, eg. if you give it the BassVideo stream handle, it'll tell you about that, and if you give it the mixer stream handle, it'll tell you about that. Note that it doesn't necessarily tell you the original file's sample format, eg. the decoder may up/down-mix.

quickmic

  • Posts: 255
Re: BassVideo
« Reply #721 on: 5 Mar '09 - 15:22 »
Ok, now everything is clear. I also found the problem of the codec. If the speaker-settings of windows is set to quatrophony, the default install of K-Lite-Codec (ffdshow audio dec.) does an automatic upmix to 4 channel. The main hint was that 4 channels isn't supported by BASS_FX_DX8_COMPRESSOR. Never thought that the 4-channels make these problems.

So many thx for the support and the patience!
« Last Edit: 5 Mar '09 - 15:25 by quickmic »

Erazer

  • Posts: 441
Re: BassVideo
« Reply #722 on: 7 Mar '09 - 20:00 »
kenshin1101, what about my questions ? ;)
Sure not  ;) Bkz even
Code: [Select]
BASS_PluginLoad(PChar(ExtractFileName(Application.ExeName) + 'bass.dll'), BASS_UNICODE);
    BASS_PluginLoad(PChar(ExtractFileName(Application.ExeName) + 'bassvideo.dll'), BASS_UNICODE);
+
Code: [Select]
Chan :=BassVideo_StreamCreateFile(PChar(SourceFileName),Bass_Stream_Decode or BASS_UNICODE, 0, 0); gives chan<>0 but
Code: [Select]
Chan:=Bass_StreamCreateFile(FALSE, PChar(SourceFileName),0,0,Bass_Stream_Decode or BASS_UNICODE); gives chan=0.
Well, so why sometimes I have to see VideoOutput window and have such problems using bassmix  :)

kenshin1101

  • Posts: 545
Re: BassVideo
« Reply #723 on: 9 Mar '09 - 09:22 »
kenshin1101, what about my questions ? ;)
Sure not  ;) Bkz even
Code: [Select]
BASS_PluginLoad(PChar(ExtractFileName(Application.ExeName) + 'bass.dll'), BASS_UNICODE);
    BASS_PluginLoad(PChar(ExtractFileName(Application.ExeName) + 'bassvideo.dll'), BASS_UNICODE);
+
Code: [Select]
Chan :=BassVideo_StreamCreateFile(PChar(SourceFileName),Bass_Stream_Decode or BASS_UNICODE, 0, 0); gives chan<>0 but
Code: [Select]
Chan:=Bass_StreamCreateFile(FALSE, PChar(SourceFileName),0,0,Bass_Stream_Decode or BASS_UNICODE); gives chan=0.
Well, so why sometimes I have to see VideoOutput window and have such problems using bassmix  :)

i think that is problem of your delphi because they all work fine in my delphi 7

Chan:=Bass_StreamCreateFile(FALSE, PChar(SourceFileName),0,0,Bass_Stream_Decode or BASS_UNICODE); return chan = 0, what file you are try to open ? did you load all plugin ?

Erazer

  • Posts: 441
Re: BassVideo
« Reply #724 on: 9 Mar '09 - 09:32 »
So I have to change my D2009 to D 7 ;) ;D