Use libVLC to get a pixel array

This forum is about all development around libVLC.
ana
New Cone
New Cone
Posts: 2
Joined: 22 Jan 2014 19:06

Use libVLC to get a pixel array

Postby ana » 22 Jan 2014 19:18

I can't figure out how to make libVLC read a video file and output the current frame to a pixel array. I found an example using SDL and another using SFML, but I don't understand how to make use of them.

I want to extract a frame and copy the data to an array in the form of

Code: Select all

int pixelarray[imagewidth*imageheight*4]
where pixelarray[i*j*4] would be the red int, pixelarray[i*j*4+1] would be green, pixelarray[i*j*4+2] would be blue and pixelarray[i*j*4+3] would be the alpha.

I would like to avoid all non-libvlc code except standard C++98. I guess if it is absolutely required, boost would be ok too.

Where and how can I get this data? And when can I copy it to a local array safely?

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: Use libVLC to get a pixel array

Postby Jean-Baptiste Kempf » 22 Jan 2014 21:55

Use the callbacks.
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.

ana
New Cone
New Cone
Posts: 2
Joined: 22 Jan 2014 19:06

Re: Use libVLC to get a pixel array

Postby ana » 23 Jan 2014 13:19

Use the callbacks.
I realise this. I mean, Where and how can I get this data? And when can I copy it to a local array safely?

I want to know how to remove the non-libvlc specific parts of these examples: https://wiki.videolan.org/LibVLC_SampleCode_SDL/ and http://en.sfml-dev.org/forums/index.php?topic=9386.0 , so that the frame can just be put into a block of memory. I tired to do it and, a hex dump confirmed what I had thought was the pixel array wasn't being updated. So I am hoping someone who knows more about libvlc than I might know how to interface with libvlc and be able to explain it.

RSATom
Big Cone-huna
Big Cone-huna
Posts: 513
Joined: 24 Nov 2011 06:55
Operating System: Windows/Linux/OsX
Location: Russia, Tomsk

Re: Use libVLC to get a pixel array

Postby RSATom » 23 Jan 2014 13:58



Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 37 guests