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}");
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);
Many thanks in advance!
Jan