Software⏱️ 4 min read📅 2026-06-19

How to Fix: ffmpeg Live Input MP4 Error

FFmpeg issues with live input MP4 error, experimental codec and audio encoding problems.

Quick Answer: Enable experimental codecs by adding `-strict -2` to your ffmpeg command.

The error 'Codec is experimental but experimental codecs are not enabled, see -strict -2' occurs when trying to record video with audio using ffmpeg on CentOS 6.3. This issue affects users who want to utilize experimental audio codecs for real-time applications.

This problem can be frustrating as it prevents the user from achieving their desired output format (mp4) while streaming live content. However, there are potential workarounds and fixes available.

⚠️ Common Causes

  • The issue is likely caused by the experimental nature of the audio codec used in ffmpeg. The -strict -2 option is set to enable experimental codecs, but it may not be compatible with all systems or drivers.
  • Another possible cause could be issues with the ALSA (Advanced Linux Sound Architecture) configuration or driver version on your system.

✅ Best Solutions to Fix It

Enabling Experimental Audio Codecs

  1. Step 1: Open the /etc/ffmpeg.conf file in a text editor and add the following line at the end: '-strict -2'. This will enable experimental codecs for ffmpeg.
  2. Step 2: Restart the ffmpeg service to apply the changes. You can do this by running the command '/usr/bin/ffmpeg -y -f video4linux2 -t 15 -s 640x480 -r 25 -i /dev/video0 /home/irdb/Desktop/out2.mp4' and then stopping the service with '/usr/bin/ffmpeg -y -f video4linux2 -t 15 -s 640x480 -r 25 -i /dev/video0 /home/irdb/Desktop/out2.mp4' followed by '/systemctl stop ffmpeg.service'.
  3. Step 3: Verify that the experimental codec is enabled by running the command '/usr/bin/ffmpeg -version' and checking for the presence of 'experimental' in the output.

Configuring ALSA Settings

  1. Step 1: Open the /etc/asound.conf file in a text editor and add the following line at the end: 'default_device hw:0,0'. This sets the default device to the first available device on your system.
  2. Step 2: Restart the ffmpeg service to apply the changes. You can do this by running the command '/usr/bin/ffmpeg -y -f video4linux2 -t 15 -s 640x480 -r 25 -i /dev/video0 /home/irdb/Desktop/out2.mp4' and then stopping the service with '/usr/bin/ffmpeg -y -f video4linux2 -t 15 -s 640x480 -r 25 -i /dev/video0 /home/irdb/Desktop/out2.mp4' followed by '/systemctl stop ffmpeg.service'.
  3. Step 3: Verify that the ALSA settings have been applied by running the command '/usr/bin/ffmpeg -version' and checking for any errors or warnings in the output.

✨ Wrapping Up

To resolve the issue of ffmpeg not working with audio, you can try enabling experimental audio codecs or configuring your ALSA settings. If neither method works, consider seeking further assistance from a system administrator or IT professional.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions