Possible to take a screenshot without printing filename to screen?

This forum is about all development around libVLC.
wrybread
Blank Cone
Blank Cone
Posts: 17
Joined: 24 Mar 2007 05:44

Possible to take a screenshot without printing filename to screen?

Postby wrybread » 23 Oct 2018 21:19

I'm taking a screenshot like this:

fname = "whatever.png"
result = self.player.video_take_snapshot(0, fname, 0, 0)

It works well, but prints the filename to the screen and a thumbnail of the image. Is it possible to disable that behavior?

Maybe one of the marquee options?

I've tried disabling the marquee (self.player.video_set_marquee_int(vlc.VideoMarqueeOption.Enable, 0)), but it doesn't affect this, as far as I can tell at least.

mfkl
Developer
Developer
Posts: 740
Joined: 13 Jun 2017 10:41

Re: Possible to take a screenshot without printing filename to screen?

Postby mfkl » 24 Oct 2018 04:32

It works well, but prints the filename to the screen and a thumbnail of the image. Is it possible to disable that behavior?
I don't get it. Can you show a picture of the behavior you don't want? Are you sure it's libvlc-specific and not coming from your python bindings?
https://mfkl.github.io

wrybread
Blank Cone
Blank Cone
Posts: 17
Joined: 24 Mar 2007 05:44

Re: Possible to take a screenshot without printing filename to screen?

Postby wrybread » 24 Oct 2018 07:03

Sure, see here:

Image

Note the filename of the saved screenshot written on the video window, as well as a thumbnail of the screenshot at top left.

> Are you sure it's libvlc-specific and not coming from your python bindings?

Looking at vlc.py, I don't see anything that's introducing it.

wrybread
Blank Cone
Blank Cone
Posts: 17
Joined: 24 Mar 2007 05:44

Re: Possible to take a screenshot without printing filename to screen?

Postby wrybread » 24 Oct 2018 19:57

Looking under the hood, it looks like it's hard coded into video.c. Here's what vlc.py calls when it takes a snapshot:

Code: Select all

def libvlc_video_take_snapshot(p_mi, num, psz_filepath, i_width, i_height): '''Take a snapshot of the current video window. 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. @param p_mi: media player instance. @param num: number of video output (typically 0 for the first/only one). @param psz_filepath: the path of a file or a folder to save the screenshot into. @param i_width: the snapshot's width. @param i_height: the snapshot's height. @return: 0 on success, -1 if the video was not found. ''' f = _Cfunctions.get('libvlc_video_take_snapshot', None) or \ _Cfunction('libvlc_video_take_snapshot', ((1,), (1,), (1,), (1,), (1,),), None, ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.c_char_p, ctypes.c_int, ctypes.c_int) return f(p_mi, num, psz_filepath, i_width, i_height)
And here's libvlc_video_take_snapshot() in video.c:

Code: Select all

libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num, const char *psz_filepath, unsigned int i_width, unsigned int i_height ) { assert( psz_filepath ); vout_thread_t *p_vout = GetVout (p_mi, num); if (p_vout == NULL) return -1; /* FIXME: This is not atomic. All parameters should be passed at once * (obviously _not_ with var_*()). Also, the libvlc object should not be * used for the callbacks: that breaks badly if there are concurrent * media players in the instance. */ var_Create( p_vout, "snapshot-width", VLC_VAR_INTEGER ); var_SetInteger( p_vout, "snapshot-width", i_width); var_Create( p_vout, "snapshot-height", VLC_VAR_INTEGER ); var_SetInteger( p_vout, "snapshot-height", i_height ); [b]var_Create( p_vout, "snapshot-path", VLC_VAR_STRING );[/b] var_SetString( p_vout, "snapshot-path", psz_filepath ); var_Create( p_vout, "snapshot-format", VLC_VAR_STRING ); var_SetString( p_vout, "snapshot-format", "png" ); var_TriggerCallback( p_vout, "video-snapshot" ); vlc_object_release( p_vout ); return 0; }
Oh well, I guess I can recompile to remove it. Would be nice to make that an optional parameter in future versions especially since, reading the "FIXME" comment, it might cause a crash if there are concurrent media players running.

mfkl
Developer
Developer
Posts: 740
Joined: 13 Jun 2017 10:41

Re: Possible to take a screenshot without printing filename to screen?

Postby mfkl » 25 Oct 2018 04:00

Maybe try

Code: Select all

--no-osd
or

Code: Select all

--no-video-title-show
https://mfkl.github.io

wrybread
Blank Cone
Blank Cone
Posts: 17
Joined: 24 Mar 2007 05:44

Re: Possible to take a screenshot without printing filename to screen?

Postby wrybread » 25 Oct 2018 04:25

Thank you, the option "--no-osd" suppresses the filename being shown! It still shows the thumbnail, but that's less of an issue for me.

And interestingly I can still draw messages on the screen when I init with "--sub-source marq". So it doesn't disable the marq feature.

Thanks again.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 6 guests