Author Topic: BassVideo  (Read 340604 times)

sorrento

  • Posts: 8
Re: BassVideo
« Reply #750 on: 5 Apr '09 - 21:33 »
I have a problem with some XVid AVIs with mp3 audio, where I have no control over the volume (either sample programs or my own code).  The pitch and tempo controls work fine, but the volume control does nothing.  I have the latest BASS Video and latest BASS.

Any ideas?

TSX

  • Posts: 5
Re: BassVideo
« Reply #751 on: 6 Apr '09 - 07:47 »
Hi! I found a solution to switch streams with IAMStreamSwitch interface.
Here is an example with Haali Splitter (for MKV's etc.) in Delphi.

Find Haali Splitter in graph:
Code: [Select]
Const
  CLSID_HaaliSplitter: TGUID  = '{55DA30FC-F16B-49FC-BAA5-AE59FC65F82D}';

Function FindFilterByCLSID(FiltCLSID : TGUID; var dsGraph : IGraphBuilder) : IBaseFilter;
var
  dsFilterEnum   : IEnumFilters;
  EnumCLSID      : TGUID;
begin
  If Assigned(dsGraph) then If dsGraph.EnumFilters(dsFilterEnum) = S_OK then
  Begin
    While dsFilterEnum.Next(1,Result,nil) = S_OK do
    Begin
      Result.GetClassID(EnumCLSID);
      If IsEqualGUID(FiltCLSID,EnumCLSID) then Break else Result := nil;
    End;
    dsFilterEnum := nil;
  End;
end;

function getHaaliSplitterStreamSelect(dsGraph: IGraphBuilder): IAMStreamSelect;
var HaaliSplitter: IBaseFilter;
    ss: IAMStreamSelect;
begin
  Result := nil;

  HaaliSplitter := FindFilterByCLSID(CLSID_HaaliSplitter, dsGraph);
  dsGraph := nil;
  if Assigned(HaaliSplitter) then
    if (HaaliSplitter.QueryInterface(IID_IAMStreamSelect, SS) = S_OK) then Result := SS;
  HaaliSplitter := nil;
end;

Example of navigation menu creation:
Code: [Select]
procedure CreateNaviPopup(FStreamSelect: IAMStreamSelect; Popup: TMenuItem);
var
  i: Integer;
  count: Cardinal;
  pmt: PAMMediaType;
  flags, lcid, group: Cardinal;
  lflag: Cardinal;
  name: PWideChar;
  obj1, obj2: IUnknown;
  item: TMenuItem;
  gr: byte;
begin
  Popup.Clear;
  lflag := $FFFFFFFF;
  gr := 0;

  if Assigned(FStreamSelect) then
  begin
    if FStreamSelect.Count(count) = S_OK then
    begin
      for i := 0 to Int64(count) -1 do
      begin
        if FStreamSelect.Info(i, pmt, flags, lcid, group, name, obj1, obj2) = S_OK then
        begin
          if lflag <> $FFFFFFFF then
          begin
            if group <> lflag then
            begin
              lflag := group;
              item := TMenuItem.Create(Popup);
              item.Caption := '-';
              Popup.Add(item);
              Inc(gr);
            end;
          end else
          begin
            lflag := group;
          end;

          item := TMenuItem.Create(Popup);
          item.Caption := name;
          item.Tag := i;
          item.GroupIndex := gr;
          item.RadioItem := true;
          item.OnClick := FormPlayWin._on_stream_click;
          item.Checked := flags and AMSTREAMSELECTINFO_ENABLED > 0;
          Popup.Add(item);
          CoTaskMemFree(name);
        end;
      end;
    end;
  end;
end;

Menu item OnClick event:
Code: [Select]
  if Assigned(FStreamSelect) then
    if FStreamSelect.Enable((Sender as TMenuItem).Tag, AMSTREAMSELECTENABLE_ENABLE) = S_OK then (Sender as TMenuItem).Checked := true;

So after FilterGraph was created, execute following code (dsGraph is IGraphBuilder):
Code: [Select]
      FStreamSelect := getHaaliSplitterStreamSelect(dsGraph);

      if Assigned(FStreamSelect) then CreateNaviPopup(FStreamSelect, Navigation1);
P.S. FStreamSelect must be defined variable in your form.

kenshin1101, may be part of this code will be implemented in BassVideo?

P.P.S. When I try to call BassVideo_GetGraph I'm getting access violation in BassVideo.dll
« Last Edit: 6 Apr '09 - 12:17 by TSX »

GambitKZ

  • Posts: 9
Re: BassVideo
« Reply #752 on: 6 Apr '09 - 13:09 »
How Extract audio from Video(using BassVideo of course) in C#.
BassVideo's help have "BassVideo_EncoderAudio" but we haven't it in Bass.Net, so
if combine it with TSX's code(about change audio stream), it will be grate(please somebody write C# analog code)

TSX

  • Posts: 5
Re: BassVideo
« Reply #753 on: 6 Apr '09 - 13:36 »
I've made unit for stream management with several useful functions.
It's in Delphi, because I'm not familiar with C++ or C#

Implemented functions and types:
Code: [Select]
type
  TEnumStreamType = (estVideo, estAudio, estText, estOther);
  TStreamEnumCallback = procedure(sname: string; sFlags: DWORD; sId, sGr: integer);
  TStreamEnumCallback2 = procedure(sname: string; sFlags: DWORD; sId: integer; StreamType: TEnumStreamType);
  TEnumFiltersCallback = procedure(FilterName: string);

// Enum graph's filters and pass to callback function
procedure EnumFilters(const FG: IFilterGraph; callback: TEnumFiltersCallback);
// Enum streams and pass to callback function (last value is group)
procedure EnumStreams(FStreamSelect: IAMStreamSelect; callback: TStreamEnumCallback);
// Enum streams and pass to callback function (last value is stream type)
procedure EnumStreams2(FStreamSelect: IAMStreamSelect; callback: TStreamEnumCallback2);
// Try to find IAMStreamSelect interface in all graph filters
function FindAudioSelect(const FG: IFilterGraph): IAMStreamSelect;
// Find filter by it's CLSID
Function FindFilterByCLSID(FiltCLSID : TGUID; var dsGraph : IGraphBuilder) : IBaseFilter;
// Try to find Haali Splitter and it's IAMStreamSelect interface
function GetHaaliStreamSelect(dsGraph: IGraphBuilder): IAMStreamSelect;

If anyone wish, I can post it here.
« Last Edit: 6 Apr '09 - 13:42 by TSX »

kenshin1101

  • Posts: 545
Re: BassVideo
« Reply #754 on: 10 Apr '09 - 03:36 »
kenshin1101, may be part of this code will be implemented in BassVideo?

P.P.S. When I try to call BassVideo_GetGraph I'm getting access violation in BassVideo.dll

okie, i'll try to do something new in next week

subh

  • Posts: 177
Re: BassVideo
« Reply #755 on: 10 Apr '09 - 14:22 »
 :( my name subh I need a full control for bassvideo.dll video player
with color adjust and audio equalizer and visualization.. please download the vb code and inform me.

wandogau

  • Posts: 2
Re: BassVideo
« Reply #756 on: 14 Apr '09 - 15:21 »
Hello,
At first let me say, that BASSVideo is absolutely great. Thanks for doing so many stuff on that!!!

I've got a question: I want to play the audio of a DVD, nto the DVD itself, but only the audio. For an explanation: I'm blind myself, and only intersted in the audio.
But, I missing something. ;-)
I've got the following peace of code:
chan := BASSVideo_DVD_StreamCreate ('g:\video_ts\video_ts.ifo', 0, 0, nil, 0);
chan := BASSVideo_EncoderAudio (chan, false, nil, nil);
Okay, so far, so good. And now? How can I play the data? Do I have to program a callback procedure, as in the help's example, and, if so, how can I play the data given by BASSVideo_ChannelGetData?

I need your help!
Best regards
Marco


GambitKZ

  • Posts: 9
Re: BassVideo
« Reply #757 on: 21 Apr '09 - 19:53 »
Olo-lo
Did we miss something?
In that case, what method use to Extract Audio from Video?

fmcoder

  • Posts: 436
Re: BassVideo
« Reply #758 on: 30 Apr '09 - 21:07 »
Any progress on BassVideo project?

quickmic

  • Posts: 255
Re: BassVideo
« Reply #759 on: 2 May '09 - 15:11 »
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  :-\

I will pickup this problem again, cause it's now actual again for me.
I don't think about the double-Layer-DVD-disks  :-\
So is it maybe possible to change the VB6-APIs to another kind of varibale than "long"? i.e. "currency" or "Double"-Var  can understand more than 32bit.
Only two APIs have to be modified.
1.
BASS_Mixer_ChannelSetPosition64 or all kind of that API
and 2.
BASS_ChannelGetLength

« Last Edit: 6 May '09 - 19:16 by quickmic »

GygaMan

  • Posts: 9
Re: BassVideo DVD Sample Request.
« Reply #760 on: 4 May '09 - 04:01 »
Hi'

I just like to ask if any one has a little sample on how to load a DVD and play the DVD and would share the code. I don't have any problems on playing MP3, and any other video formats but I just don't get DVD to load or do any think at all :'(. The sample can be in VB6, C# or VB.Net.

Any help is appreciated

Thanks

Gyga

quickmic

  • Posts: 255
Re: BassVideo
« Reply #761 on: 6 May '09 - 19:14 »
I could give you the DVD-code, but bassvideo have big problems with audio/video-sync. So it does not make sense for now (I tested only with the "plugin-mode").
If you want it anyway, tell me.

quickmic

  • Posts: 255
Re: BassVideo
« Reply #762 on: 6 May '09 - 19:19 »
Any progress on BassVideo project?

I also hope so, but kenshin1101's "last active" was on 16th April. So I think he his very busy at the moment.

GygaMan

  • Posts: 9
Re: BassVideo
« Reply #763 on: 6 May '09 - 22:18 »
Hi quickmic,

Anything that would just give me a view on how to use it would be OK. Hopefully ones all the problems are solve then it would be easy to correct the code.

So yes if you can give any code I appreciated.

Thanks


Gyga

quickmic

  • Posts: 255
Re: BassVideo
« Reply #764 on: 7 May '09 - 08:01 »
Ok, here is the easiest way to play a DVD:

Dim Path As String
   
Call BASS_Init(-1, 48000, 0, Form1.hWnd, 0) 'Init Bass
Call BASS_SetConfig(BASS_CONFIG_BUFFER, 1000)
PluginHandle = BASS_PluginLoad("bassvideo.dll", 0)
Path = "d:\DVD\Shining\"
StreamHandle = BASS_StreamCreateFile64(0, Path & "video_ts\VIDEO_TS.IFO", 0, 0, 0, 0, BASS_STREAM_PRESCAN)
Call BASS_ChannelPlay(StreamHandle, 0)


In case the DVD has a menu, you see it after that routine. Than you can readout the chapters, languages... with BassVideo_DVD_GetAudioLanguage and so on.
If the DVD has no menu, the movie starts directly.
DVD-Codec is nessesary!
And I use this bass-video-version...
http://www.un4seen.com/filez/6/bassvideo.dll
... but should also work with the "latest stuff"

GygaMan

  • Posts: 9
Re: BassVideo
« Reply #765 on: 7 May '09 - 09:37 »
Thanks m8.

Now I can star playing with it and see what can be done.

I really appreciated.

Thanks

Gyga

kenshin1101

  • Posts: 545
Re: BassVideo
« Reply #766 on: 7 May '09 - 09:44 »
Hello everyone,
Sorry.

BassVideo project will continue no matter what :)
Just because i was too tired when back home :(

There something i want to tell is make BassVideo work as "Bass" plugin is work not good & i'm think of make something different: Bass will no more provide the output but still process audio data before it send to the output, i'll lock in to the BassFX to provide all dsp left like tempo,pitch and Beat detect. That will make the BassVideo work correctly.
and last thing is i will rewrite write in C++



RevG

  • Posts: 454
Re: BassVideo
« Reply #767 on: 7 May '09 - 14:47 »
Hello everyone,
Sorry.

BassVideo project will continue no matter what :)
Just because i was too tired when back home :(

There something i want to tell is make BassVideo work as "Bass" plugin is work not good & i'm think of make something different: Bass will no more provide the output but still process audio data before it send to the output, i'll lock in to the BassFX to provide all dsp left like tempo,pitch and Beat detect. That will make the BassVideo work correctly.
and last thing is i will rewrite write in C++


If you need any help with the C++ side of things just PM me. I will be happy to send you what I have created for my DirectShow Video/BASS filter so far. It's not complete, but it's a start and might help you out.

kenshin1101

  • Posts: 545
Re: BassVideo
« Reply #768 on: 8 May '09 - 03:58 »
Thanks RevG :)

