Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > New and alternative a/v containers

Reply
 
Thread Tools Search this Thread Display Modes
Old 14th April 2022, 12:34   #24781  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,998
Bug in LAV filters playing WAV's multichannel. More Info.

In LAVFilters-0.76.1\demuxer\Demuxers\LAVFStreamInfo.cpp there are:
Code:
        else if ((mtype.subtype == MEDIASUBTYPE_PCM || mtype.subtype == MEDIASUBTYPE_IEEE_FLOAT) &&
                 avstream->codecpar->codec_tag != WAVE_FORMAT_EXTENSIBLE)
        {
            // Create raw PCM media type
            mtype.pbFormat = (BYTE *)g_AudioHelper.CreateWFMTEX_RAW_PCM(avstream, &mtype.cbFormat, mtype.subtype,
                                                                        &mtype.lSampleSize);
        }
I suggest:
Code:
        else if ((mtype.subtype == MEDIASUBTYPE_PCM || mtype.subtype == MEDIASUBTYPE_IEEE_FLOAT))
        {
            // Create raw PCM media type
            mtype.pbFormat = (BYTE *)g_AudioHelper.CreateWFMTEX_RAW_PCM(avstream, &mtype.cbFormat, mtype.subtype,
                                                                        &mtype.lSampleSize);
        }
For what exclude PCM INT/FLOAT WAVE_FORMAT_EXTENSIBLE header by managed by CreateWFMTEX_RAW_PCM?
Only in this subrutine (LAVFilters-0.76.1\demuxer\Demuxers\LAVAudioHelper.cpp) is read the dwChannelMask:
Code:
       dwChannelMask = (DWORD)avstream->codecpar->channel_layout;
Without dwChannelMask defined the default is assigned in LAVFilters-0.76.1\decoder\LAVAudio\Media.cpp:

