How to Fix: ffmpeg Live Input MP4 Error
FFmpeg issues with live input MP4 error, experimental codec and audio encoding problems.
📋 Table of Contents
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
- 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.
- 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'.
- 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
- 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.
- 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'.
- 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.
❓ Frequently Asked Questions
🛠️ Related Fixes
How to Fix: Pc crashes shortly after launching game (rainbow
Fix Pc crashes shortly after launching game (rainbow six siege). Compl
How to Fix: Installing an APK on a locked down phone
Installing an APK on a locked down phone: Try using a rooted device, e
How to Fix: New PC build- no signal and no clue
Fix New PC build- no signal and no clue. Complete troubleshooting guid