No audio when video is opened using StreamMediaInput in UWP
Summary
Whenever video file is opened using StreamMediaInput, it plays without sound in UWP
Minimal project and steps to reproduce
Whenever I open video as file, it plays just fine:
StorageApplicationPermissions.FutureAccessList.AddOrReplace(FILE_TOKEN, file);
var media = new Media(LibVLC, $"winrt://{FILE_TOKEN}", FromType.FromLocation);
But when I'm trying to open same file using StreamMediaInput, it plays without sound:
var stream = await file.OpenReadAsync();
var streamForRead = stream.AsStreamForRead();
Debug.WriteLine($"streamForRead.CanSeek: {streamForRead.CanSeek}");
var media = new Media(LibVLC, new StreamMediaInput(streamForRead));
Updated project with a repro here: https://github.com/vlasenkoalexey/LibVLCSharp.UWP.Sample_chromecast
What is the current bug behavior?
When file is opened for the sample project above using "Open File" button, it plays with sound. When same file is opened using "Open File As Stream" button, it plays without sound.
What is the expected correct behavior?
Files opened using StreamMediaInput should play with sound.
Does it work on other plaforms? Does it work with the official VLC apps?
N/A
Relevant logs and/or screenshots
Log when opened as file, audio stream is detected:
attachment of directory-extractor failed for winrt://{1BBC4B94-BE33-4D79-A0CB-E5C6CDB9D107}
Using stream method for AStream*
starting pre-buffering
received first data after 0 ms
looking for stream_filter module matching "record": 22 candidates
pre-buffering done 1024 bytes in 0s - 1992 KiB/s
looking for stream_filter module matching "any": 22 candidates
using stream_filter module "cache_read"
no stream_filter modules matched
looking for stream_directory module matching "any": 1 candidates
no stream_directory modules matched
Trying Lua scripts in C:\Users\vlase\AppData\Local\Packages\6adbf218-caa7-4240-9689-3b74cf39ad2d_hj88em4th0swa\LocalState\vlc\lua\playlist
using stream_filter module "record"
</list 'strl'>0
creating demux: access='winrt' demux='any' location='{1BBC4B94-BE33-4D79-A0CB-E5C6CDB9D107}' file='\\{1BBC4B94-BE33-4D79-A0CB-E5C6CDB9D107}'
looking for demux module matching "any": 52 candidates
<list 'AVI '>
<list 'hdrl'>
<list 'strl'>
</list 'strl'>0
<list 'strl'>
</list 'hdrl'>0
<list 'strl'>
</list 'strl'>0
<list 'odml'>
</list 'odml'>0
| + LIST-hdrl size:13110 pos:12
<list 'INFO'>
</list 'INFO'>0
skipping movi chunk
</list 'AVI '>0
no more data at 724178944
* LIST-root size:724178944 pos:0
+ RIFF-AVI size:724178684 pos:0
| | + avih size:56 pos:24
| | + LIST-strl size:4282 pos:88
| | | + strh size:56 pos:100
| | | + strn size:30 pos:212
| | | + strf size:40 pos:164
| | + LIST-strl size:4234 pos:4378
| | | + JUNK size:4120 pos:250
| | | + strh size:56 pos:4390
| | | + strf size:30 pos:4454
| + JUNK size:1056 pos:13272
| | | + JUNK size:4120 pos:4492
| | + LIST-strl size:4234 pos:8620
| | + ISFT size:47 pos:13142
| | | + strh size:56 pos:8632
| | | + strf size:30 pos:8696
| | | + JUNK size:4120 pos:8734
| | + LIST-odml size:260 pos:12862
| | | + dmlh size:248 pos:12874
| + LIST-INFO size:134 pos:13130
| | + INAM size:65 pos:13198
stream[1] audio(0x55 - MPEG Audio layer 3) 2 channels 48000Hz 0bits
| + LIST-movi size:720411428 pos:14336
| + idx1 size:3752912 pos:720425772
The thread 0x33f0 has exited with code 0 (0x0).
AVIH: 3 stream, flags HAS_INDEX IS_INTERLEAVED
+ JUNK size:244 pos:724178692
stream[0] rate:24000 scale:1001 samplesize:0
stream[0] video(XVID) 720x400 24bpp 23.976024fps
selecting program id=0
stream[1] rate:16000 scale:384 samplesize:384
stream[2] rate:16000 scale:384 samplesize:384
stream[2] audio(0x55 - MPEG Audio layer 3) 2 channels 48000Hz 0bits
stream[0] created 78193 index entries
selected standard index for stream[0]
selected standard index for stream[1]
selected standard index for stream[2]
stream[1] created 78182 index entries
CPU flags: 0x000fd3db
stream[2] created 78182 index entries
stream[0] length:3261 (based on index)
stream[1] length:3261 (based on index)
stream[2] length:3261 (based on index)
using demux module "avi"
looking for video decoder module matching "any": 13 candidates
using ffmpeg Lavc58.6.103
using packetizer module "mpegaudio"
allowing 6 thread(s) for decoding
codec (mpeg4) started
using video decoder module "avcodec"
Log when opened as stream, no audio stream detected:
removing module "avcodec"
removing module "float_mixer"
removing module "scaletempo"
reset
The thread 0x44ec has exited with code 0 (0x0).
killing decoder fourcc `h264'
keeping audio output
The thread 0x45f8 has exited with code 0 (0x0).
removing module "avcodec"
saving a free vout
removing module "mp4"
Program doesn't contain anymore ES
freeing all memory
The thread 0x2ff4 has exited with code 0 (0x0).
removing module "cache_block"
removing module "winstore"
destroying useless vout
removing module "samplerate"
The thread 0x5c24 has exited with code 0 (0x0).
Direct3D11 device adapter closed
removing module "freetype"
Direct3D11 resources destroyed
Creating an input for 'imem://'
removing module "swscale"
looking for access_demux module matching "imem": 6 candidates
reusing provided vout
creating demux: access='imem' demux='any' location='' file='(null)'
removing module "record"
`imem://' gives access `imem' demux `any' path `'
removing module "access"
removing module "direct3d11"
Invalid get/release function pointers
using access module "imem_access"
looking for stream_filter module matching "prefetch,cache_read": 22 candidates
using timeshift granularity of 50 MiB
removing module "yuvp"
using default timeshift path
creating access: imem://
no access_demux modules matched
received first data after 123 ms
looking for access module matching "imem": 22 candidates
Using stream method for AStream*
Trying Lua scripts in C:\Users\vlase\AppData\Local\Packages\6adbf218-caa7-4240-9689-3b74cf39ad2d_hj88em4th0swa\LocalState\vlc\lua\playlist
looking for stream_filter module matching "record": 22 candidates
starting pre-buffering
pre-buffering done 1024 bytes in 0s - 8 KiB/s
looking for stream_filter module matching "any": 22 candidates
using stream_filter module "cache_read"
<list 'strl'>
no stream_filter modules matched
looking for stream_directory module matching "any": 1 candidates
no stream_directory modules matched
attachment of directory-extractor failed for imem://
using stream_filter module "record"
<list 'AVI '>
skipping movi chunk
creating demux: access='imem' demux='any' location='' file='(null)'
<list 'INFO'>
looking for demux module matching "any": 52 candidates
</list 'AVI '>0
<list 'hdrl'>
</list 'strl'>0
</list 'hdrl'>fe
found null fourcc chunk (corrupted file?)
* LIST-root size:724178944 pos:0
</list 'INFO'>0
| | | + strn size:30 pos:212
no more data at 724178944
| | | + JUNK size:4120 pos:250
| + idx1 size:3752912 pos:720425772
| + LIST-INFO size:134 pos:13130
+ RIFF-AVI size:724178684 pos:0
| + LIST-hdrl size:13110 pos:12
| | + LIST-strl size:4282 pos:88
| | | + strh size:56 pos:100
| | | + strf size:40 pos:164
| | + avih size:56 pos:24
+ JUNK size:244 pos:724178692
stream[0] rate:24000 scale:1001 samplesize:0
| | + ISFT size:47 pos:13142
| | + INAM size:65 pos:13198
| + JUNK size:1056 pos:13272
| + LIST-movi size:720411428 pos:14336
CPU flags: 0x000fd3db
found 1 stream but 3 are declared
AVIH: 1 stream, flags HAS_INDEX IS_INTERLEAVED
stream[0] video(XVID) 720x400 24bpp 23.976024fps
allowing 6 thread(s) for decoding
selected standard index for stream[0]
selecting program id=0
stream[0] created 78193 index entries
stream[0] length:3261 (based on index)
using demux module "avi"
looking for video decoder module matching "any": 13 candidates
using ffmpeg Lavc58.6.103
Buffering 0%
DWrite_ParseFamily(): using font at index 0 with weight 400 for bold: 0, italic: 0
looking for meta reader module matching "any": 2 candidates
codec (mpeg4) started
using video decoder module "avcodec"
Trying Lua scripts in C:\Users\vlase\AppData\Local\Packages\6adbf218-caa7-4240-9689-3b74cf39ad2d_hj88em4th0swa\LocalState\vlc\lua\meta\reader
no meta reader modules matched
`imem://' successfully opened
DWrite_ParseFamily(): using font at index 1 with weight 700 for bold: 1, italic: 0
Stream buffering done (1500 ms in 25 ms)
available software decoder output format 0 (yuv420p)
looking for text renderer module matching "any": 2 candidates
Using DWrite backend
DWrite_GetFamily(): family name: Arial
DWrite_ParseFamily(): using font at index 2 with weight 400 for bold: 0, italic: 1
Deinterlacing available
DWrite_ParseFamily(): using font at index 3 with weight 700 for bold: 1, italic: 1
using text renderer module "freetype"
looking for video converter module matching "any": 22 candidates
32x32 (32x32) chroma: YUVA -> 16x16 (16x16) chroma: RGBA with scaling using Bicubic (good quality)
using video converter module "swscale"
looking for video converter module matching "any": 22 candidates
YUVP to YUVA converter
using video converter module "yuvp"
supports colorspace RGB Rec.2020 gamma:2084 range:STUDIO
deinterlace -1, mode auto, is_needed 0
looking for vout window module matching "any": 1 candidates
no vout window modules matched
Opening vout display wrapper
looking for vout display module matching "any": 6 candidates
supports colorspace RGB Rec.709 gamma:22 range:FULL
supports colorspace RGB Rec.2020 gamma:22 range:STUDIO
supports colorspace RGB Rec.709 gamma:22 range:STUDIO
supports colorspace RGB Rec.2020 gamma:22 range:FULL
supports colorspace RGB Rec.2020 gamma:2084 range:FULL
D3D11 pool succeed with 22 surfaces (720x416) context 0x0EDBB34C
using colorspace RGB Rec.709 gamma:22 range:FULL
original format sz 720x416, of (0,0), vsz 720x400, 4cc I420, sar 1:1, msk r0x0 g0x0 b0x0
Using pixel format I420 for chroma I420
fallback to legacy shader mode for old AMD drivers
Direct3D11 resources created
VoutDisplayEvent 'resize' 1803x1321
Direct3D11 Open Succeeded
Direct3D11 device adapter successfully initialized
using vout display module "direct3d11"
VoutDisplayEvent 'window state' 0
VoutDisplayEvent 'window state' 0
Failed to set on top
VoutDisplayEvent 'resize' 720x400
removing module "freetype"
looking for text renderer module matching "any": 2 candidates
DWrite_ParseFamily(): using font at index 2 with weight 400 for bold: 0, italic: 1
Using DWrite backend
plane 1: pitch not aligned (368%32): disabling direct rendering
DWrite_ParseFamily(): using font at index 0 with weight 400 for bold: 0, italic: 0
DWrite_GetFamily(): family name: Arial
Decoder wait done in 200 ms
DWrite_ParseFamily(): using font at index 1 with weight 700 for bold: 1, italic: 0
DWrite_ParseFamily(): using font at index 3 with weight 700 for bold: 1, italic: 1
Received first picture
auto hiding mouse cursor
using text renderer module "freetype"
Environment
- OS: Windows
- Version 10
- Device: PC
- LibVLC VideoLAN.LibVLC.UWP, 3.1.1 x86. Tried 3.2, but it doesn't play sound at all
- LibVLCSharp 3.4.2, 3.4.3, 3.4.5 x86
Possible fixes
N/A
Edited by Aleksey Vlasenko