FFmpeg often outputs silent MP4 files from DVD VOB sources because the default audio codec (AC3) is incompatible with standard MP4 containers or FFmpeg selects the wrong stream index. To fix this, explicitly map the correct audio stream and re-encode it to AAC using the -c:a aac flag. This ensures broad compatibility across all media players and devices.
Understanding the Audio Codec Mismatch
DVD Video discs typically store audio in AC3 (Dolby Digital) format within the VOB container. While AC3 is robust for broadcast and disc playback, many modern MP4 players and web browsers do not support native AC3 decoding inside an MP4 wrapper. When you run a basic conversion command without specifying an audio codec, FFmpeg may attempt to copy the AC3 stream directly into the MP4 file. If the player cannot decode AC3, you will hear silence despite the video playing correctly. It is important to note that while the ISO Base Media File Format supports various codecs, the specific combination of AC3 audio inside an MP4 container is not universally supported by hardware decoders. Therefore, transcoding the audio is usually necessary rather than just copying the stream. The most reliable solution is to convert the AC3 audio to AAC, which is the standard audio codec for MP4 files.Identifying the Correct Stream Index
A common mistake is hardcoding stream indices like0:0 for video and 0:1 for audio. On DVDs, the structure is complex. A single VOB file might contain multiple angles, chapters, or even multiple audio tracks (such as different languages). If your DVD has more than one audio track, assuming the first track is always at index 1 can lead to selecting a silent track or the wrong language entirely.
Before running the conversion, you must inspect the input file to see exactly what streams are available. Use the following command to list all streams:
ffmpeg -i input.vob
Look for lines starting with Stream. You will see entries like Stream #0:0(eng): Video... and Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo.... Note the number after the hash symbol (#). If there are multiple audio streams, they might be listed as #0:1, #0:2, etc. Always verify these indices against your desired output before proceeding. For a deeper understanding of how to detect streams programmatically, you might find How to detect with ffmpeg if the stream has video or audio or both helpful for automating this selection process.
The Robust Conversion Command
Once you have identified the correct stream indices, use explicit mapping flags to ensure FFmpeg processes the right data. Do not rely on implicit behavior. The recommended command structure forces FFmpeg to re-encode the audio to AAC while keeping the video in a compatible format like H.264.ffmpeg -i input.vob -map 0:v:0 -map 0:a:0 -c:v libx264 -c:a aac -b:a 192k output.mp4
Here is a breakdown of why each part is critical:
- -map 0:v:0: Explicitly selects the first video stream from the first input file. Using the specific stream specifier (
:0) is safer than just0:vif multiple video streams exist. - -map 0:a:0: Explicitly selects the first audio stream. Adjust the index if your audio is at position 1 or 2.
- -c:v libx264: Re-encodes the video using the H.264 codec, which is universally supported in MP4 containers.
- -c:a aac: Forces the audio to be re-encoded to AAC. This solves the "no audio" issue caused by unsupported AC3 in MP4.
- -b:a 192k: Sets the audio bitrate to 192 kbps, providing good quality while keeping file sizes reasonable.
0:a:0 to 0:a:1 or higher until you find a track with actual content.
Handling Multiple Audio Tracks
DVDs often contain multiple language options. If you want to preserve all available audio tracks in your MP4, you can map all of them. However, remember that MP4 containers have limits on how many streams they can efficiently handle, and some players may only play the first audio track. To include all audio streams, modify the map command:ffmpeg -i input.vob -map 0:v:0 -map 0:a -c:v libx264 -c:a aac output.mp4
The -map 0:a syntax selects all audio streams from the first input. Be aware that if you have several high-quality audio tracks, the final file size will increase significantly. If you only need a specific language, stick to the explicit -map 0:a:X approach.
For those interested in fine-tuning the audio characteristics further, such as adjusting volume levels during conversion, Adjusting Volume Levels with FFmpeg: A Fade Solution provides additional techniques for audio post-processing.
Troubleshooting Silent Output
If you have followed the steps above and still get no audio, consider these diagnostic checks:- Verify Stream Content: Play the original VOB file in a player like VLC. Does it have audio? If the source is silent, FFmpeg cannot create audio from nothing.
- Check Codec Compatibility: Ensure your FFmpeg build supports AAC encoding. Most official builds do, but custom compiled versions might lack it.
- Container Issues: Try muxing into a Matroska (.mkv) container instead of MP4. If audio plays in MKV but not MP4, the issue is strictly container compatibility, confirming that AAC re-encoding is the correct path.
Frequently Asked Questions
Why does my MP4 have video but no audio?
This usually happens because FFmpeg copied the original AC3 audio stream into the MP4 container, but your media player does not support AC3 inside MP4. Re-encoding the audio to AAC resolves this incompatibility.
Can I copy the audio stream instead of re-encoding?
You can try using -c:a copy, but this often fails for DVD VOB files because AC3 is not widely supported in MP4 containers. Re-encoding to AAC is the safest way to ensure playback on all devices.
How do I know which audio stream index to use?
Run ffmpeg -i input.vob and look for the Audio stream line. The number after the hash symbol (e.g., #0:1) is the index. If the first audio track is silent, try mapping 0:a:1 or 0:a:2.
Does FFmpeg support AC3 in MP4 natively?
While the MP4 specification technically allows AC3, many hardware players and software decoders do not implement this feature. It is best practice to transcode AC3 to AAC for maximum compatibility.
What bitrate should I use for AAC audio?
A bitrate of 128k to 192k is standard for clear speech and music. Use 192k for better quality if file size is not a concern, or 128k to save space.