End-of-degree Project — Class Recorder — Blog #3 — Creating a basic ffmpeg wrapper to record classes | Youtube Uploader.
In the next blogs we will focus on the development of the application that will be used by teachers, Class Recorder Teacher PC.
In the beginning I thought about using a library for ffmpeg, but I was not satisfied with this one… so, why don’t create my own wrapper with my own purposes? So, i decided to do it.
The wrapper has this classes structure:
The ICommand interface has the necessary methods to do everything we need. Classes implementing ICommand was created with the idea of having different implementations for each Operating System, because commands can change a bit between differents OS.
The class FfmpegWrapper has the purpose of control and manage this commands. If we want to use an ffmpeg command to record screen for example, we can create an instance of FfmpegWrapper, set some configurations like video format, audio format, framerate, etc… and call the method we want.
Capture Screen and Audio is as easy as write this lines of code:
As we can see, we can define video format, audio format, the directory…
And, yes… maybe our FfmpegWrapper is very limited, it can be used only for screen captures, to cut videos, to merge video and audio… BUT it has no dependencies with our project, and it can be used like a little library or be treated like a little piece of reusable code.
I did the same with the classes related with uploading a video to youtube. We just need this lines of code to upload a video:
By this way and with this two independent modules, we could see our Class Recorder Teacher PC with SpringBoot in this way
In there we can see that both modules (YoutubeUploader & FfmpegWrapper) will be used as services by Controllers and WebSockets in our Application.
Look at the part of websockets, because in the next blog we will talk about the protocol I’ve created to comunicate with PC and Mobile the process of recording.
Link to the project: https://github.com/cruizba/class-recorder