video player built with ffmpeg and SDL2
A lightweight video player built on the SDL2 and ffmpeg libraries. It can play multiple videos simultaneously, all synced to a master clock. In addition, the video playback can be controlled via TCP commands, e.g. "open movie.mp4", "play", "pause", "seekto 350.0", etc. This allows for an easy interface to other applications - Python, Javascript, etc. -- anything that handles basic network sockets.
Originally built with msys2 and the mingw64 gcc compiler on a Windows 10 machine.
msys2 packages:
Here are my compiler options in CodeLite
Everything is crossplatform except the socket programming code, read_from_client() method. The current source code has a winsock2 implementation, for Windows. It would be pretty easy to swap this out with linux socket programming.
If you don't specify a port number, it defaults with 50001, which should be open on most machines.
ffmpeg supports a wide range of codecs and formats, so most videos should load fine.
Hotkey | Command |
---|---|
Down | Seek 10 seconds forward |
Up | Seek 10 seconds backward |
Right | Show next frame |
Left | Seek 0.25 seconds backward |
Space | Toggle play/pause |
Videos can be opened and controlled via tcp commands.
For example in Python, after setting up tcp connection to vidserv.exe,
sock.send("seekto 60.0".encode())
open movie1.mp4 xscreen yscreen width height windowname
seekto x
seek+
seek-
seek+small
seek-small
play
pause
toggleplay
gettime
getnumvideos
getpos movie1.mp4
raisewindows
closewindows
break
For convenience, the bin/ folder contains a compiled vidserv and the required DLL to run on a Windows machine.
dranger's tutorial was immensely helpful for this project. Check out his tutorial if you are new to AV processing.