A C program that displays a video file at a specified frame rate in a simple window. The program uses GTK4, FFmpeg and multi-threading to smoothly play the video on-screen.
VideoPlayerDemo480p.mov
- GTK4
- FFmpeg
- pkg-config
- A C compiler
On macOS
All dependencies can be installed on macOS easily through Homebrew, or manually if you prefer (see links above).
- Install Homebrew here.
- Install the 3 libraries with Homebrew.
brew install gtk4
brew install ffmpeg
brew install pkgconf
- macOS already comes with a C compiler installed (clang) so installing one isn't necessary.
gcc $(pkg-config --cflags gtk4 libavformat libavcodec libavutil libswscale) -o VideoPlayer VideoPlayer.c $(pkg-config --libs gtk4 libavformat libavcodec libavutil libswscale)
Note: If dependencies were installed on macOS with Homebrew, pkg-config might throw errors saying it can't find FFmpeg's libraries. If you installed Homebrew with all the default options run this to tell pkg-config where to look. (Or replace with the path to wherever you saved the files.)
export PKG_CONFIG_PATH=/opt/homebrew/opt/ffmpeg/lib/pkgconfig:$PKG_CONFIG_PATH
./VideoPlayer <video filename/path> <frame rate>
Ex: ./VideoPlayer sample.mp4 30
Kevin Schulcz