Page 1 of 1

What is the best way to do video incrustation...

Posted: 30 Mar 2014 13:31
by wcoder
Hi from Vincennes,

I'm a windows developper that migrate progressively to linux thanks to Win8.1...

I wrote for fun under window a mkv\dvb-t player base on DShow\Dx9Ex ffdshow ali media splitter - A very old screenshot : http://jjz3zjfxh3.1fichier.com/
I use a custom presenter to render video on texture (anim on screenshoot), add a dark mirror effect (2 triangles) and display thumb (3d mesh) over it (from SQLite db and external jpeg texture)... I use NV12 texture to ensure hardware acceleration of video using a sample pool... It's work under window and on final version cpu usage is near 20% (release) ...

Now i try to rewrite the same thing under linux, i test GStream the natural twin of DShow under linux, it's not very efficient... Last month i see an ADS of 01.net about VLC ^_^, i install libvlc, made a small test performance it perfect, i test the SDL 2 sample with a render greater than 1024x576 cpu is overload and video it explose green block (i suppose writing to texture uncompressed frame is like under windows...a disaster)... an other methode seems to do that using video filter...

My question is : what is the best way to re-write my player with VLC under linux without overkill cpu usage...

Thanks for your help

Note : I write using C\C++, SDL\Boost using netbean under debian jessie 32bits

Re: What is the best way to do video incrustation...

Posted: 30 Mar 2014 19:05
by RĂ©mi Denis-Courmont
Read the documentation. Use libvlc_media_player_set_xwindow().

Re: What is the best way to do video incrustation...

Posted: 30 Mar 2014 21:07
by wcoder
This function seems to specify rendering window like in Directshow when rendering video on a specific HWND :
"Set an X Window System drawable where the media player should render its video output"
"The specified identifier must correspond to an existing Input/Output class X11 window"

I don't see the relation between drawing the video on a Window (Xserver) and video incrustation like my screen shoot ?

I need to draw 3D objects over the video with alpha...

So i need to use the video has background on SDL or OpenGl (or draw 3D object over video front or back buffer), but if i draw SDL or OpenGL on this Window and redirect vlc on it too... I suppose that the result will be a blink between 3D and video, but not what i expect...

Could you give me more information please ?

Thanks,

WCoder

Re: What is the best way to do video incrustation...

Posted: 31 Mar 2014 05:35
by RSATom
use vmem to render video frame to memory and then upload it to texture.
Btw, don't you think about using qt quick 2 ?

Re: What is the best way to do video incrustation...

Posted: 31 Mar 2014 09:25
by wcoder
I will test it this night...

I don't plan to use QT or other GUI toolkit, my goal is to made a direct integration with DirectFB, to work on low cost arm device... For the moment, i made my dev on an old x86 laptop (7 years)... If it work i'll plan to continue on Dual core Arm like G-Box MX2 or clone (hardware acceleration seems to be available on this platform)...

Thanks for your help,

WCoder

Re: What is the best way to do video incrustation...

Posted: 31 Mar 2014 10:11
by RSATom
"low cost" - do you mean "without hardware acceleration"?

I should explain why I asked. I've developed library for integrating libvlc to Qt Quick 2. One of my goal is to try to use it on mobile devices via Qt Mobile.
It will be great if someone else try the same and share opinion.

Re: What is the best way to do video incrustation...

Posted: 31 Mar 2014 16:03
by wcoder
Low cost media center for me it's "70-110 $" (without remote) with hardware acceleration, because in my case the majority of function do not required a lot of cpu (mail,internet...), the only high cpu function is video\audio decoding and GUI...

Note : I known that XBMC already exist, but to learn and test design a real experience is better...