Overview
ffplay is a minimalistic multimedia player built on the FFmpeg libraries and SDL (Simple DirectMedia Layer). It provides a simple way to play audio and video files with minimal overhead.
ffplay is described as a “simple media player based on the FFmpeg libraries” and was first released in 2003.
Basic Syntax
Playback Options
Input file or URL to playExamples:
video.mp4, http://example.com/stream.m3u8, rtsp://camera.local/streamForce input formatExample:
-f mp4Force decoder for specific stream typeVariants:
-vcodec- Video codec-acodec- Audio codec-scodec- Subtitle codec
Display Options
Force displayed widthDefault: 640
Force displayed heightDefault: 480
Start in fullscreen mode
Disable audio
Disable video
Disable subtitles
Seek to specified position at startExample:
-ss 00:01:30Play duration in secondsExample:
-t 60Disable graphical display (audio only)
Borderless window
Window always on top
Audio/Video Sync
Set A/V sync typeValues:
audio- Sync to audio clock (default)video- Sync to video clockext- Sync to external clock
Exit when playback finishes
Exit on any key press
Exit on any mouse button press
Advanced Playback
Set number of times to loop playbackDefault: 1 (loop indefinitely: 0)
Drop video frames if behindDefault: Enabled for non-reference frames
Enable infinite buffer (for realtime streams)
Set window titleDefault: Input filename
Set initial show modeValues:
0,video- Show video1,waves- Show audio waves2,rdft- Show audio frequency band using RDFT
Filter Options
Video filtersExample:
-vf "scale=1280:720"Audio filtersExample:
-af "volume=0.5"Hardware Acceleration
Use hardware acceleration methodExamples:
vaapi, cuda, qsv, videotoolboxEnable Vulkan renderer
Keyboard Shortcuts
ffplay supports numerous keyboard shortcuts for controlling playback:Playback Control
Playback Control
- q, ESC - Quit
- Space, p - Pause/Resume
- m - Mute/Unmute
- 9, 0 - Decrease/Increase volume
- **/, *** - Decrease/Increase volume (numpad)
Seeking
Seeking
- Left arrow - Seek backward 10 seconds
- Right arrow - Seek forward 10 seconds
- Down arrow - Seek backward 1 minute
- Up arrow - Seek forward 1 minute
- Page Down - Seek to previous chapter
- Page Up - Seek to next chapter
- Mouse click - Seek to percentage in file (relative to window width)
Display Modes
Display Modes
- f - Toggle fullscreen
- w - Cycle video display modes (video/waves/rdft)
- s - Step to next frame (pause if playing)
- t - Cycle subtitle display
- c - Cycle program/channel
- v - Cycle video streams
- a - Cycle audio streams
Debug & Info
Debug & Info
- i - Toggle stats display
- d - Cycle through deinterlacing modes
Real-World Examples
Play a Video File
Play Audio Only
Play with Volume Adjustment
Play in Fullscreen
Play and Auto-Exit
Play from Network Stream
Play with Specific Start Time
Loop Video Indefinitely
Display Audio Waveform
Display Audio Spectrum
Play with Custom Window Size
Play Scaled Video
Test Pattern (No Input File)
Visualize Audio Input
Performance Considerations
Low Latency
Use
-fflags nobuffer -flags low_delay for minimal latency in live streamsFrame Dropping
Disable with
-framedrop 0 for smooth playback on capable hardwareBuffer Size
Use
-infbuf for infinite buffering on unstable network streamsThreading
Use
-threads to control decoder thread countDisplay Modes
ffplay supports three display modes (cycle withw key):
- Video Mode
- Waves Mode
- RDFT Mode
Standard video display - shows video frames as they are decoded
Source Code Reference
Key implementation details from the source code:- Program Birth Year: 2003 (
fftools/ffplay.c:63) - SDL Integration: Uses SDL2 for rendering (
fftools/ffplay.c:55) - Queue Sizes: Max queue size is 15MB (
fftools/ffplay.c:65) - Sync Thresholds: AV sync threshold between 0.04 and 0.1 (
fftools/ffplay.c:79-81) - Volume Step: 0.75 dB per volume change (
fftools/ffplay.c:76)
Troubleshooting
Video stuttering or dropping frames
Video stuttering or dropping frames
Try disabling frame dropping:
ffplay -framedrop 0 video.mp4Or use hardware acceleration: ffplay -hwaccel auto video.mp4Audio/video out of sync
Audio/video out of sync
Explicitly set sync method:
ffplay -sync audio video.mp4High CPU usage
High CPU usage
Enable hardware acceleration:
ffplay -hwaccel cuda video.mp4Buffering issues with network streams
Buffering issues with network streams
Use infinite buffer:
ffplay -infbuf http://stream.urlSee Also
- FFmpeg - Universal media converter
- FFprobe - Media analysis tool
- Additional Tools - Other utilities