Stream to memory not working in VLC 3.0

This forum is about all development around libVLC.
bdschmidt
New Cone
New Cone
Posts: 5
Joined: 17 Feb 2017 16:31

Stream to memory not working in VLC 3.0

Postby bdschmidt » 17 Feb 2017 17:04

I have been using Stream to memory (smem) for several years in an app. When I upgrade to any flavor of VLC 3.0, it no longer works and instead a Direct3D9 Output window appears. The following is the initiation code:

Code: Select all

char smem_options[256]; void *pUserData = 0; ::sprintf_s(smem_options, "#transcode{vcodec=RV24,acodec=none}:smem{video-postrender-callback=%lld,video-prerender-callback=%lld,video-data=%lld}", (long long int)(intptr_t)(void*)&handleStream, (long long int)(intptr_t)(void*)&prepareRender, (long long int)(intptr_t)(void*)this); const char * const vlc_args[] = { "-I", "dummy", // Don't use any interface "--ignore-config", // Don't use VLC's config "--verbose=2", // (0=only errors and standard messages, 1=warnings, 2=debug). "--sout", smem_options // Stream to memory }; // We launch VLC m_vlcInstance = libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args); m_mediaPlayer = libvlc_media_player_new(m_vlcInstance); // Build the URL. std::string urlStr; m_url.ToSingleByte(urlStr); if (m_media) libvlc_media_release(m_media); m_media = libvlc_media_new_location(m_vlcInstance, urlStr.c_str()); if (m_media != NULL) { libvlc_media_player_set_media(m_mediaPlayer, m_media); }
This is what the log is saying:

core libvlc debug: VLC media player - 3.0.0-git Vetinari
core libvlc debug: Copyright © 1996-2017 the VideoLAN team
core libvlc debug: revision 2.2.0-git-10950-gfaa5a38a4c
core libvlc debug: configured with ../extras/package/win32/../../../configure '--enable-update-check' '--enable-lua' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-twolame' '--enable-avcodec' '--enable-merge-ffmpeg' '--enable-dca' '--enable-mpc' '--enable-libass' '--enable-x264' '--enable-schroedinger' '--enable-realrtsp' '--enable-live555' '--enable-dvdread' '--enable-shout' '--enable-goom' '--enable-caca' '--disable-sdl' '--enable-qt' '--enable-skins2' '--enable-sse' '--enable-mmx' '--enable-libcddb' '--enable-zvbi' '--disable-telx' '--enable-nls' '--host=x86_64-w64-mingw32' '--enable-debug' 'host_alias=x86_64-w64-mingw32' 'PKG_CONFIG_LIBDIR=/home/jenkins/workspace/vlc-nightly/vlc-nightly-win64-x86_64/vlc/contrib/x86_64-w64-mingw32/lib/pkgconfig'
core libvlc debug: using multimedia timers as clock source
core libvlc debug: min period: 1 ms, max period: 1000000 ms
core libvlc debug: plug-ins loaded: 463 modules
core logger debug: looking for logger module matching "any": 2 candidates
core logger debug: using logger module "console"
core libvlc debug: translation test: code is "C"
core keystore debug: looking for keystore module matching "memory": 3 candidates
core keystore debug: using keystore module "memory"
core libvlc debug: CPU has capabilities MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 FPU
core generic debug: creating audio output
core audio output debug: looking for audio output module matching "any": 6 candidates
mmdevice audio output debug: using default device
mmdevice audio output debug: version 2 session control unavailable
mmdevice audio output debug: display name changed: VLC media player (LibVLC 3.0.0-git)
mmdevice audio output debug: volume from -65.250000 dB to +0.000000 dB with 0.031250 dB increments
core audio output debug: using audio output module "mmdevice"
core generic debug: keeping audio output
core input debug: Creating an input for 'RTSP://204.108.187.254'
core input debug: using timeshift granularity of 50 MiB
core input debug: using timeshift path: C:\Users\bschmidt\AppData\Local\Temp
core input debug: `RTSP://user:ASDFJKLqwerty@204.108.187.254' gives access `RTSP' demux `any' path `user:ASDFJKLqwerty@204.108.187.254'
core input source debug: creating demux: access='RTSP' demux='any' location='user:ASDFJKLqwerty@204.108.187.254' file='\\user:ASDFJKLqwerty@204.108.187.254'
core demux debug: looking for access_demux module matching "RTSP": 14 candidates
live555 demux debug: version 2016.11.28
core demux warning: Password in a URI is DEPRECATED
live555 demux debug: RTP subsession 'video/H264'
core input debug: selecting program id=0
live555 demux debug: setup start: 0.000000 stop:0.000000
live555 demux debug: We have a timeout of 60 seconds
live555 demux debug: play start: 0.000000 stop:0.000000
core demux debug: using access_demux module "live555"
core packetizer debug: looking for packetizer module matching "any": 24 candidates
h264 packetizer debug: found NAL_SPS (sps_id=0)
h264 packetizer debug: found NAL_PPS (pps_id=0 sps_id=0)
core packetizer debug: using packetizer module "h264"
The thread 0x5d70 has exited with code 0 (0x0).
core decoder debug: looking for decoder module matching "any": 50 candidates
avcodec decoder debug: CPU flags: 0x000fd3db
The thread 0x5dc8 has exited with code 0 (0x0).
avcodec decoder debug: allowing 4 thread(s) for decoding
avcodec decoder debug: codec (h264) started
avcodec decoder debug: using frame thread mode with 4 threads
core decoder debug: using decoder module "avcodec"
core demux meta debug: looking for meta reader module matching "any": 2 candidates
lua demux meta debug: Trying Lua scripts in C:\Users\bschmidt\AppData\Roaming\vlc\lua\meta\reader
lua demux meta debug: Trying Lua scripts in D:\vq\global\VQ\VQ\main\Azure\target\Azulon\x64\ReleaseNoOpt\lua\meta\reader
core demux meta debug: no meta reader modules matched
core input debug: `RTSP://user:ASDFJKLqwerty@204.108.187.254' successfully opened
core input debug: Buffering 0%
live555 demux debug: lost 86569 bytes
live555 demux debug: increasing buffer size to 200000
avcodec decoder debug: available hardware decoder output format 61 (dxva2_vld)
avcodec decoder debug: available hardware decoder output format 128 (d3d11va_vld)
avcodec decoder debug: available software decoder output format 0 (yuv420p)
avcodec decoder warning: thread type 1: disabling hardware acceleration
core spu text debug: looking for text renderer module matching "any": 3 candidates
First-chance exception at 0x000007FEFD05A06D (KernelBase.dll) in Azulon.exe: 0x20474343 (parameters: 0x0000000036B51DC0).
freetype spu text warning: DirectWrite initialization failed. Falling back to GDI/Uniscribe
core spu text debug: using text renderer module "freetype"
core scale debug: looking for video converter module matching "any": 20 candidates
swscale scale debug: 32x32 (32x32) chroma: YUVA -> 16x16 (16x16) chroma: RGBA with scaling using Bicubic (good quality)
core scale debug: using video converter module "swscale"
core scale debug: looking for video converter module matching "any": 20 candidates
yuvp scale debug: YUVP to YUVA converter
core scale debug: using video converter module "yuvp"
core video output debug: Deinterlacing available
core video output debug: deinterlace 0, mode blend, is_needed 0
core window debug: looking for vout window module matching "any": 3 candidates
core window debug: no vout window modules matched
core video output debug: Opening vout display wrapper
core vout display debug: looking for vout display module matching "any": 12 candidates
direct3d9 vout display debug: Using Direct3D9 Extended API!
'Azulon.exe' (Win32): Loaded 'C:\Windows\System32\D3DX9_43.dll'. Symbols loaded.
direct3d9 vout display debug: creating Vout EventThread
direct3d9 vout display debug: Win32VoutCreateWindow
The thread 0x6344 has exited with code 0 (0x0).
The thread 0x2cfc has exited with code 0 (0x0).
direct3d9 vout display debug: created video sub-window
direct3d9 vout display debug: Vout EventThread running
direct3d9 vout display debug: disabling screen saver
direct3d9 vout display debug: Direct3d9 Device: NVIDIA GeForce GTX 980 4318 5056 161
core input debug: Buffering 26%
direct3d9 vout display debug: DirectXUpdateRects souce offset: 0,0 visible: 1920x1080
direct3d9 vout display debug: DirectXUpdateRects image_src coords: 0,0,1920,1090
direct3d9 vout display debug: DirectXUpdateRects image_src_clipped coords: 0,0,1920,1080
direct3d9 vout display debug: DirectXUpdateRects image_dst coords: 0,0,1920,1080
direct3d9 vout display debug: DirectXUpdateRects image_dst_clipped coords: 0,0,1920,1080
'Azulon.exe' (Win32): Loaded 'C:\Windows\System32\ExplorerFrame.dll'. Symbols loaded.
'Azulon.exe' (Win32): Loaded 'C:\Windows\System32\duser.dll'. Symbols loaded.
'Azulon.exe' (Win32): Loaded 'C:\Windows\System32\dui70.dll'. Symbols loaded.
'Azulon.exe' (Win32): Loaded 'C:\Windows\System32\actxprxy.dll'. Symbols loaded.
direct3d9 vout display warning: trying surface pixel format: YV12
direct3d9 vout display debug: selected surface pixel format is YV12
direct3d9 vout display debug: Direct3D created offscreen surface: 1920x1090
direct3d9 vout display debug: Direct3D created texture: 1920x1080
direct3d9 vout display debug: Direct3D9 scene created successfully
direct3d9 vout display debug: Direct3D9 device adapter successfully initialized
core vout display debug: using vout display module "direct3d9"
core video output warning: Not enough display buffers in the pool, requested 3 got 1
core video output debug: original format sz 1920x1090, of (0,0), vsz 1920x1080, 4cc I420, sar 1:1, msk r0x0 g0x0 b0x0
core vout display debug: VoutDisplayEvent 'window state' 0
core vout display debug: VoutDisplayEvent 'window state' 0
core spu text debug: removing module "freetype"
direct3d9 vout display debug: DirectXUpdateRects souce offset: 0,0 visible: 1920x1080
direct3d9 vout display debug: DirectXUpdateRects image_src coords: 0,0,1920,1090
core spu text debug: looking for text renderer module matching "any": 3 candidates
direct3d9 vout display debug: DirectXUpdateRects image_src_clipped coords: 0,0,1920,1080
direct3d9 vout display debug: DirectXUpdateRects image_dst coords: 0,0,1920,1080
direct3d9 vout display debug: DirectXUpdateRects image_dst_clipped coords: 0,0,1920,1080
First-chance exception at 0x000007FEFD05A06D (KernelBase.dll) in Azulon.exe: 0x20474343 (parameters: 0x00000003D746E7B0).
freetype spu text warning: DirectWrite initialization failed. Falling back to GDI/Uniscribe
core vout display error: Failed to change Viewpoint
core vout display debug: VoutDisplayEvent 'resize' 1920x1080
core spu text debug: using text renderer module "freetype"
avcodec decoder warning: plane 0 not aligned: disabling direct rendering
core decoder debug: Received first picture
core input debug: Buffering 53%
The thread 0x27cc has exited with code 0 (0x0).
core input debug: Buffering 80%
core input debug: Stream buffering done (1067 ms in 965 ms)
core input debug: Decoder wait done in 0 ms
live555 demux debug: lost 24273 bytes
live555 demux debug: increasing buffer size to 400000
core video output warning: picture is too late to be displayed (missing 66 ms)
core video output warning: picture is too late to be displayed (missing 34 ms)
core video output debug: picture might be displayed late (missing 4 ms)
core video output debug: picture might be displayed late (missing 5 ms)
core vout display debug: auto hiding mouse cursor
core vout display debug: auto hiding mouse cursor
core video output debug: picture might be displayed late (missing 5 ms)

When I revert to a pre 3.0 VLC, I get a section in the logs relating to smem that is completely absent in the above log. I just pasted the relevant portion below.

core input debug: Creating an input for 'user:ASDFJKLqwerty@204.108.187.254'
core stream output debug: using sout chain=`transcode{vcodec=RV24,acodec=none}:smem{video-postrender-callback=8791005323248,video-prerender-callback=8791005324064,video-data=11972362240}'
core stream output debug: stream=`smem'
core stream out debug: looking for sout stream module matching "smem": 22 candidates
'Azulon.exe' (Win32): Loaded 'D:\vq\global\VQ\VQ\TVM6.3\Mnt\main\Azure\target\Azulon\x64\ReleaseNoOpt\plugins\stream_out\libstream_out_smem_plugin.dll'. Module was built without symbols.
core stream out debug: set config option: sout-smem-video-postrender-callback to 8791005323248
core stream out debug: set config option: sout-smem-video-prerender-callback to 8791005324064
core stream out debug: set config option: sout-smem-video-data to 11972362240
core stream out debug: using sout stream module "stream_out_smem"
core stream output debug: stream=`transcode'
core stream out debug: looking for sout stream module matching "transcode": 22 candidates
'Azulon.exe' (Win32): Loaded 'D:\vq\global\VQ\VQ\TVM6.3\Mnt\main\Azure\target\Azulon\x64\ReleaseNoOpt\plugins\stream_out\libstream_out_transcode_plugin.dll'. Module was built without symbols.
core stream out debug: set config option: sout-transcode-vcodec to RV24
core stream out debug: set config option: sout-transcode-acodec to none
stream_out_transcode stream out debug: Checking codec mapping for none got none
stream_out_transcode stream out debug: codec audio=none 0Hz 0 channels 96Kb/s
stream_out_transcode stream out debug: Checking video codec mapping for RV24 got RV24
stream_out_transcode stream out debug: codec video=RV24 0x0 scaling: 0.000000 0kb/s
core stream out debug: using sout stream module "stream_out_transcode"

The absence of this logging information in the 3.0 version tells me that it never even saw/parsed the sout chain. Did something change in how smem is set up in 3.0? Or am I missing something obvious? Any and all thoughts are welcome. Thanks!

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Stream to memory not working in VLC 3.0

Postby Jean-Baptiste Kempf » 18 Feb 2017 13:33

It looks like the whole sout is not parsed/used.

Does it help if you do "--sout=..." in one argument?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

bdschmidt
New Cone
New Cone
Posts: 5
Joined: 17 Feb 2017 16:31

Re: Stream to memory not working in VLC 3.0

Postby bdschmidt » 19 Feb 2017 22:44

I tried the "--sout=...", specifically from my example,

Code: Select all

::sprintf_s(smem_options, "#transcode{vcodec=RV24,acodec=none}:smem{video-postrender-callback=%lld,video-prerender-callback=%lld,video-data=%lld}", (long long int)(intptr_t)(void*)&handleStream, (long long int)(intptr_t)(void*)&prepareRender, (long long int)(intptr_t)(void*)this); const char * const vlc_args[] = { "-I", "dummy", // Don't use any interface "--ignore-config", // Don't use VLC's config "--verbose=2", // (0=only errors and standard messages, 1=warnings, 2=debug). "--sout=smem_options", // Stream to memory };
with the same result - no sout parsing. I also tried the --sout in the beginning of the vlc_args[] just in case. Rats! I wonder if sout parsing could be broken in 3.0 land? I have never built VLC from the code but have downloaded prior versions of the source code. I might just try to find the sout parsing in pre 3.0 VLC and then grab the 3.0 sources and see if anything changed.

Thanks for the reply!

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Stream to memory not working in VLC 3.0

Postby Jean-Baptiste Kempf » 20 Feb 2017 09:44

No, that makes no sense. Does it happen also if the sout arg is the first one?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

bdschmidt
New Cone
New Cone
Posts: 5
Joined: 17 Feb 2017 16:31

Re: Stream to memory not working in VLC 3.0

Postby bdschmidt » 20 Feb 2017 14:50

Yes, it does also happen when the sout arg is the first one.

cblusplus
New Cone
New Cone
Posts: 3
Joined: 08 May 2018 11:13

Re: Stream to memory not working in VLC 3.0

Postby cblusplus » 08 May 2018 11:24

I have exactly the same issue. Is there any solution? I seems, that all arguments for sout are ignored. It is also impossible to enable file-logging via arguments. So i have tryed to write the log file via libvlc_log_set_file but there is no way to set the log-level, so i get only logs for level 0.

Rémi Denis-Courmont
Developer
Developer
Posts: 15248
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Stream to memory not working in VLC 3.0

Postby Rémi Denis-Courmont » 08 May 2018 20:52

Passing arguments to libvlc_new() is explicitly not supported. Every new LibVLC version appropriates new variables. "sout" is one appropriated for Chromecast support.

In some cases, you can circumvent the problem by setting the option(s) on the media item rather than the LibVLC instance. But fundamentally, the problem is the same there.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

cblusplus
New Cone
New Cone
Posts: 3
Joined: 08 May 2018 11:13

Re: Stream to memory not working in VLC 3.0

Postby cblusplus » 09 May 2018 10:00

Thank you for your quick reply :)
I have alternatively tried to get the raw audio data via libvlc_audio_set_callbacks and have setted the formar with libvlc_audio_set_format(media_player, "s8", 44100, 1).
The second and third parameter were taken but the first parameter not. The callback gets the data encoded in s16 or fl23 - not in s8.
I also get the data decoded in real time. Is there a way (like using --no-sout-smem-time-sync ) to disable the sync?

Rémi Denis-Courmont
Developer
Developer
Posts: 15248
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Stream to memory not working in VLC 3.0

Postby Rémi Denis-Courmont » 09 May 2018 11:26

The only permitted audio output formats are signed-16, signed-32, unsigned-8, float and double. It is not possible to disable audio sync.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

cblusplus
New Cone
New Cone
Posts: 3
Joined: 08 May 2018 11:13

Re: Stream to memory not working in VLC 3.0

Postby cblusplus » 09 May 2018 12:07

ok thx - i will try to split the decode on multiple libvlc instances ;-)

hvz
New Cone
New Cone
Posts: 6
Joined: 30 May 2014 10:31

Re: Stream to memory not working in VLC 3.0

Postby hvz » 17 Oct 2018 15:59

So then the tutorials on the site are wrong?
https://wiki.videolan.org/Stream_to_mem ... _tutorial/

This one clearly tells you to give a bunch of parameters to libvlc_new.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 10 guests