Latch

  • Posts: 90
Re: BassVideo
« Reply #769 on: 11 May '09 - 15:39 »
Kenshin,

From now on, when you make a new release, can you take an extra minute and make a second compile for 64 bit as well?

Thanks


kenshin1101

  • Posts: 545
Re: BassVideo
« Reply #770 on: 11 May '09 - 15:46 »
Kenshin,

From now on, when you make a new release, can you take an extra minute and make a second compile for 64 bit as well?

Thanks


oki  ;)
the main reason i rewrite to C++ is x64 & delphi directshow header is not complete

GambitKZ

  • Posts: 9
Re: BassVideo
« Reply #771 on: 16 May '09 - 19:02 »
I wrote it early, but nobody have answered, and I'm asking again:
I ask about analog "BassVideo_EncoderAudio" in Bass.Net, and radio42 wrote
The function "BassVideo_EncoderAudio" has actually been removed from the latest BassVideo version - that's why it has also been removed from the BASS.NET API....
And what method to use now for Extract Audio?

kenshin1101

  • Posts: 545
Re: BassVideo
« Reply #772 on: 16 May '09 - 20:57 »
I wrote it early, but nobody have answered, and I'm asking again:
I ask about analog "BassVideo_EncoderAudio" in Bass.Net, and radio42 wrote
The function "BassVideo_EncoderAudio" has actually been removed from the latest BassVideo version - that's why it has also been removed from the BASS.NET API....
And what method to use now for Extract Audio?


current version is support to work as bass plugin , you can do like bass write wav example

Ionut Cristea

  • Posts: 1545
Re: BassVideo
« Reply #773 on: 17 May '09 - 19:55 »
HI,Kenshin; You say that you'll translate the bass_video in C++, so now can you post some source code of the library maybe someone will be interesting for developing some new application with  your source?
 Cheers, Sharky.

kenshin1101

  • Posts: 545
Re: BassVideo
« Reply #774 on: 18 May '09 - 15:51 »
HI,Kenshin; You say that you'll translate the bass_video in C++, so now can you post some source code of the library maybe someone will be interesting for developing some new application with  your source?
 Cheers, Sharky.

hello, the source is cannot public because C++ code base on Delphi code too much :)
but i will thinking of give user had buy the bassvideo code, just think ;D