Page 1 of 1

Failed to convert image for snapshot with LibVlc 4.0

Posted: 04 Oct 2020 02:37
by neosettler
Greetings,

Using a similar technique as the link below, my thumbnailer works well in 3.0 but fails in 4.0 (~may 2020 build).
https://github.com/videolan/vlc/blob/ma ... lc-thumb.c

log:
[000001a1287bec20] main filter error: Failed to create video converter
[0000003a67af5dc8] main generic debug: no video converter modules matched
[000001a1287bec20] main filter debug: no video converter found
[000001a10fcefdb0] main encoder debug: removing module "png"
[000001a119ea4be0] main video output error: Failed to convert image for snapshot
[000001a11b9fdf40] main decoder debug: killing decoder fourcc `h264'
[000001a11b9fdf40] main decoder debug: removing module "avcodec"

Any ideas what might be happening?

Re: Failed to convert image for snapshot with LibVlc 4.0

Posted: 04 Oct 2020 07:48
by Rémi Denis-Courmont
Log is incomplete.

Re: Failed to convert image for snapshot with LibVlc 4.0

Posted: 04 Oct 2020 14:48
by neosettler
Maximum characters in a post is about 6000.

[00000152d5eab160] main libvlc debug: VLC media player - 4.0.0-dev Otto Chriek
[00000152d5eab160] main libvlc debug: Copyright © 1996-2020 the VideoLAN team
[00000152d5eab160] main libvlc debug: revision 4.0.0-dev-11894-gb5d432408f
[00000152d5eab160] main libvlc debug: configured with /builds/videolan/vlc/extras/package/win32/../../../configure '--enable-update-check' '--enable-lua' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-avcodec' '--enable-merge-ffmpeg' '--enable-dca' '--enable-libass' '--enable-schroedinger' '--enable-live555' '--enable-dvdread' '--enable-shout' '--enable-goom' '--enable-caca' '--enable-qt' '--enable-skins2' '--enable-sse' '--enable-mmx' '--enable-libcddb' '--enable-zvbi' '--disable-telx' '--enable-nls' '--host=x86_64-w64-mingw32' '--with-contrib=../contrib/x86_64-w64-mingw32' '--enable-debug' 'host_alias=x86_64-w64-mingw32' 'PKG_CONFIG=pkg-config' 'PKG_CONFIG_LIBDIR=/usr/x86_64-w64-mingw32/lib/pkgconfig:/usr/lib/x86_64-w64-mingw32/pkgconfig'
[00000152d5eab160] main libvlc debug: plug-ins loaded: 505 modules
[00000017240f6678] main generic debug: looking for logger module matching "any": 2 candidates
[00000017240f6678] main generic debug: using logger module "console"
[00000152d5eab160] main libvlc debug: translation test: code is "C"
[00000017240f6608] main generic debug: looking for keystore module matching "memory": 3 candidates
[00000017240f6608] main generic debug: using keystore module "memory"
[00000152d5eab160] main libvlc debug: CPU has capabilities MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 FPU
[00000152d3fbbf90] main player debug: creating audio output
[00000017240f6688] main generic debug: looking for audio output module matching "any": 6 candidates
[00000152d3290240] mmdevice audio output error: cannot initialize COM (error 0x80010106)
[00000152d3290240] directsound audio output debug: found 3 devices
[00000017240f6688] main generic debug: using audio output module "directsound"
[00000152d3fbbf90] main player debug: keeping audio output
[00000152c9f6d660] main input debug: Creating an input for 'Demon's Souls - Official 4K 60FPS Gameplay Trailer.webm'
[00000152c9f55100] main input debug: Creating an input for preparsing 'Demon's Souls - Official 4K 60FPS Gameplay Trailer.webm'
[00000152c9f6d660] main input debug: using timeshift granularity of 50 MiB
[00000152c9f6d660] main input debug: using timeshift path: C:\Users\bob\AppData\Local\Temp
...SNIP
[000000172b6ff848] main generic debug: using access module "filesystem"
[000000172b6ff8a8] main generic debug: looking for stream_filter module matching "prefetch,cache": 25 candidates
[00000152d30dcef0] cache_read stream filter debug: Using stream method for AStream*
[00000152d30dcef0] cache_read stream filter debug: starting pre-buffering
[00000152d30dcef0] cache_read stream filter debug: received first data after 3 ms
[00000152d30dcef0] cache_read stream filter debug: pre-buffering done 1024 bytes in 0s - 142 KiB/s
[000000172b6ff8a8] main generic debug: using stream_filter module "cache_read"
[000000172b6ff8b8] main generic debug: looking for stream_filter module matching "any": 25 candidates
...SNIP
[000000172b6ff8b8] main generic debug: no stream_filter modules matched
[000000172b6ff938] main generic debug: looking for stream_directory module matching "any": 1 candidates
[000000172b6ff938] main generic debug: no stream_directory modules matched
[00000152c9f6d660] main input debug: attachment of directory-extractor failed for file:///mypath/Demon%27s%20Souls%20-%20Official%204K%2060FPS%20Gameplay%20Trailer.webm
[000000172b6ff8a8] main generic debug: looking for stream_filter module matching "record": 25 candidates
[000000172b6ff8a8] main generic debug: using stream_filter module "record"
[00000152c9f6d660] main input debug: creating demux "any", URL: file:...SNIP
[000000172b6ff918] main generic debug: looking for demux module matching "any": 54 candidates

Re: Failed to convert image for snapshot with LibVlc 4.0

Posted: 04 Oct 2020 14:51
by neosettler
[00000152e4f924c0] d3d11va generic debug: - 'MPEG-2 & MPEG-1 variable-length decoder' is supported
[00000152c9f6d660] main input debug: Stream buffering done (1001 ms in 331 ms)
[00000152e4f924c0] d3d11va generic debug: - 'MPEG-2 variable-length decoder' is supported
[00000152e4f924c0] d3d11va generic debug: - 'MPEG-1 variable-length decoder, no D pictures' is supported
[00000152e4f924c0] d3d11va generic debug: - 'VC-1 variable-length decoder' is supported
[00000152e4f924c0] d3d11va generic debug: - 'VC-1 variable-length decoder' is supported
[00000152e4f924c0] d3d11va generic debug: - 'Unknown decoder 0x32fcfe3f-0xde46-0x4a49-0x861bac71110649d5' is supported
[00000152e4f924c0] d3d11va generic debug: - 'H.264 stereo high profile, mbs flag set' is supported
[00000152e4f924c0] d3d11va generic debug: - 'H.264 stereo high profile' is supported
[00000152e4f924c0] d3d11va generic debug: - 'H.264 variable-length decoder, no film grain technology' is supported
[00000152e4f924c0] d3d11va generic debug: - 'HEVC Main profile' is supported
[00000152e4f924c0] d3d11va generic debug: - 'HEVC Main 10 profile' is supported
[00000152e4f924c0] d3d11va generic debug: - 'Unknown decoder 0x20bb8b0a-0x97aa-0x4571-0x8e9964e60606c1a6' is supported
[00000152e4f924c0] d3d11va generic debug: - 'Unknown decoder 0x15df9b21-0x06c4-0x47f1-0x841ea67c97d7f312' is supported
[00000152e4f924c0] d3d11va generic debug: - 'MPEG-4 Part 2 variable-length decoder, Simple Profile' is supported
[00000152e4f924c0] d3d11va generic debug: - 'MPEG-4 Part 2 variable-length decoder, Simple&Advanced Profile, no GMC' is supported
[00000152e4f924c0] d3d11va generic debug: - 'MPEG-4 Part 2 nVidia bitstream decoder' is supported
[00000152e4f924c0] d3d11va generic debug: - 'Unknown decoder 0x33fcfe41-0xde46-0x4a49-0x861bac71110649d5' is supported
[00000152e4f924c0] d3d11va generic debug: - 'VP9 profile 0' is supported
[00000152e4f924c0] d3d11va generic debug: - 'VP9 profile 2' is supported
[00000152e4f924c0] d3d11va generic debug: - 'Unknown decoder 0xdda19dc7-0x93b5-0x49f5-0xa9b32bda28a2ce6e' is supported
[00000152e4f924c0] d3d11va generic debug: - 'Unknown decoder 0x6affd11e-0x1d96-0x42b1-0xa21593a31f09a53d' is supported
[00000152e4f924c0] d3d11va generic debug: - 'Unknown decoder 0x914c84a3-0x4078-0x4fa9-0x984ce2f262cb5c9c' is supported
[00000152e4f924c0] d3d11va generic debug: - 'Unknown decoder 0x8a1a1031-0x29bc-0x46d0-0xa007e9b092ca6767' is supported
[00000152e4f924c0] d3d11va generic debug: Trying to use 'VP9 profile 0' as input
[00000152e4f924c0] d3d11va generic debug: format NV12 is supported for output
[00000152e4f924c0] d3d11va generic debug: format I420_OPAQUE is supported for output
[00000152e4f924c0] d3d11va generic debug: favor decoder format VA_NV12
[00000152e4f924c0] d3d11va generic debug: NV12 output is supported for decoder VP9 profile 0.
[00000152e4f924c0] d3d11va generic debug: Using output format NV12 for decoder VP9 profile 0
[00000152e4f924c0] d3d11va generic debug: va_pool_SetupDecoder id 167 3840x2160 count: 17
[00000152e4f924c0] d3d11va generic debug: ID3D11VideoDecoderOutputView succeed with 17 surfaces (3840x2160)
[00000152e4f924c0] d3d11va generic debug: we got 2 decoder configurations
[00000152e4f924c0] d3d11va generic debug: configuration[0] ConfigBitstreamRaw 1
[00000152e4f924c0] d3d11va generic debug: configuration[1] ConfigBitstreamRaw 2
[00000152e4f924c0] d3d11va generic debug: DxCreateDecoderSurfaces succeed
[00000152e4f924c0] d3d11va generic: Using D3D11VA (NVIDIA GeForce RTX 2080 Ti, vendor 10de(NVIDIA), device 1e04, revision a1)
[000000172b5fe7f8] main generic debug: using hw decoder module "d3d11va"
[00000152d3fd1b30] main decoder debug: vout change: chroma
[00000152d5a68e00] main window debug: resized to 3840x2130
[00000152d5a68e00] main window debug: resized to 3840x2130
[00000152d5a6a890] main video output debug: deinterlace -1, mode auto, is_needed 0
[00000152d5a6a890] main video output debug: Opening vout display wrapper
[000000172b5fe358] main generic debug: looking for vout display module matching "dummy": 12 candidates
[000000172b5fe358] main generic debug: using vout display module "vdummy"
[00000152d5a6a890] main video output debug: original format sz 3840x2160, of (0,0), vsz 3840x2160, 4cc DX11, sar 1:1, msk r0x0 g0x0 b0x0
[00000152c9f6c580] main spu text debug: removing module "freetype"
[000000172b5fe3e8] main generic debug: looking for text renderer module matching "any": 3 candidates
[00000152c9f6cfc0] freetype spu text debug: Using DWrite backend
[00000152c9f6cfc0] freetype spu text debug: DWrite_GetFamily(): family name: Arial
...SNIP
[000000172b5fe3e8] main generic debug: using text renderer module "freetype"
[00000152d5a68e00] window window debug: leaving fullscreen mode
[00000152d5a6a890] main video output debug: requested window size: 3840x2160
[00000152d3fd1b30] main decoder debug: Received first picture
[00000152c9f68a80] main subpicture warning: original picture size is undefined
[00000152c9f6d660] main input debug: Decoder wait done in 320 ms

Re: Failed to convert image for snapshot with LibVlc 4.0

Posted: 04 Oct 2020 14:51
by neosettler
[[08:40:48] Warning: Take snapshot: <C:/mypath/Demon's Souls - Official 4K 60FPS Gameplay Trailer.jpg>
00000152c9f6d660] main input debug: control type=4
[000000172c16f5e8] main generic debug: looking for video blending module matching "any": 1 candidates
[00000152c9f6d660] main input debug: ES_OUT_RESET_PCR called
[00000152c9f6d250] blend blend error: no matching alpha blending routine (chroma: YUVA -> DX11)
[00000152d30dc1d0] mkv demux debug: SET_TIME to 15000000
[00000152d3fd1b30] main decoder debug: Received first picture
[000000172c16f5e8] main generic debug: no video blending modules matched
[00000152d30dc1d0] mkv demux debug: seek request to i_pos = 15000000
[00000152d3fed650] avcodec packetizer debug: CPU flags: 0x000fd3db
[00000152c9f6d250] main blend error: blending YUVA to DX11 failed
[00000152d30dc1d0] mkv demux debug: seek: preroll{ track: 1, pts: 14481000, fpos: 16547228 skip: 16547228}
[00000152d30dc1d0] mkv demux debug: seek: preroll{ req: 15000001, start-pts: 14481001, start-fpos: 16547228}
[00000152c9f6d660] main input debug: control type=27
[00000152c9f6d660] main input debug: Buffering 0%
...SNIP

[00000152d3fd1b30] main decoder debug: removing module "avcodec"
[00000152c9f6d250] blend blend error: no matching alpha blending routine (chroma: YUVA -> DX11)
[vp9 @ 00000152d31372c0] [000000172c16f5e8] main generic debug: no video blending modules matched
thread_get_buffer() failed
[00000152c9f6d250] main blend error: blending YUVA to DX11 failed
[00000152d5a6a890] main video output warning: picture is too late to be displayed (missing 34 ms)
[00000152d5a6a890] main video output warning: picture is too late to be displayed (missing 22 ms)
[00000152d5a6a890] main video output debug: picture might be displayed late (missing 9 ms)
[00000152d3fbbf90] main player debug: saving a free vout
[00000152d3fed650] main packetizer debug: removing module "avcodec"
[00000152d30dc1d0] main demux debug: removing module "mkv"
[00000152d30dc1d0] main demux debug: attempt to destroy nonexistent variable "module-name"
[00000152d30dc010] main stream filter debug: removing module "record"
[00000152d30dcef0] main stream filter debug: removing module "cache_read"
[00000152d30db670] main access debug: removing module "filesystem"
[00000152c9f6d660] main input debug: destroying input for 'Demon's Souls - Official 4K 60FPS Gameplay Trailer.webm'
[00000152d5a6a890] main video output debug: stop free vout
[00000152c9f6cfc0] main spu text debug: removing module "freetype"
[00000152c9f6cd30] main scale debug: removing module "yuvp"
[00000152c9f6c810] main scale debug: removing module "swscale"
[00000152c9f28d50] main inhibit debug: removing module "inhibit"
[00000152d5a68e00] main window error: window closed
[00000152d3290240] main audio output debug: removing module "directsound"
[00000152d5eab160] main libvlc debug: exiting
[00000152d5eab160] main libvlc debug: no exit handler
[00000152d5eab160] main libvlc debug: removing all interfaces
[00000152d32ad510] main keystore debug: removing module "memory"
Loading time: 125 milliseconds

Re: Failed to convert image for snapshot with LibVlc 4.0

Posted: 04 Oct 2020 22:07
by sherington
I don't know about this specific problem, I just wanted to mention there's a new native thumbnailer API provided with LibVLC 4.x that might be useful to you, look for e.g. libvlc_media_thumbnail_request_by_time. It's much easier IMO than doing set position and waiting for position changed and snapshot changed events like you're doing here.

Re: Failed to convert image for snapshot with LibVlc 4.0

Posted: 05 Oct 2020 00:21
by neosettler
Thank you for your input sherington, I've looked at vlc_thumbnailer_RequestByTime and it seems like something I would use eventually. I dont see a mechanic to output the file so it would be great if there is any example I could chew on. 4.0 seems to be under heavy development so it would be best that the thumbnailer solution works in 3.0 and 4.0 as well. Hopefully, with the log above, VLC Jedi masters could clear this up easily. I'm still in the migration process and a few things still needs to be resolved before ditching 3.0 completely.

Re: Failed to convert image for snapshot with LibVlc 4.0

Posted: 05 Oct 2020 09:50
by mfkl
dotnet example for preview images with libvlc 3 callbacks https://code.videolan.org/mfkl/libvlcsh ... Program.cs

Re: Failed to convert image for snapshot with LibVlc 4.0

Posted: 05 Oct 2020 16:00
by neosettler
thank you mfkl, to be clear, the thumbnailer code works well with libvlc 3.0 C++ but the same code fails with libvlc 4.0 C++, see log:

[00000072dccf5c68] main generic debug: no video converter modules matched
[0000020aa7c8f0e0] main filter error: Failed to create video converter
[00000072dccf6298] main generic debug: no video converter modules matched
[0000020aa7c8f0e0] main filter debug: no video converter found
[0000020a9e8cb360] main encoder debug: removing module "png"
[0000020a9e8f4570] main video output error: Failed to convert image for snapshot

Re: Failed to convert image for snapshot with LibVlc 4.0

Posted: 05 Oct 2020 17:26
by mfkl
see log:
When you share logs, always share them in full. You can highlight the part you think might be relevant, but it may not be it, so always share the full logs. Upload them somewhere and link to it, if the forum doesn't allow large enough messages.

Regarding your issue, please share a minimal repro so we can have a look. See https://stackoverflow.com/help/minimal- ... le-example on how to do so.

Re: Failed to convert image for snapshot with LibVlc 4.0

Posted: 05 Oct 2020 17:26
by mfkl
but fails in 4.0 (~may 2020 build).
4.0 is nightly. Always try latest build (todays).

Re: Failed to convert image for snapshot with LibVlc 4.0

Posted: 06 Oct 2020 00:49
by neosettler
Hi mfkl, I did but I'm essentially using the same C++ code and the migration (3.0 to 4.0) has several issues. Either the mechanics are broken or fundamental changed so it's hard to tell as there is, to my knowledge, no source code examples that are up to date or that could be compiled on Windows without going to tedious hula hoops. No disrespect here, just saying. Point in case, render to texture is working as of May build and doesn't with today's build, with or without frame buffers. I'd be glad to go through all of the issues I'm struggling with eventually.

As for the original post, if someone could confirm that this works as intended with 4.0, I think it would be the simplest way to go. But then again, no render to texture with today's build so I'm kind of stuck.

https://github.com/videolan/vlc/blob/ma ... lc-thumb.c

thanks again for your support,

Re: Failed to convert image for snapshot with LibVlc 4.0

Posted: 06 Oct 2020 00:54
by neosettler
As a reference, here is the actual code I'm using:

Code: Select all

ZVideoLanThumbnailer::ZVideoLanThumbnailer(const Char *in_path, UInt in_with, Double in_time) : m_Width(in_with), m_ThumbnailsTime(Int64(in_time * 1000)), m_ThumbnailsPath(in_path), m_Media(NULL), m_MediaEventManager(NULL), m_Player(NULL), m_PlayerEventManager(NULL), m_VLC(NULL) { ZFileInfo l_info(in_path); m_ThumbnailsPath = ZString().Arg("%s/%s/%s.%s", l_info.GetPath().GetAscii(), zPreference->FolderThumbnails.GetAscii(), l_info.GetBaseName().GetAscii(), ZEN_EXTENSION_THUMBNAIL); const Char *l_args[] = { "--intf", "dummy", /// no interface. "--no-audio", /// we don't want audio (decoding). "--no-osd", "--no-snapshot-preview", /// no blending in dummy vout. "--no-stats", /// no stats. "--no-sub-autodetect-file", /// we don't want subtitles. "--no-video-title-show", /// nor the filename displayed. "--vout", "dummy", /// we don't want video (output). //"--verbose=-1", /// This is the verbosity level (-1=disabled, 0=only errors and standard messages, 1=warnings, 2=debug). "--verbose=2", /// This is the verbosity level (-1=disabled, 0=only errors and standard messages, 1=warnings, 2=debug). }; m_VLC = libvlc_new(sizeof(l_args) / sizeof(l_args[0]), l_args); ZenValidate(m_VLC); m_Player = libvlc_media_player_new(m_VLC); ZenValidate(m_Player); m_PlayerEventManager = libvlc_media_player_event_manager(m_Player); ZenValidate(m_PlayerEventManager); m_Media = libvlc_media_new_path(m_VLC, ZAgnostic::SlashesToBackSlashes(in_path)); ZenValidate(m_Media); m_MediaEventManager = libvlc_media_event_manager(m_Media); ZenValidate(m_MediaEventManager); libvlc_media_player_set_media(m_Player, m_Media); } ZVideoLanThumbnailer::~ZVideoLanThumbnailer() { libvlc_media_release(m_Media); libvlc_media_player_release(m_Player); libvlc_release(m_VLC); } void ZVideoLanThumbnailer::UnlockMutexEvent(const VLC_Event *in_event, void *in_opaque) { std::condition_variable *l_cv = static_cast<std::condition_variable *>(in_opaque); switch (in_event->type) { case libvlc_MediaPlayerBuffering: { if (in_event->u.media_player_buffering.new_cache != 100) { break; } } default: { l_cv->notify_one(); } }; } void ZVideoLanThumbnailer::Start() { ZenValidate(m_VLC); ZenValidate(m_Media); std::mutex l_mutex; std::condition_variable l_cv; std::unique_lock<std::mutex> l_lock(l_mutex); /// Parse libvlc_event_attach(m_MediaEventManager, libvlc_MediaParsedChanged, UnlockMutexEvent, &l_cv); if (libvlc_media_parse_with_options(m_Media, libvlc_media_parse_local, -1) == -1) { ZenError("Parsing: <%s>", m_ThumbnailsPath.GetAscii()); } l_cv.wait(l_lock); libvlc_event_detach(m_MediaEventManager, libvlc_MediaParsedChanged, UnlockMutexEvent, &l_cv); /// Buffering libvlc_media_player_play(m_Player); libvlc_event_attach(m_PlayerEventManager, libvlc_MediaPlayerBuffering, UnlockMutexEvent, &l_cv); l_cv.wait(l_lock); libvlc_event_detach(m_PlayerEventManager, libvlc_MediaPlayerBuffering, UnlockMutexEvent, &l_cv); /// Duration Int64 l_duration = libvlc_media_player_get_length(m_Player); if (l_duration > 0 && m_ThumbnailsTime > l_duration) { m_ThumbnailsTime = l_duration / 2; ZenWarning("Setting time: %Id", m_ThumbnailsTime); } /// Time libvlc_event_attach(m_PlayerEventManager, libvlc_MediaPlayerEncounteredError, UnlockMutexEvent, &l_cv); libvlc_event_attach(m_PlayerEventManager, libvlc_MediaPlayerEndReached, UnlockMutexEvent, &l_cv); libvlc_event_attach(m_PlayerEventManager, libvlc_MediaPlayerTimeChanged, UnlockMutexEvent, &l_cv); #if ZEN_SUPPORT_VLC4 libvlc_media_player_set_time(m_Player, m_ThumbnailsTime, false); #else libvlc_media_player_set_time(m_Player, m_ThumbnailsTime); #endif l_cv.wait(l_lock); libvlc_event_detach(m_PlayerEventManager, libvlc_MediaPlayerEncounteredError, UnlockMutexEvent, &l_cv); libvlc_event_detach(m_PlayerEventManager, libvlc_MediaPlayerTimeChanged, UnlockMutexEvent, &l_cv); libvlc_event_detach(m_PlayerEventManager, libvlc_MediaPlayerEndReached, UnlockMutexEvent, &l_cv); /// Snapshot /// If i_width AND i_height is 0, original size is used. /// If i_width XOR i_height is 0, original aspect-ratio is preserved. ZenWarning("Take snapshot: <%s>", m_ThumbnailsPath.GetAscii()); libvlc_event_attach(m_PlayerEventManager, libvlc_MediaPlayerSnapshotTaken, UnlockMutexEvent, &l_cv); if (libvlc_video_take_snapshot(m_Player, 0, m_ThumbnailsPath.GetAscii(), m_Width, 0) == -1) { ZenError("Taking snapshot: <%s>", m_ThumbnailsPath.GetAscii()); } libvlc_event_detach(m_PlayerEventManager, libvlc_MediaPlayerSnapshotTaken, UnlockMutexEvent, &l_cv); #if ZEN_SUPPORT_VLC4 libvlc_media_player_stop_async(m_Player); #else libvlc_media_player_stop(m_Player); #endif }

Re: Failed to convert image for snapshot with LibVlc 4.0

Posted: 30 Oct 2020 15:28
by neosettler
Well, I had a bit of time to look into this and what is broken until today is that libvlc_video_get_size always returns 0,0. The only way to get the size of the video with 4.0 is by parsing the video track.

In all cases, taking snapshots does work beautifully without changing any code now.

Thank you all for your support.