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.

2 Likes

Daniel,
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

Hey there @daniel

I just bumped into this thread and noticed your concern with ffmpeg and making quicktime movies that weren’t fully compatible with some players. I’ve actually hit this problem from a different world (visual effects python pipelining, not C++ dev work). I’m guessing you figured it out, but if I can help at all let me know, as what you’re describing matches what I had to resolve before.

Cheers

Jeff

1 Like

Thank you, the project morphed into the more elaborate foleys_video_engine.
I am just returning after a break from the project. I managed to write videos that would display properly by NOT setting the AV_CODEC_FLAG_GLOBAL_HEADER (despite of many tips, that this is really needed).

But thanks for the offer, I might be back with questions.

1 Like