Video player component using ffmpeg?

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
stefan__o
Knows some wx things
Knows some wx things
Posts: 32
Joined: Mon Aug 04, 2014 12:55 am

Video player component using ffmpeg?

Post by stefan__o » Sun Feb 17, 2019 10:58 pm

Hey,
I'm looking for a way to load video inside a wxWidget application. The format support should be platform independent (not using DirectShow, GStreamer, QuickTime etc.) and it should be possible to access and manipulate the pixel data.
My idea is using the ffmpeg libraries for video decoding, but what is the best way to display video (scaling should also be possible)? I do not need maximum performance like 4k120p or high-end scalers, but it should be easily possible to play normal FullHD video on standard hardware.

I looked around and couldn't find anything, has anybody already done something like that?

Best regards,
Stefan

New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 307
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: Video player component using ffmpeg?

Post by New Pagodi » Mon Feb 18, 2019 2:50 am

This is a wrapper around FFMpeg that sounds like it does what you want.

User avatar
doublemax
Moderator
Moderator
Posts: 14044
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Video player component using ffmpeg?

Post by doublemax » Mon Feb 18, 2019 6:07 am

You could also try wxVLC:
viewtopic.php?f=20&t=44697&p=185130
Use the source, Luke!

stefan__o
Knows some wx things
Knows some wx things
Posts: 32
Joined: Mon Aug 04, 2014 12:55 am

Re: Video player component using ffmpeg?

Post by stefan__o » Mon Feb 18, 2019 9:45 am

Thanks for your fast answers!
New Pagodi wrote:This is a wrapper around FFMpeg that sounds like it does what you want.
I know that project, but I don't see any connection to wxWidgets or am I missing something? I'm looking for a connection between ffmpeg and wxWidgets
doublemax wrote:You could also try wxVLC:
viewtopic.php?f=20&t=44697&p=185130
That seems to be more what I'm looking for, I thought VLC was not option after they switched to Qt. Question is if I can access the video data, I need more that just a wrapper that allows me to include the VLC player in my application. Also I would prefer ffmpeg based on the simple fact is much smaller to build.

Best regards
Stefan

User avatar
doublemax
Moderator
Moderator
Posts: 14044
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Video player component using ffmpeg?

Post by doublemax » Mon Feb 18, 2019 9:54 am

That seems to be more what I'm looking for, I thought VLC was not option after they switched to Qt.
Qt is only used for the GUI. The component uses libvlc which has a plain C interface.
Question is if I can access the video data, I need more that just a wrapper that allows me to include the VLC player in my application.
The wxVLC component probably doesn't expose all libvlc functions, but in libvlc you can install callbacks that are called for each frame with the frame data in RGB.
Use the source, Luke!

stefan__o
Knows some wx things
Knows some wx things
Posts: 32
Joined: Mon Aug 04, 2014 12:55 am

Re: Video player component using ffmpeg?

Post by stefan__o » Wed Feb 20, 2019 4:53 pm

I had a look a libvlc, but it doesn't seem to expose all the internals I need to access compared to the ffmpeg api.
Is there a simple way to display video (decoded data from some buffer) using wxWidgets efficiently? Or do I need some other library like SDL for that?

User avatar
doublemax
Moderator
Moderator
Posts: 14044
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Video player component using ffmpeg?

Post by doublemax » Wed Feb 20, 2019 5:25 pm

Is there a simple way to display video (decoded data from some buffer) using wxWidgets efficiently? Or do I need some other library like SDL for that?
The only information libvlc gets from wxWidgets in wxVLC is a window handle. If you can find a way to let ffmpeg render into a window given by a window handle, that should be enough.
Use the source, Luke!

stefan__o
Knows some wx things
Knows some wx things
Posts: 32
Joined: Mon Aug 04, 2014 12:55 am

Re: Video player component using ffmpeg?

Post by stefan__o » Wed Feb 20, 2019 9:27 pm

As far as I understand the ffmpeg api, what I get is a buffer with a decoded image and metainformation (width, height, pixel format, timestamp...)
The functions from the API do not display any video. What I would need is something I could que buffers in and that displays it according to the timestamps.

User avatar
doublemax
Moderator
Moderator
Posts: 14044
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Video player component using ffmpeg?

Post by doublemax » Wed Feb 20, 2019 10:51 pm

What I would need is something I could que buffers in and that displays it according to the timestamps.
There is nothing like that in wxWidgets.

Just out of curiosity: What features that you need are missing in libvlc?
Use the source, Luke!

stefan__o
Knows some wx things
Knows some wx things
Posts: 32
Joined: Mon Aug 04, 2014 12:55 am

Re: Video player component using ffmpeg?

Post by stefan__o » Wed Feb 20, 2019 11:29 pm

doublemax wrote:
Wed Feb 20, 2019 10:51 pm
There is nothing like that in wxWidgets.
I already assumed that, because I found a lot of posts of people having trouble combining wxWidgets and SDL...
doublemax wrote:
Wed Feb 20, 2019 10:51 pm
Just out of curiosity: What features that you need are missing in libvlc?
I need to able to access the raw frame data, which seems to possible but complicated, but I also need to access the exact timestamp of each frame and be able to control what frame is shown precisely, not just play/pause, but show next frame, show previous, goto frame 1234 etc. This is possible with ffmpeg, although not for all formats perfectly and requires some additional steps (like scanning the entire file at the beginning, the project previously linked is able to do exactly that). libvlc seems to be lacking this features.

User avatar
doublemax
Moderator
Moderator
Posts: 14044
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Video player component using ffmpeg?

Post by doublemax » Thu Feb 21, 2019 12:10 am

This sound more like the requirements for a video editor. So, is high performance, hardware accelerated output a necessity? If not, you could just take the frame data, convert it to a bitmap and display it.

Last year someone needed to display a video stream from a camera on a Raspberry and i hacked together some code that could display a 640x480 bitmap at 1300 fps on a fast PC using OpenGL.

viewtopic.php?p=183279#p183279
Use the source, Luke!

stefan__o
Knows some wx things
Knows some wx things
Posts: 32
Joined: Mon Aug 04, 2014 12:55 am

Re: Video player component using ffmpeg?

Post by stefan__o » Thu Feb 21, 2019 1:06 am

doublemax wrote:
Thu Feb 21, 2019 12:10 am
This sound more like the requirements for a video editor. So, is high performance, hardware accelerated output a necessity? If not, you could just take the frame data, convert it to a bitmap and display it.
Not a video editor, because no video export is needed, but actually video analysis. High performance is not needed, but normal non-jerky playback of 1080p30 should be easily possible (with resize to the panel).
doublemax wrote:
Thu Feb 21, 2019 12:10 am
Last year someone needed to display a video stream from a camera on a Raspberry and i hacked together some code that could display a 640x480 bitmap at 1300 fps on a fast PC using OpenGL.
That looks very interesting and 1300fps is way more than I need.

Post Reply