Sunday, October 5, 2014

Foscam video capture server with GStreamer-1.0 in C++

This post shows a program that does the same thing that this article does but it does it with GStreamer-1.0.

Most of parts are same to the previous code. FakeFTPServer.hpp and ThreadMessageQueue.hpp are not included here because it is exactly the same.

The FTP thread is almost same except the "#include" directives.

GstThreadMain is the function that recording thread starts from. Since the recorder is changed from VLC to GStreamer, it is modified accordingly. But the main logic hasn't been changed.

I created a new class, MyGstTranscoder. The code is simplified from my previous article.

Note that it has two enum variables, useAudio_ and useClock_. It was to debug the program without audio transcoding and clock overlay. *PS: recoding audio in public places is illegal in most of states; plz compile it with true at your own risk.

The clock overlay has a property, "time-format". It takes same format as the function, std::strftime(), takes.

The configuration now doesn't have any settings for VLC or GStreamer.

The screenshot above shows how to compile and run it.

For more debugging output, you can set an environment variable: export GST_DEBUG=*:3

I copied the video file to MS-Windows7 and played it with VLC. It confirmed that the video codec is H.264 video codec.

One thing I noticed is that the video frame rate is very low. I am not sure if it is due to the H.264 encoder performance or MPEG2 decoder performance. It got better when I assigned more memory, 256MB, to GPU but it is still not good enough.

I ordered a MPEG2 decoder license from Raspberry Pi Store: $3.28 USD. They said the license code will be email within 72 hours. Once I get the license, I will re-test the performance.

1 comment:

  1. I got the MPEG2 license but it doesn't seem to help.


About Me

My photo
Tomorrow may not come, so I want to do my best now.