Beta warning
Do not use if you aren't willing to take part into the beta testing!
What is the target audience for audio renderer?
MediaPortal Audio renderer is currently targeted for people who are after better video playback quality (strange isn't it? ). Currently HIFI people wont get any benefits from the audio renderer (lets see if that changes in the future).
...also this is only alpha quality on both stability and feature level so the current "release" is not intented to be used for anything else than for reporting the errors to make future targets (MP2 mainly) better.
Benefits of audio renderer
Audio renderer tries to combat few video playback related issues that almost all (all without Reclock) Windows based (other OSes most likely fall into this category as well) media players are affected:
Audio / Video clock drifting
One of the basic issues that almost every sine PC has is the fact that audio and video clocks are based on the different HW crystals / time sources. Normaly this can be only over come by either dropping or inserting silence into the audio stream which causes pops & clics in audio stream or by dropping or repeating video frames which result juddering / non-smooth video playback.
MediaPortal Audio renderer solves this (like Reclock as well) by adjusting the reference clock a bit and resampling the audio to match the result. This will slightly degenerate audio quality when ever the correction is done.
Refresh rate and fps mismatch
Like Reclock, MediaPortal Audio renderer is able to speed up / down the playback speed of the media to make the media fps to match the dispay refresh rate or it's whole number multiplier.
EVR presenter's vsync position
EVR presenter is able to "steer" the audio renderer in such way that the video frame rendering is done on optimal vsync position. This is able to correct the random EVR mixer vsync position that is "selected" on streaming start (playback start, skip or resume from pause).
Limitations of audio renderer
Currently there are following limitations for MediaPortal Audio renderer
Future possibitilies of audio renderer
Already done:
How to install
Debug settings for audio renderer
Following registry settings can be used to tweak / debug / troubleshoot the audio renderer's functionality. They are located in HKEY_CURRENT_USER\Software\Team MediaPortal\Audio Renderer
EnableTimestretching
Enables all the audio renderer's special features to work (should be only disabled to check if some issue is also reporducible with it disabled). Enabled by default.
ForceDirectSound
Forces DirectSound to be used in Vista / Windows 7 instead of the WASAPI. Disabled by default.
DevicePeriod
Device side buffer size, the samller the more often the audio renderer needs to write to the buffer. 500000 (50ms) by default.
0 = default from the audio driver
1 = minimum from the audio driver
others -> user specified (default 500000 -> 50 ms)
WASAPIExclusive
Uses WASAPI exclusive mode. Enabled by default.
WASAPIUseEventMode
Uses WASAPI event driven mode. Enabled by default (causes issues on some HW / drivers where no proper support is available.)
WASAPIPreferredDevice
Audio end point device (where the audio is played). Check AudioRenderer.log for possible devices. If left empty it will use OS default which should be ok for most of the time.
HWBasedRefClock
Toggles between the audio HW based reference clock and system time based reference clock. Audio HW based reference clock is the default value (1).
EnableSyncAdjustment
Toggles between v-sync adjustments on / off. By default this is on. Use only for debugging purposes (like sync drifting).
LogSampleTimes
For debugging only. When enabled, all audio incoming sample timestamps (and current stream time) is logged into the audiorenderer.log. Disabled by default.
EnableAC3Encoding
Enables AC3 (Dolby Digital on-the-fly encoding for SPDIF). Disabled by default.
AC3bitrate
Bitrate setting for the AC3 encoding. Default value is 448 kbps, valid values are 192, 224, 256, 320, 384, 448, 512, 576, 640.
MaxBias
Maximum allowed speed that the playback can reach, this value is divided with 10000 to get the real value. Default value is 11000 (1.1x) - 10% speed up at maximum.
MinBias
Minimum allowed speed for the playback, this value is divided with 10000 to get the real value. Default value is 9000 (0.9x) - 10% speed down at maximum.
AudioDelay
Delay audio for xxx ms, can be used to compensate delay introduced by display device (postprocessing in LCD for example). By default this is 0 ms. Amount is given in ms.
ChannelMaskOverride_5_1
Override the channel mask for 5.1 stream types. Use this to fix incompatibilities with the speak configuration between driver and the audio decoder. Disabled / zero by default. For ASUS Xonar use "1551".
ChannelMaskOverride_7_1
Override the channel mask for 7.1 stream types. Use this to fix incompatibilities with the speak configuration between driver and the audio decoder. Disabled / zero by default.
How to configure audio codecs
Since MediaPortal audio renderer is currently really picky about the input audio stream format that it accepts it is recommended to use ffdshow's audio decoder (which is a really good decoder in any case). Following setting should be used:
How to report a bug
Source codes
EVR presenter and audio renderer source codes can be found from
public - Revision 26095: /branches/Accurate_sync
People who made this possible
ar-jar (Arto Järvinen - vertical sync). The main idea for searching for the better video playback quality (mainly the A/V clock drift issue we are plagued) did come from Arto's work on the GothPlayer / MPC-HC side.
Arion_p - For helping the audio renderer itself (and volunteering to continue with the multi channel implementation )
Olwsroost - He was the one who did continue the EVR presenter scheduling and frame presentation improvements.
albain - ffdshow developer who has provided the MPC-HC project the basic audio renderer implementation that the MediaPortal Audio renderer is based on.
The attached picture has been taken on approx 105 minutes of time when a Blu-ray sourced M2TS file is being played on non-matching 50 Hz monitor.
Do not use if you aren't willing to take part into the beta testing!
What is the target audience for audio renderer?
MediaPortal Audio renderer is currently targeted for people who are after better video playback quality (strange isn't it? ). Currently HIFI people wont get any benefits from the audio renderer (lets see if that changes in the future).
...also this is only alpha quality on both stability and feature level so the current "release" is not intented to be used for anything else than for reporting the errors to make future targets (MP2 mainly) better.
Benefits of audio renderer
Audio renderer tries to combat few video playback related issues that almost all (all without Reclock) Windows based (other OSes most likely fall into this category as well) media players are affected:
Audio / Video clock drifting
One of the basic issues that almost every sine PC has is the fact that audio and video clocks are based on the different HW crystals / time sources. Normaly this can be only over come by either dropping or inserting silence into the audio stream which causes pops & clics in audio stream or by dropping or repeating video frames which result juddering / non-smooth video playback.
MediaPortal Audio renderer solves this (like Reclock as well) by adjusting the reference clock a bit and resampling the audio to match the result. This will slightly degenerate audio quality when ever the correction is done.
Refresh rate and fps mismatch
Like Reclock, MediaPortal Audio renderer is able to speed up / down the playback speed of the media to make the media fps to match the dispay refresh rate or it's whole number multiplier.
EVR presenter's vsync position
EVR presenter is able to "steer" the audio renderer in such way that the video frame rendering is done on optimal vsync position. This is able to correct the random EVR mixer vsync position that is "selected" on streaming start (playback start, skip or resume from pause).
Limitations of audio renderer
Currently there are following limitations for MediaPortal Audio renderer
- Bitstreaming (no point since resampling destroys the whole idea of bitstreaming) - includes all formats
- Windows 7 (Vista most likely as well) audio decoder is not supporting AC3 with 3rd party applications (Dolby lisencing restirction - Microsoft MPEG-1/DD/AAC Audio Decoder (Windows))
- Volume control is not working with WASAPI exclusive mode since it bypasses the OS audio mixer.
Future possibitilies of audio renderer
- Bitstreaming (this will cause lot of the main, video playback related features not to work - so this is not on high priority)
Already done:
- Not possible the playback speed adjust window / bias control
- Implement WASAPI event driven mode (polling mode wont be available after that)
- Support for multi channel audio
- Support for non-16 bit samples
- AC3 re-encoding so that SPDIF users can have use on the resampling functionality (without this only HDMI LPCM or analog would allow multi channel audio formats when multi channel support is implemented)
- Audio HW based reference clock
- Implement a "learning" bias that will reduce the amount of audio adjustments done for non 1:1, 1:2, 1:3... rates
How to install
- backup current dshowhelper.dll
- copy the attached dshowhelper.dll over the old one
- copy mpaudiorenderer.ax to some folder
- use "regsvr32 mpaudiorenderer" to register the audio renderer
- set "MediaPortal audio renderer" to be used in DVD / TV / My Videos as audio renderer
Debug settings for audio renderer
Following registry settings can be used to tweak / debug / troubleshoot the audio renderer's functionality. They are located in HKEY_CURRENT_USER\Software\Team MediaPortal\Audio Renderer
EnableTimestretching
Enables all the audio renderer's special features to work (should be only disabled to check if some issue is also reporducible with it disabled). Enabled by default.
ForceDirectSound
Forces DirectSound to be used in Vista / Windows 7 instead of the WASAPI. Disabled by default.
DevicePeriod
Device side buffer size, the samller the more often the audio renderer needs to write to the buffer. 500000 (50ms) by default.
0 = default from the audio driver
1 = minimum from the audio driver
others -> user specified (default 500000 -> 50 ms)
WASAPIExclusive
Uses WASAPI exclusive mode. Enabled by default.
WASAPIUseEventMode
Uses WASAPI event driven mode. Enabled by default (causes issues on some HW / drivers where no proper support is available.)
WASAPIPreferredDevice
Audio end point device (where the audio is played). Check AudioRenderer.log for possible devices. If left empty it will use OS default which should be ok for most of the time.
HWBasedRefClock
Toggles between the audio HW based reference clock and system time based reference clock. Audio HW based reference clock is the default value (1).
EnableSyncAdjustment
Toggles between v-sync adjustments on / off. By default this is on. Use only for debugging purposes (like sync drifting).
LogSampleTimes
For debugging only. When enabled, all audio incoming sample timestamps (and current stream time) is logged into the audiorenderer.log. Disabled by default.
EnableAC3Encoding
Enables AC3 (Dolby Digital on-the-fly encoding for SPDIF). Disabled by default.
AC3bitrate
Bitrate setting for the AC3 encoding. Default value is 448 kbps, valid values are 192, 224, 256, 320, 384, 448, 512, 576, 640.
MaxBias
Maximum allowed speed that the playback can reach, this value is divided with 10000 to get the real value. Default value is 11000 (1.1x) - 10% speed up at maximum.
MinBias
Minimum allowed speed for the playback, this value is divided with 10000 to get the real value. Default value is 9000 (0.9x) - 10% speed down at maximum.
AudioDelay
Delay audio for xxx ms, can be used to compensate delay introduced by display device (postprocessing in LCD for example). By default this is 0 ms. Amount is given in ms.
ChannelMaskOverride_5_1
Override the channel mask for 5.1 stream types. Use this to fix incompatibilities with the speak configuration between driver and the audio decoder. Disabled / zero by default. For ASUS Xonar use "1551".
ChannelMaskOverride_7_1
Override the channel mask for 7.1 stream types. Use this to fix incompatibilities with the speak configuration between driver and the audio decoder. Disabled / zero by default.
How to configure audio codecs
Since MediaPortal audio renderer is currently really picky about the input audio stream format that it accepts it is recommended to use ffdshow's audio decoder (which is a really good decoder in any case). Following setting should be used:
- All passthru settings must be disabled
- AC3 encode should be disabled
How to report a bug
- Try to provide as clean logs as possible (for example if live tv causes issues, just after the last channel change if possible)
- Provide information about the used sample media file (even better if you can provide a small piece of that file itself, but take care that you aren't violating copyright)
- Provide system information about the audio chip & drives. Same for GPU
- Provide AudioRenderer.log
- Provide Evr.log
- Provide MediaPortal.log
- Check with GraphEdit / GraphStudio that the audio renderer is really connected to the audio decoder in graph
Source codes
EVR presenter and audio renderer source codes can be found from
public - Revision 26095: /branches/Accurate_sync
People who made this possible
ar-jar (Arto Järvinen - vertical sync). The main idea for searching for the better video playback quality (mainly the A/V clock drift issue we are plagued) did come from Arto's work on the GothPlayer / MPC-HC side.
Arion_p - For helping the audio renderer itself (and volunteering to continue with the multi channel implementation )
Olwsroost - He was the one who did continue the EVR presenter scheduling and frame presentation improvements.
albain - ffdshow developer who has provided the MPC-HC project the basic audio renderer implementation that the MediaPortal Audio renderer is based on.
The attached picture has been taken on approx 105 minutes of time when a Blu-ray sourced M2TS file is being played on non-matching 50 Hz monitor.