Missing audio in MP4 videos on Ubuntu 20.04.5 LTS typically stems from missing codecs or incorrect stream mapping. This guide walks you through diagnosing the issue using FFmpeg, verifying audio presence, and installing necessary packages like GStreamer to restore sound playback in your media players.
Verifying Audio Presence with FFmpeg
Before attempting complex fixes, you must determine if the audio track actually exists within the video file. Many users assume a file should have sound, but it may have been encoded without an audio stream during creation. The most reliable way to check this is by using theffmpeg command-line tool, which provides detailed metadata about every stream inside a container.
Open your terminal and run the following command, replacing video.mp4 with the path to your problematic file:
ffprobe -v error -show_entries stream=codec_type,codec_name -of default=noprint_wrappers=1:nokey=1 video.mp4
This command filters the output to show only the codec type and name for each stream. You are looking for a line that says audio. If the output lists only video, the file genuinely lacks an audio track. In this case, no amount of driver tweaking will produce sound. You would need to re-encode the video with audio included. However, if you see both video and audio listed, the problem lies with how Ubuntu is decoding or playing that specific audio stream.
For more advanced manipulation, such as setting subtitle tracks as default, you might find related resources helpful. See How to Always Set Subtitle Track as Default in FFmpeg on Ubuntu 22.04.1 LTS for similar FFmpeg usage patterns.
Installing Missing Codecs
Ubuntu does not ship with all proprietary codecs enabled by default due to licensing restrictions. MP4 files often use H.264 video and AAC or MP3 audio, which require additional libraries to play smoothly. Theubuntu-restricted-extras package is the standard solution for this on Ubuntu 20.04.
To install these essential multimedia components, execute the following commands in your terminal:
sudo apt update
sudo apt install ubuntu-restricted-extras
During the installation, you may be prompted to accept a license agreement (usually for Microsoft fonts). Use the arrow keys to navigate to "Yes" and press Enter. Once installed, restart your computer or simply reopen your media player. This package includes GStreamer plugins that handle a wide variety of audio and video formats, resolving the majority of "no sound" issues caused by missing decoders.
If you are working with audio processing pipelines that require lower-level tools, you might also benefit from understanding how to install auxiliary audio libraries. Check out How to Install Sox for PyTorch Audio: A Step-by-Step Guide for context on managing audio dependencies in Linux environments.
Checking GStreamer Plugins
Even withubuntu-restricted-extras installed, some players rely specifically on GStreamer elements to decode audio. If your player (such as Totem or VLC) still fails to produce sound, verify that the good and bad GStreamer plugins are correctly linked.
Run the following command to list installed GStreamer audio plugins:
gst-inspect-1.0 | grep -i audio
Look for entries like mad (MP3 decoder), lame (MP3 encoder), or aacparse. If critical decoders are missing, reinstall the GStreamer base and good plugins:
sudo apt install gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad
After installation, clear the GStreamer registry cache to ensure the system picks up the new configurations:
rm ~/.cache/gstreamer-1.0/registry.x86_64.bin
Then, log out and log back in, or reboot your system. This forces media players to rebuild their internal plugin lists, often fixing silent playback issues where the player previously cached a failed state.
Testing with Alternative Players
Sometimes the issue is not with the system codecs but with the specific media player application. Totem (the default GNOME Videos player) can occasionally struggle with certain MP4 containers. Switching to VLC Media Player is a quick diagnostic step. Install VLC if you haven't already:sudo apt install vlc
Open your MP4 file in VLC. If sound plays correctly here, the problem was isolated to Totem's configuration or its specific GStreamer backend. You can either continue using VLC or reset Totem's settings by deleting its configuration folder:
rm -rf ~/.local/share/gnome-video-effects/
Note that while troubleshooting multimedia issues, other system services might behave unexpectedly. For instance, cloud storage sync issues can sometimes interfere with file permissions. Review Dropbox Not Automatically Updating on Ubuntu if you suspect file permission conflicts are affecting media access.
Frequently Asked Questions
Why does my video have sound in VLC but not in Totem?
VLC uses its own built-in decoders, whereas Totem relies on the system's GStreamer framework. If GStreamer plugins are misconfigured or missing, Totem will fail to decode the audio stream even if VLC plays it fine. Reinstalling GStreamer plugins usually resolves this discrepancy.Can I convert an MP4 without audio into one with audio?
No, you cannot create audio from nothing. Ifffprobe shows no audio stream, the file lacks sound data entirely. You must obtain a version of the video that includes an audio track or add audio manually using ffmpeg by combining the video with a separate audio file.