I have been working on building a video streamer from a webcam using RTP protocol in C++ language in Linux. I was able to use opencv to take frames from the webcam and send them frame by frame to a client app that shows those frames one by one using the same frame per second parameter.
But that is mostly a MJPEG kind of transfer as the encoding used is JPEG encoding with a specific quality for each frame. However, I would like to use MPEG-4 encoding before transferring the video. After a deep search online I found out that ffmpeg is the best for such purpose. But the samples online mostly work through a command line interface to capture a webcam video and save it as a video file with the given encoding and format.
Is there a possibility to encode the webcam "LIVE", and get byte data while encoding the camera stream?
I would like to use those byte data to transfer it using RTP for example. And then I would like to decode the received byte data and show the video using opencv imshow function for example.