Code:
static const scmap_t m_scmap_default[] = {
  //    FL  FR  FC  LFe BL  BR  FLC FRC
  {1, 0},               // Mono                 M1, 0
  {2, 0},               // Stereo               FL, FR
  {3, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER},                                                                                                // 3/0      FL, FR, FC
  {4, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY},                                                                          // 3/1      FL, FR, FC, Surround
  {5, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT},                                                           // 3/2      FL, FR, FC, BL, BR
  {6, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT},                                     // 3/2+LFe  FL, FR, FC, BL, BR, LFe
  {7, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_BACK_CENTER},                 // 3/4      FL, FR, FC, BL, Bls, Brs, BR
  {8, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT},// 3/4+LFe  FL, FR, FC, BL, Bls, Brs, BR, LFe
};
Where I suggest replace the defaults:
Code:
  {4, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT},                                                                                // 2/2      FL, FR, SL, SR
  {5, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT},                                                           // 3/2      FL, FR, FC, SL, SR
  {6, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT},                                     // 3/2+LFe  FL, FR, FC, LFE, SL, SR
  {7, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT|SPEAKER_BACK_CENTER},                 // 3/3+LFe  FL, FR, FC, LFE, BC, SL, SR
  {8, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT},// 3/4+LFe  FL, FR, FC, LFE, BL, BR, SL, SR
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 14th April 2022, 14:39   #24782  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,361
Quote:
Originally Posted by tebasuna51 View Post
For what exclude PCM INT/FLOAT WAVE_FORMAT_EXTENSIBLE header by managed by CreateWFMTEX_RAW_PCM?
WAVE_FORMAT_EXTENSIBLE is handled just below, extracting information from the WAVEFORMATEXTENSIBLE header and re-using it as-is, instead of trying to re-create it.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders
nevcairiel is offline   Reply With Quote
Old 14th April 2022, 16:08   #24783  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,998
Quote:
Originally Posted by nevcairiel View Post
WAVE_FORMAT_EXTENSIBLE is handled just below, extracting information from the WAVEFORMATEXTENSIBLE header and re-using it as-is, instead of trying to re-create it.
Code:
        else
        {
            WAVEFORMATEX *wvfmt = g_AudioHelper.CreateWVFMTEX(avstream, &mtype.cbFormat);
AudioHelper.CreateWVFMTEX never assign dwChannelMask

Like you can see that don't work at all.
__________________
BeHappy, AviSynth audio transcoder.

Last edited by tebasuna51; 14th April 2022 at 16:19.
tebasuna51 is offline   Reply With Quote
Old 14th April 2022, 17:53   #24784  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,361
Quote:
Originally Posted by tebasuna51 View Post
Code:
        else
        {
            WAVEFORMATEX *wvfmt = g_AudioHelper.CreateWVFMTEX(avstream, &mtype.cbFormat);
AudioHelper.CreateWVFMTEX never assign dwChannelMask
CreateWVFMTEX doesn't even touch WAVEFORMATEXTENSIBLE at all (it only works on the much smaller WAVEFORMATEX), hence its logically incapable of ever touching that field - instead it copies the WAVEFORMATEXTENSIBLE extension from the container, and "assigns" it that way - as a result, it will have assigned that field.

But I don't think your file even runs through that code.

Quote:
Originally Posted by tebasuna51 View Post
Like you can see that don't work at all.
Thats not the reason it doesn't work. In fact, you should check the generated media type by LAV Splitter, it clearly includes the dwChannelMask correctly already - its just not being used because you are using raw PCM with a decoder filter, which it wasn't designed for, instead of connecting it straight to the audio renderer, as I already pointed out in the other thread.

In any case I'm not going to explain my code any further. If you want to suggest changes, you should verify they actually fix your issue (by compiling and testing). Or just show some patience until I work on the next version and maybe consider your issue. Just because I haven't instantly fixed it doesn't mean I don't know whats going on. Its just a matter of time management.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders

Last edited by nevcairiel; 14th April 2022 at 18:10.
nevcairiel is offline   Reply With Quote
Old 14th April 2022, 18:27   #24785  |  Link
clsid
*****
 
Join Date: Feb 2005
Posts: 5,664
Here is patch to ignore standard PCM:
https://github.com/clsid2/LAVFilters...ca6eeefd09aba3
__________________
MPC-HC 2.3.1
clsid is offline   Reply With Quote
Old 15th April 2022, 12:09   #24786  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,998
Quote:
Originally Posted by clsid View Post
Here is patch to ignore standard PCM:
https://github.com/clsid2/LAVFilters...ca6eeefd09aba3
Thanks clsid, but cancel the use of internal LAV Filter make than mpc-hc (MPC-HC.1.9.20.56.x64) use the external DirectShow filter installed.

To work with this I need uninstall the external LAV Filters and install your old ffdshow filters, and I can't recommend that at all. I make this only for test (and work) but it is not a solution. Please revert to previous state, we need solve the problem in LAV Filters (external and internal)
Quote:
Originally Posted by nevcairiel View Post
...Or just show some patience until I work on the next version and maybe consider your issue. Just because I haven't instantly fixed it doesn't mean I don't know whats going on. Its just a matter of time management.
Of course, take your time. I only want to help found the solution.
Maybe I was wrong and for this I say "suggest".
Excuse me if I add some comments:

Quote:
In fact, you should check the generated media type by LAV Splitter, it clearly includes the dwChannelMask correctly already - its just not being used because you are using raw PCM with a decoder filter, which it wasn't designed for, instead of connecting it straight to the audio renderer,...
Of course, and work fine connecting the Splitter to Render but GraphStudio and mpc-he (or mpc-be) insist in include the Audio Decoder between the Splitter and Render and I don't know for what the dwChannelMask read correctly by the splitter (in mpc-hc or GraphEdit):
Quote:
Audio: PCM 48000Hz 4ch 3072kbps

AM_MEDIA_TYPE:
majortype: MEDIATYPE_Audio {73647561-0000-0010-8000-00AA00389B71}
subtype: MEDIASUBTYPE_PCM {00000001-0000-0010-8000-00AA00389B71}
formattype: FORMAT_WaveFormatEx {05589F81-C356-11CE-BF01-00AA0055595A}
bFixedSizeSamples: 1
bTemporalCompression: 0
lSampleSize: 8
cbFormat: 40

WAVEFORMATEX:
wFormatTag: 0xfffe
nChannels: 4
nSamplesPerSec: 48000
nAvgBytesPerSec: 384000
nBlockAlign: 8
wBitsPerSample: 16
cbSize: 22 (extra bytes)

WAVEFORMATEXTENSIBLE:
wValidBitsPerSample: 16
dwChannelMask: 0x00000603 OK
SubFormat: {00000001-0000-0010-8000-00AA00389B71} MEDIASUBTYPE_PCM

pbFormat:
0000: fe ff 04 00 80 bb 00 00 00 dc 05 00 08 00 10 00 ..?.........
0010: 16 00 10 00 03 06 00 00 01 00 00 00 00 00 10 00 ................
0020: 80 00 00 aa 00 38 9b 71 ?...8?q
is not traslated be the decoder to the output pin:
Quote:
Filter : LAV Audio Decoder - CLSID : {E8E73B6B-4CB3-44A4-BE99-4F7BCB96E491}
Pin [OUT]
- Connected to:

CLSID: {18C16B08-6497-420E-AD14-22D21C2CEAB7}
Filter: Audio Switcher
Pin: 4i220.wav

- Connection media type:

Audio: PCM 48000Hz 4ch 3072kbps

AM_MEDIA_TYPE:
majortype: MEDIATYPE_Audio {73647561-0000-0010-8000-00AA00389B71}
subtype: MEDIASUBTYPE_PCM {00000001-0000-0010-8000-00AA00389B71}
formattype: FORMAT_WaveFormatEx {05589F81-C356-11CE-BF01-00AA0055595A}
bFixedSizeSamples: 1
bTemporalCompression: 0
lSampleSize: 8
cbFormat: 40

WAVEFORMATEX:
wFormatTag: 0xfffe
nChannels: 4
nSamplesPerSec: 48000
nAvgBytesPerSec: 384000
nBlockAlign: 8
wBitsPerSample: 16
cbSize: 22 (extra bytes)

WAVEFORMATEXTENSIBLE:
wValidBitsPerSample: 16
dwChannelMask: 0x0000000f WRONG
SubFormat: {00000001-0000-0010-8000-00AA00389B71}

pbFormat:
0000: fe ff 04 00 80 bb 00 00 00 dc 05 00 08 00 10 00 ..?.........
0010: 16 00 10 00 0f 00 00 00 01 00 00 00 00 00 10 00 ................
For what the Audio Decoder show like input:
Quote:
Filter : LAV Audio Decoder - CLSID : {E8E73B6B-4CB3-44A4-BE99-4F7BCB96E491} cbSize: 0 (extra bytes)
Pin [IN]
- Connected to: pbFormat:
0000: 00 00 01 00 01 00 04 00 80 bb 00 00 00 dc 05 00 ........?.....
CLSID: {B98D13E7-55DB-4385-A33D-09FD1BA26338} 0010: 08 00 10 00 00 00 00 00 ........
Filter: LAV Splitter Source (internal)
Pin: Audio

- Connection media type:

Audio

AM_MEDIA_TYPE:
majortype: MEDIATYPE_Audio {73647561-0000-0010-8000-00AA00389B71}
subtype: Unknown GUID Name {AFBC2343-3DCB-4047-9655-E1E62A61B1C5}
formattype: Unknown GUID Name {35189950-CAC9-4C8D-819D-B6FAEE15DD9D}
bFixedSizeSamples: 1
bTemporalCompression: 0
lSampleSize: 256000
cbFormat: 24

WAVEFORMATEXFFMPEG:
nCodecId: 0x10000

WAVEFORMATEX:
wFormatTag: 0x0001
nChannels: 4
nSamplesPerSec: 48000
nAvgBytesPerSec: 384000
nBlockAlign: 8
wBitsPerSample: 16
cbSize: 0 (extra bytes)

pbFormat:
0000: 00 00 01 00 01 00 04 00 80 bb 00 00 00 dc 05 00 ........?.....
0010: 08 00 10 00 00 00 00 00 ........
losing the dwChannelMask info.

Just for fun, seems than the LAV Splitter assign other default for 4 channels when the input file is a wav with simple header (without ChannelMask info):
Quote:
Audio: PCM 48000Hz 4ch 3072kbps SIMPLE HEADER WITHOUT ChannelMask

AM_MEDIA_TYPE:
majortype: MEDIATYPE_Audio {73647561-0000-0010-8000-00AA00389B71}
subtype: MEDIASUBTYPE_PCM {00000001-0000-0010-8000-00AA00389B71}
formattype: FORMAT_WaveFormatEx {05589F81-C356-11CE-BF01-00AA0055595A}
bFixedSizeSamples: 1
bTemporalCompression: 0
lSampleSize: 8
cbFormat: 40

WAVEFORMATEX:
wFormatTag: 0xfffe
nChannels: 4
nSamplesPerSec: 48000
nAvgBytesPerSec: 384000
nBlockAlign: 8
wBitsPerSample: 16
cbSize: 22 (extra bytes)

WAVEFORMATEXTENSIBLE:
wValidBitsPerSample: 16
dwChannelMask: 0x00000107 OTHER DEFAULT (FL FR FC BC)
SubFormat: {00000001-0000-0010-8000-00AA00389B71}
__________________
BeHappy, AviSynth audio transcoder.

Last edited by tebasuna51; 15th April 2022 at 12:12.
tebasuna51 is offline   Reply With Quote
Old 15th April 2022, 13:21   #24787  |  Link
clsid
*****
 
Join Date: Feb 2005
Posts: 5,664
As a temporary solution you can simply disable PCM on formats tab in LAV Audio Settings to prevent it from being used. You could also register the LAV build from MPC-HC to use as external copy for use with other apps.
__________________
MPC-HC 2.3.1
clsid is offline   Reply With Quote
Old 17th April 2022, 15:04   #24788  |  Link
max79
Registered User
 
Join Date: Mar 2017
Posts: 83
Hello,

@nevcairiel:
When switching audio tracks using the "IAMStreamSelect" interface on a live stream, it sometimes triggers an EC_COMPLETE event, which ruins playback.
I have setting-"Remove Audio Decoder on Audio Stream Switch" enabled in "LAV Splitter".

Any feedback would be appreciated.
max79 is offline   Reply With Quote
Old 23rd April 2022, 05:51   #24789  |  Link
Sunspark
Registered User
 
Join Date: Nov 2015
Posts: 503
I have an observation of different behaviour between two video renderers using the same LAV decoding method and wish to understand how come it works for one but not the other.

When LAV is set for DXVA2 (native), both video renderers are in D3D9 Exclusive mode and a 10-bit video file is played the following occurs:

MadVR- Screen is split, colours are pink and green. I've always known that copy-back is required for this type of file to play back properly.
MPCVR- Plays back no problem, colours are normal, screen is not split. Looking at the filter states that the active decoder is dxva2n and not software.

Why does MadVR require copy-back to have proper colours, but MPCVR does not?
Sunspark is offline   Reply With Quote
Old 23rd April 2022, 12:36   #24790  |  Link
clsid
*****
 
Join Date: Feb 2005
Posts: 5,664
This is the place to report MadVR bugs:
http://bugs.madshi.net/view_all_bug_...p?project_id=4
__________________
MPC-HC 2.3.1
clsid is offline   Reply With Quote
Old 29th April 2022, 18:11   #24791  |  Link
sebas_led
Sebastian Ledesma
 
Join Date: Jun 2013
Location: Buenos Aires, Argentina
Posts: 17
Hi:

I'm interesed on issue #355 https://github.com/Nevcairiel/LAVFilters/issues/355
So as first step I've checked the code of LAV Splitter https://github.com/Nevcairiel/LAVFil...AVSplitter.cpp
but I've noticed that LAVSplitter::GetCurrentPosition returns E_NOTIMPL
I can get the elapsed time when playing a http stream, but I receive 0 when trying to get the current play position in rtmp streams.

So how the graph knows what it's the elapsed time?

TIA
Sebas
sebas_led is offline   Reply With Quote
Old 30th April 2022, 07:09   #24792  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,361
The graph manager manages the current position, the source is not necessarily involved - in fact, the source cannot always effectively know, because it does not know how much data is being buffered downstream.
The reference clock should have the accurate current position.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders

Last edited by nevcairiel; 30th April 2022 at 07:11.
nevcairiel is offline   Reply With Quote
Old 2nd May 2022, 22:27   #24793  |  Link
sebas_led
Sebastian Ledesma
 
Join Date: Jun 2013
Location: Buenos Aires, Argentina
Posts: 17
Thanks Nev!
I'm trying to know why I can't get the elasped time of an rtmp stream like this: rtmp://inliveserver.com:1935/14102/14102
I've tested with a second stream from other stream with the same result.
I've analyzed the stream with Wireshark and the timestamp seems to be valid (said that, I'm not an expert on rtmp).
I'm also reading the source at https://github.com/Nevcairiel/LAVFil...AVFDemuxer.cpp trying to understand a little more about the issue.
sebas_led is offline   Reply With Quote
Old 15th May 2022, 15:15   #24794  |  Link
Balling
Registered User
 
Join Date: Feb 2020
Posts: 541
Quote:
Originally Posted by clsid View Post
Afaik the D3D12 stuff is basically just same as D3D11 but with a somewhat simplified API. So don't get your expectations up to high.

I suggest testing if your AMD issues also occur with the Movies&TV player from Windows.
D3d11on12 is a good thing. VRR can be controlled.
Balling is offline   Reply With Quote
Old 15th May 2022, 15:25   #24795  |  Link
kasper93
MPC-HC Developer
 
Join Date: May 2010
Location: Poland
Posts: 591
Quote:
Originally Posted by Balling View Post
D3d11on12 is a good thing. VRR can be controlled.
Why? Why this is relevant to this thread?
kasper93 is offline   Reply With Quote
Old 18th May 2022, 13:45   #24796  |  Link
Balling
Registered User
 
Join Date: Feb 2020
Posts: 541
Quote:
Originally Posted by kasper93 View Post
Why? Why this is relevant to this thread?
For VFR video... All video on phones... MacOS already does it with its Promotion. Windows too with mpv. But there is no way to perfectly control VRR with d3d11. D3d12 allows manipulating VRR not just accounting for frames rendering.

Last edited by Balling; 18th May 2022 at 22:01.
Balling is offline   Reply With Quote
Old 18th May 2022, 15:53   #24797  |  Link
huhn
Registered User
 
Join Date: Oct 2012
Posts: 8,015
and what has the decoder to do with that?
you can use DXVA native decode and still render on a dx12 surface.
it has nothing todo here.
huhn is offline   Reply With Quote
Old 18th May 2022, 22:00   #24798  |  Link
Balling
Registered User
 
Join Date: Feb 2020
Posts: 541
Quote:
Originally Posted by huhn View Post
and what has the decoder to do with that?
you can use DXVA native decode and still render on a dx12 surface.
it has nothing todo here.
That is what we do in chrome, sure.
Balling is offline   Reply With Quote
Old 3rd June 2022, 14:30   #24799  |  Link
VipZ
Registered User
 
Join Date: Jun 2009
Location: London
Posts: 378
Hi Nev,

With the aim to build LAV with VS 2022, I have added the below code within 3 files, platform.props, libbluray.vcxproj and IntelQuickSyncDecoder.vcxproj

<PropertyGroup Label="Configuration" Condition="'$(VisualStudioVersion)' == '17.0'">
<PlatformToolset>v143</PlatformToolset>
<SpectreMitigation>false</SpectreMitigation>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>

Have successfully complied all binaries, is there any unknown issue foreseen with this or should this be all ok?

Thanks
__________________
Windows 11 Pro, CPU: Ryzen 9 5900X, GPU: GeForce RTX 3090 /w 512.95, Audio: HDMI to Yamaha RX-A3060 (5.1)
VipZ is offline   Reply With Quote
Old 7th June 2022, 16:01   #24800  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,361
I haven't really messed with VS2022 yet, but that should be fine.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders
nevcairiel is offline   Reply With Quote
Reply

Tags
decoders, directshow, filters, splitter

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:42.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.