Page 1 of 1

[LibVLC in C] Resizing the video before output

Posted: 14 Jan 2017 22:14
by derjanni
Dearest VLC community,

I am working on a media application that creates an overlay from a PNG file using the logo filter. It works when playing, but I want to resize any video to 1280x720 so that the overlay fits the entire screen and maintains quality.

I added the following code and it seems to resize the video, but the logo/overlay is not in there:

Code: Select all

libvlc_media_add_option (m, ":transcode{vcodec=mp4v,width=1280,height=720,sfilter=logo}");
Without this code it works, the logo overlay is in there. But it is not fully shown when the video is not 1280x720.

Code: Select all

const char * const vlc_args[] = { }; inst = libvlc_new (sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args); /* open the defined media file */ m = libvlc_media_new_path(inst,videofile); libvlc_media_add_option (m, ":transcode{vcodec=mp4v,width=1280,height=720,sfilter=logo}"); mp = libvlc_media_player_new_from_media(m); /* give it a little time to start up */ usleep(1000000); libvlc_media_release (m); /* attach to xwindow */ libvlc_media_player_set_xwindow (mp, video_window_xid); /* start playback */ libvlc_media_player_play (mp); /* wait for it to start playing */ usleep(1000000); while(libvlc_media_player_is_playing(mp)){ /* wait until finished */ libvlc_video_set_logo_string(mp,libvlc_logo_file,"/tmp/overlay.png"); libvlc_video_set_logo_int(mp, libvlc_logo_x, 0); libvlc_video_set_logo_int(mp, libvlc_logo_y, 0); libvlc_video_set_logo_int(mp, libvlc_logo_opacity, 255); libvlc_video_set_logo_int(mp, libvlc_logo_enable, 1); usleep(1000000); } /* terminate the whole thing */ libvlc_media_player_stop (mp); libvlc_media_player_release (mp); libvlc_release (inst);
How do I get this video resized so that my overlay fits the entire video regardless of its original size?

Many thanks in advance!

Jan

Re: [LibVLC in C] Resizing the video before output

Posted: 20 Jan 2017 00:28
by Jean-Baptiste Kempf
Why not resizing the widget then?

Re: [LibVLC in C] Resizing the video before output

Posted: 07 Feb 2017 11:36
by derjanni
Why not resizing the widget then?
Thanks for the notice, I switched to SDL now to be able to draw on top of the VLC rendered image.

Re: [LibVLC in C] Resizing the video before output

Posted: 08 Feb 2017 13:25
by Jean-Baptiste Kempf
Why not resizing the widget then?
Thanks for the notice, I switched to SDL now to be able to draw on top of the VLC rendered image.
Cool.