Play audio and video

The easiest way to play audio and video on the Raspberry Pi is to use the pre-installed VLC application;

The VLC program uses hardware acceleration and can play many popular audio and video file formats.

Graphical interface

Select the file to play, right-click, and select "VLC Media Player"

image-20231218194341641

Command line

Note: To play audio or video in the command line, you need to enter the directory where the file is located

Play video

Example: Play Test.mp4 file

Example: After playing Test.mp4 file, exit the application

Example: Play Test.mp4 file in full screen, and exit the application after playing

Example: Play the Test.mp4 file without displaying the VLC graphical interface

Replace the contents of and <video_name>

Example: Video is output through HDMI1

Get a list of all DRM devices on the Raspberry Pi: kmsprint | grep Connector

DRM deviceDescription
HDMI-A-1 connectorRaspberry Pi Zero or Raspberry Pi HDMI output on Model 1, 2, or 3;or HDMI400 output on Raspberry Pi 0 or 4
HDMI-A-2 connectorHDMI400 output on Raspberry Pi 1 or 4
DSI-1 modelRaspberry Pi touch display

Playing audio

Raspberry Pi 5 can only be used normally when connected to an audio device.

The play audio command and play video command only differ in the file name: play Test.mp3 file

Replace the contents of and <video_name>

Example: Output audio through HDMI

Get the Raspberry Pi ALSA device: aplay -L | grep sysdefault

ALSA deviceDescription
System default: CARD=vc4hdmi0HDMI400 output on Raspberry Pi 0 or 4
System default: CARD=vc4hdmi1HDMI400 output on Raspberry Pi 1 or 4