Switch Audio Streams During Playback in FFplay
When playing media files or live streams with multiple audio tracks in FFplay, you can easily switch between them on the fly. This article explains the keyboard shortcuts and command-line options required to toggle between different audio streams during live playback, helping you manage multi-language tracks or commentary channels seamlessly.
Keyboard Shortcut to Toggle Audio Streams
The easiest way to switch audio streams while FFplay is running is by using a simple keyboard shortcut:
- Press the
akey on your keyboard.
Every time you press a, FFplay will
cycle to the next available audio stream in the current program. If
there are three audio streams, pressing a will loop through
stream 1, stream 2, stream 3, and then back to stream 1.
Selecting a Specific Audio Stream on Startup
If you want to open a file and immediately start playing a specific
audio stream instead of the default one, you can specify this in your
command line using the -ast (audio stream) option.
FFplay indexes streams starting from 0. To select a
specific stream, use the following syntax:
ffplay -ast [stream_index] input_fileFor example, to start playback using the second audio stream (index 1):
ffplay -ast 1 movie.mkvCycling Through Programs (For TS and Live Broadcasts)
In some broadcast streams, such as MPEG-TS files, multiple audio and
video streams are grouped into “programs.” If pressing a
does not give you the desired track, you may need to switch the active
program first:
- Press the
pkey to cycle through the available programs.
Once you are on the correct program, you can use the
a key again to toggle the audio streams
assigned to that specific program.