A simple C application that uses GStreamer to play a video file and overlay real-time FPS (Frames Per Second) on the video window. This project helps monitor video rendering performance and serves as a beginner-friendly example of building GStreamer pipelines in C.
gstreamer-fps-monitor/
├── main.c # C source file containing the pipeline
├── Makefile # For compiling, running, and cleaning
├── sample.mp4 # Sample video file (must be added manually)
└── README.md # Documentation and usage guide
Install the following dependencies before building:
sudo apt update
sudo apt install -y build-essential pkg-config \
libgstreamer1.0-dev gstreamer1.0-plugins-base \
gstreamer1.0-tools gstreamer1.0-libav
Verify GStreamer installation:
gst-launch-1.0 --version
- Plays any video file supported by GStreamer
- Displays real-time FPS overlay
- Easy to compile and run using a Makefile
- Beginner-friendly GStreamer example in C
The application builds this GStreamer pipeline internally:
filesrc → decodebin → fpsdisplaysink → autovideosink
filesrc
: Reads video from diskdecodebin
: Automatically decodes input formatfpsdisplaysink
: Adds FPS overlay to the videoautovideosink
: Displays video in a native window
Make sure to have a file named sample.mp4
in the root folder (or any .mp4
video renamed accordingly).
You can use any short test video.
Use the provided Makefile:
make
This creates an executable called gstreamer_fps_monitor
.
make run
Or manually:
./gstreamer_fps_monitor sample.mp4
make clean
This deletes the binary executable.
- The application supports any video format supported by GStreamer.
- FPS is displayed on the top-left of the video window.
- If the video file is missing or the format is unsupported, the program exits with an error.
make # Compile the program
make run # Run the program with sample.mp4
make clean # Remove the compiled binary