Published by Roman on 24 Jul 2010

Adobe Flash Media Live Encoder 3.1

It is the first time ever – because probably I am not as experienced as Geraint – I witness availability of IMediaSample interface without availability of IMediaSample2. One might be curious what kind of software could provide such a weirdo in 2010? It is latest and greatest Adobe Flash Media Live Encoder 3.1.

Additionally to this, they decided to provide garbage in AM_MEDIA_TYPE::formattype field of IAMStreamConfig::SetFormat. They perhaps learned that standard Audio Capture Filter will ignore it anyway, so why bother then?

Having fixed that, Tone Source Filter based virtual audio device is now compatible with Adobe Flash Media Live Encoder 3.1 and it is possible to send audio to remote Flash Media Server, e.g. such as Ustream.tv service (over RTMP protocol, as implemented by FMLE).

24-Image002

Published by Roman on 18 Sep 2009

Audio Oscillogram DirectShow Filter

Unlike video, audio is difficult to troubleshoot in a way that once an issue has been noticed it was dynamic and already in past and it may be difficult to repeat, explain, forward as a screenshot etc. So it needs a visualization in order to check certain specific of the media stream.

Here we go with a Audio Oscillogram Filter, a filter which may be inserted into audio part of the graph, it insists on PCM audio (multichannel is OK, 8 or 16 bits per sample), so decoders might be required upstream and will be automatically inserted.

Once the filter is running, it shows a tool window with a visualization of the waveform coming through. Additionally, it shows a discontinuity sample (that is, a sample with AM_SAMPLE_DATADISCONTINUITY flag)  with a thick read vertical line, and a mismatch (gap or override) in neighboring sample start and stop times with a thin red line.

Alax.Info Audio Oscillogram Filter

Additionally to this, a window provides an option to pop up downstream audio renderer property sheet in order to check/debug rendering statistics, such as buffer fullness and break count (programmatically available via IAMAudioRendererStats interface). Unfortunately Microsoft does not provide a well done proxy/stub pair for this interface and the property page and there is no way to access this property page connecting to graph remotely. Using this filter the property sheet is shown directly from the hosting process and works correctly.

Audio Renderer Properties

A partial Visual C++ .NET 2008 source code is available from SVN, release binary included.

File and Class Summary

Utility.dll

Utility.dll (download) hosts the following classes:

  • DirectShow Filters
    • Audio Oscillogram Filter, to visualize/debug audio data

Class Overview

Audio Oscillogram Filter

The filter visualizes PCM audio data going through in a form of oscillogram.

Remarks

The filter will create a tool window with audio visualization when put into paused/running state. The filter graph should be controlled (IMediaControl) from a GUI aware apartment so that window messages could reach internal filter’s window.

Published by Roman on 28 Aug 2009

Windows Media Codec List

Windows Media Codec List utility uses IWMCodecInfo interface (see also IWMCodecInfo2, IWMCodecInfo3) lists installed Windows Media Codecs and their formats and presents the findings in a convenient way. The utility gives a quick idea what a programmer would obtain through IWMCodecInfo2/IWMCodecInfo3 interfaces and what well known format structures (WM_MEDIA_TYPE, AM_MEDIA_TYPE, WAVEFORMATEX, VIDEOINFOHEADER) correspond to particular format.

For a description of Windows Media video and audio codecs, check article Encoding Audio and Video with Windows Media Codecs.

Windows Media Codec List Screenshot

Copy button copies discovered information into clipboard in comma-separated values (CSV) format (e.g. suitable fo rMicrosoft Excel). Submit button posts the same information to this website for… possibly further aggregation.

Some quick facts immediately visualized by the utility:

  • for a video codec there is exactly one generic codec format listed
  • video codec FOUCCs are: WM Video – WMV1, WMV2, WMV3; WM Video Screen – MSS1, MSS2; WM Video Image – WMVP, WVP2; WM Video Advanced Profile – WVC1
  • for audio codecs there are complete codec formats enumerated, with names/descriptions suitable for GUI
  • audio codecs enumerate different formats in response to enumeration settings (e.g. request for VBR formats)
  • WM Audio Lossless only lists formats for single pass VBR mode
  • audio format tags (wFormatTag) are: WM Audio including Professional and Lossless – 0×0161, 0×0162, 0×0163; WM Audio Voice – 0×000A; ACELP.net – 0×0130

Partial Visual C++ .NET 2008 source code is available from SVN, release binary included.

Continue Reading »

Published by Roman on 21 Feb 2009

Confusing AUDIO_STREAM_CONFIG_CAPS

I don’t have any idea who makes software nowadays, but how can it expected to be reliable?

Intel DG33FBC motherboard, onboard Realtek ALC888 High Definition Audio. I am tracing AUDIO_STREAM_CONFIG_CAPS capabilities reported by onboard audio capture board, one of them:

