[LibVLC in C] Resizing the video before output

This forum is about all development around libVLC.
derjanni
New Cone
New Cone
Posts: 5
Joined: 14 Jan 2017 22:01

[LibVLC in C] Resizing the video before output

Postby derjanni » 14 Jan 2017 22:14

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

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: [LibVLC in C] Resizing the video before output

Postby Jean-Baptiste Kempf » 20 Jan 2017 00:28

Why not resizing the widget then?
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.

derjanni
New Cone
New Cone
Posts: 5
Joined: 14 Jan 2017 22:01

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

Postby derjanni » 07 Feb 2017 11:36

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.

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: [LibVLC in C] Resizing the video before output

Postby Jean-Baptiste Kempf » 08 Feb 2017 13:25

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.
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.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 16 guests