JUCE and FFmpeg

I wanna make an app with JUCE and FFmpeg, and I wonder if JUCE is able to display video image decoded from ffplay.
AFAIK ffplay creates a window of its own to display images, and now I want the video to be displayed within JUCE, by ImageControl, VideoControl or something…
Or, can JUCE embed the play window of 3rd-party video apps, like VLC, mplayer, etc?
Any ideas?

About a year ago I created a wrapper to use ffmpeg with juce, it’s OpenSource on Github: filmstro_ffmpeg.

It creates juce Images, so you can interfere with the images and do your own processing/drawing on top. Also the audio is presented as a AudioSource subclass, so you can pipe the audio into your processing chain.

I hit a wall with the correct usage of FFmpeg, that I couldn’t figure out. It is usable for several codecs, but some of them just don’t play nicely, especially divX AVIs are nasty.
Also writing videos was problematic, the produced videos would play in VLC, but not with Quicktime, Preview and such.
Meanwhile the API in FFmpeg I used is deprecated, I don’t know if just rewriting the decode and encode calls would solve these issues.

I haven’t worked on it because the project was paused and now I moved to a different company.
If you (or anybody reading this) want to dive into FFmpeg, I am happy to team up and get it more complete.

1 Like

FFmpeg does have some issues with muxing/containers that would need to be updated to make the files play in something like Quicktime. I have used ffmpeg libraries a lot with Juce and like your approach of serving up the video as a positionable audio source. Also note that for some image types, the scaling actually takes longer than the decoding (so this also needs to be done on a separate thread). IPP has some functions for scaling that are faster than FFmpeg’s.

Hey Darren,
Great, thanks for the feedback!
Can you tell me a bit more about the muxing issues, is there any more I have to do apart from calling av_write_trailer() when closing the container?

The issues are contained within the FFmpeg source code base itself (avformat, avcodec, etc.). However, recent builds from the head seem to fix many of these issues. I would update your FFmpeg and just try again.

1 Like