AM_MEDIA_TYPE:

majortype {73647561-0000-0010-8000-00AA00389B71}, subtype {00000001-0000-0010-8000-00AA00389B71}, pUnk 0x00000000
bFixedSizeSamples 1, bTemporalCompression 0, lSampleSize 4
formattype {05589F81-C356-11CE-BF01-00AA0055595A}, cbFormat 18, pbFormat 0x002911a8
pbFormat as WAVEFORMATEX:
  wFormatTag 1
  nChannels 2
  nSamplesPerSec 8000
  nAvgBytesPerSec 32000
  nBlockAlign 4
  wBitsPerSample 16
  cbSize 0

AUDIO_STREAM_CONFIG_CAPS:

guid {73647561-0000-0010-8000-00AA00389B71}
MinimumChannels 1, MaximumChannels 2, ChannelsGranularity 1
MinimumBitsPerSample 8, MaximumBitsPerSample 16, BitsPerSampleGranularity 8
MinimumSampleFrequency 11025, MaximumSampleFrequency 44100, SampleFrequencyGranularity 11025

Media type sampling frequency is 8 KHz (correct) but associated capabilities structure still report different sampling rates and granularity (crap), it is in fact 11025..44100 Hz for all capabilities, including those with sampling frequencies from a different row.

Published by Roman on 02 Dec 2008

Multichannel audio recording

There has been recently an interesting post “Problem playing back multi-channel wave file under vista” on DirectShow Development forum about certain hardware that is capable of recording 64 channels of audio in 24-bit per sample PCM quality, with a sample recorded .WAV file posted.

I was curious what kind of hardware implements such recording. Google suggests it could be PCM H64 multichannel system from Sadie, UK.

This is definitely an interesting piece of hardware which can fill normally video’s bandwidth with audio only data. BTW, some useful related C++/DirectShow code is here on new Assembla’s web itnerface into subversion repository.

Published by Roman on 11 Nov 2008

DirectSound play buffer notification (IDirectSoundNotify8)

IDirectSoundNotify8 is an interface to get notified on playback on capture audio buffer reaching certain position in the buffer. It is a must thing when implementing ring buffers with new data continuously added to the buffer for seamless playback (continuously copied from in case of capture).

This project is a minimalistic C++ sample code to illustrate the API. To initialize the DirectSound subsystem it is required to provide a window handle, which is created using ATL’s CWindowImpl (CMessageOnlyWindowImpl).

...
ATLENSURE_SUCCEEDED(DirectSoundCreate8(NULL, &pDirectSound8, NULL));
...
ATLENSURE_SUCCEEDED(pDirectSound8->SetCooperativeLevel(Window, DSSCL_PRIORITY));
...
ATLENSURE_SUCCEEDED(pDirectSound8->CreateSoundBuffer(&BufferDescriptor, &pDirectSoundBuffer, NULL));
...
CComQIPtr<IDirectSoundNotify8, &IID_IDirectSoundNotify8> pDirectSoundNotify8 = pDirectSoundBuffer;
...
ATLENSURE_SUCCEEDED(pDirectSoundNotify8->SetNotificationPositions(g_nPositionCount, pPositionNotify));
ATLENSURE_SUCCEEDED(pDirectSoundBuffer->Play(0, 0, DSBPLAY_LOOPING));

Continue Reading »

Published by Roman on 27 Jun 2008

FFDShow is getting more annoying

Surprisingly fast I got new problems having ffdshow installed as a part of K-Lite Codec Pack. No wonder though because let us take a look at registration information:

Display Name: @device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\{0F40E1E5-4F79-4988-B1A9-CC98794E6B55}
CLSID: {0F40E1E5-4F79-4988-B1A9-CC98794E6B55}
Friendly Name: ffdshow Audio Decoder
Path: C:\Program Files\K-Lite Codec Pack\ffdshow\ffdshow.ax
Merit: 0×3fffffff

Nice merit, ain’t it? What is merit anyway? Let us check at MSDN:

MERIT_PREFERRED = 0×800000,
MERIT_NORMAL = 0×600000,

MERIT_HW_COMPRESSOR = 0×100050

The highest defined value is 0×00800000, while ffdshow is registered with 0×3FFFFFFF, that is on top of everything. No doubt the developers read Guidelines for Registering Filters and decided to get rid of the rest of installed software as unnecessary crap.

Anyway back to the problem: I had an A-law wave file (WAVE_FORMAT_ALAW) to play and make sure its data is valid and quite unexpectedly there was a silence while playing. A quick check confirmed that the sustem has CCITT A-law codec installed, however GraphEdit shown ffdshow Audio Decoder intercepting decoding. Obviously it spoiled the thing!

Finally I decided it was a right time to take an advantage of IAMGraphBuilderCallback interface to detect and reject the bastard.

Continue Reading »