Page 1 of 1

Stretch video to dimensions of picturebox

Posted: 30 Dec 2009 08:05
by antrikshdigisign
hi
I am making a VLC streaming windows application with c#.NET using LibVLC.
I used a dot net wrapper.
I am projecting VLC's Vedio output to a picture box "pboxScreen"

My problem is that I want to stretch my video to dimensions of picture box.
I want my video to self-adjust and enlarge as to completely fit in the container(picturebox).

How can I do that?

here is the code that I am currently using:-

Code: Select all

IPAddress[] addresslist = Dns.GetHostAddresses(Dns.GetHostName()); vlc = new LibVlc(false, 5); pboxScreen.SizeMode = PictureBoxSizeMode.StretchImage; pboxScreen.Image = Image.FromFile("c:\\testerror.bmp"); vlc.Initialize(); vlc.VideoOutput = pboxScreen; string[] options = { ":sout=#transcode{vcodec=mp4v,vb=1024,scale=1,acodec=mpga,ab=192,channels=2}:duplicate{dst=display,dst=std{access=http,mux=ts,dst=" + addresslist[0].ToString() + ":" + txtPort.Text + "}}" }; vlc.Play();

I tried :-
pboxScreen.SizeMode = PictureBoxSizeMode.StretchImage;
but it didn't work! :(
I am a new to VLC development!
please help!

thank you

sincerely,

Antriksh Mathur

Re: Stretch video to dimensions of picturebox

Posted: 07 Aug 2012 11:37
by Aardvark Soup
My apologies for kicking this old post, but I have the exact same problem and was unable to find a solution anywhere.

Is it actually even possible to stretch a video to fit the window (or to stretch horizontally or vertically at all)?

EDIT: Solved it! It turns out you can simply specify an aspect ratio (libvlc_video_set_aspect_ratio) of "w:h" where w and h respectively are the width and height of your window.