Answers.Body: <ol>
  <li>Try re-encoding the audio with FFmpeg: The AAC audio codec may be causing the issue, so re-encoding the audio could help. Try the following FFmpeg command to convert the audio to a different format (e.g., MP3 or re-encoded AAC):</li>
  </ol>
  <ul>
  <li>ffmpeg -i faulty.mp4 -c:v copy -c:a aac -b:a 192k output.mp4 -</li>
  </ul>
  <p>This will re-encode the audio while copying the video stream as is. If you suspect an issue with the AAC decoder, you could also try re-encoding it to MP3:</p>
  <ul>
  <li><p>ffmpeg -i faulty.mp4 -c:v copy -c:a libmp3lame -b:a 192k output.mp4 -</p>
  <ol start="2">
  <li>Check for corrupted file: It’s possible the file is corrupted, causing playback issues. Try using the -err_detect ignore_err option with FFmpeg to ignore errors during decoding and see if it helps:</li>
  </ol>
  </li>
  <li><p>ffmpeg -err_detect ignore_err -i faulty.mp4 -c:v copy -c:a copy output.mp4 -</p>
  <ol start="3">
  <li>Check the sample rate: The sample rate of 44.1 kHz in the file might be mismatched with your playback software. Try converting it to 48 kHz:</li>
  </ol>
  </li>
  <li><p>ffmpeg -i faulty.mp4 -c:v copy -c:a aac -ar 48000 -b:a 192k output.mp4 -</p>
  <ol start="4">
  <li>Use VLC’s native decoder: VLC might be using a different audio decoder, which could explain why it plays differently. You can test if re-encoding the file outside of VLC solves the issue, or see if updating VLC to the latest version resolves any compatibility issues.</li>
  <li>Try a different player: If FFmpeg and VLC are both having trouble, try using a different player like MPC-HC or PotPlayer to see if the issue persists. This can help narrow down if it’s a software issue or a problem with the file itself.</li>
  <li>Check for damaged frames or packets: You can also try extracting the audio track alone to analyze or repair it:</li>
  </ol>
  </li>
  <li><p>ffmpeg -i faulty.mp4 -vn -acodec copy output_audio.aac -</p>
  </li>
  </ul>
  <p>After extracting the audio, try playing it in a different audio player to see if the issue is specific to the video file.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-11-27T23:10:26.367Z
Answers.LastActivityDate: 2024-11-27T23:10:26.367Z
Answers.UserDisplayName: JMR
Body: <p>The audio of my video file is faulty. I tried both VLC player and CLI <code>ffplay</code>.</p>
  <p>What I'm observing is that the audio is &quot;stuttering&quot; in the sense that it's silent for the most part with cracking noises every few seconds. I'd compare it to sound during fast forwarding or the sound from an old analog radio receiver when adjusting the frequency to switch between different radio stations. It doesn't last for longer than the blink of an eye, then the audio is silent again.</p>
  <p>Here is the output from FFmpeg if that helps:</p>
  <pre class="lang-none prettyprint-override"><code>$ ffmpeg -i faulty.mp4
  ffmpeg version 7.0.2-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2024 the FFmpeg developers
    built with gcc 8 (Debian 8.3.0-6)
    configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
    libavutil      59.  8.100 / 59.  8.100
    libavcodec     61.  3.100 / 61.  3.100
    libavformat    61.  1.100 / 61.  1.100
    libavdevice    61.  1.100 / 61.  1.100
    libavfilter    10.  1.100 / 10.  1.100
    libswscale      8.  1.100 /  8.  1.100
    libswresample   5.  1.100 /  5.  1.100
    libpostproc    58.  1.100 / 58.  1.100
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'faulty.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf59.27.100
    Duration: 02:50:15.25, start: 0.000000, bitrate: 1686 kb/s
    Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 1297 kb/s, 24 fps, 24 tbr, 90k tbn (default)
        Metadata:
          handler_name    : VideoHandler
          vendor_id       : [0][0][0][0]
    Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 381 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
          vendor_id       : [0][0][0][0]
  At least one output file must be specified
  </code></pre>
  <p>I feel like I've encountered this issue before, but I don't remember if I just gave up or if there was a way to resolve it. Maybe the default FFmpeg AAC decoder is incompatible with this particular file? Is VLC using the same decoder? What can I try to fix it?</p>
  
Tags: <ffmpeg><audio><encoding><codec><vlc>
Title: Audio is mostly silent with cracking stuttering noises every few seconds
UserDisplayName: kylex
ThreadText: # Audio is mostly silent with cracking stuttering noises every few seconds
  
  (Asked by: username_0 on 2024-11-26)
  
  The audio of my video file is faulty. I tried both VLC player and CLI `ffplay`.
  
  What I'm observing is that the audio is "stuttering" in the sense that it's silent for the most part with cracking noises every few seconds. I'd compare it to sound during fast forwarding or the sound from an old analog radio receiver when adjusting the frequency to switch between different radio stations. It doesn't last for longer than the blink of an eye, then the audio is silent again.
  
  Here is the output from FFmpeg if that helps:
  
  ```none
  $ ffmpeg -i faulty.mp4
  ffmpeg version 7.0.2-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2024 the FFmpeg developers
    built with gcc 8 (Debian 8.3.0-6)
    configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
    libavutil      59.  8.100 / 59.  8.100
    libavcodec     61.  3.100 / 61.  3.100
    libavformat    61.  1.100 / 61.  1.100
    libavdevice    61.  1.100 / 61.  1.100
    libavfilter    10.  1.100 / 10.  1.100
    libswscale      8.  1.100 /  8.  1.100
    libswresample   5.  1.100 /  5.  1.100
    libpostproc    58.  1.100 / 58.  1.100
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'faulty.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf59.27.100
    Duration: 02:50:15.25, start: 0.000000, bitrate: 1686 kb/s
    Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 1297 kb/s, 24 fps, 24 tbr, 90k tbn (default)
        Metadata:
          handler_name    : VideoHandler
          vendor_id       : [0][0][0][0]
    Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 381 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
          vendor_id       : [0][0][0][0]
  At least one output file must be specified
  
  ```
  
  I feel like I've encountered this issue before, but I don't remember if I just gave up or if there was a way to resolve it. Maybe the default FFmpeg AAC decoder is incompatible with this particular file? Is VLC using the same decoder? What can I try to fix it?
  
  **Tags:** ffmpeg, audio, encoding, codec, vlc
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-11-27. Score: 0
  
  1. Try re-encoding the audio with FFmpeg: The AAC audio codec may be causing the issue, so re-encoding the audio could help. Try the following FFmpeg command to convert the audio to a different format (e.g., MP3 or re-encoded AAC):
  
  * ffmpeg -i faulty.mp4 -c:v copy -c:a aac -b:a 192k output.mp4 -
  
  This will re-encode the audio while copying the video stream as is. If you suspect an issue with the AAC decoder, you could also try re-encoding it to MP3:
  
  * ffmpeg -i faulty.mp4 -c:v copy -c:a libmp3lame -b:a 192k output.mp4 -
  
    2. Check for corrupted file: It’s possible the file is corrupted, causing playback issues. Try using the -err\_detect ignore\_err option with FFmpeg to ignore errors during decoding and see if it helps:
  * ffmpeg -err\_detect ignore\_err -i faulty.mp4 -c:v copy -c:a copy output.mp4 -
  
    3. Check the sample rate: The sample rate of 44.1 kHz in the file might be mismatched with your playback software. Try converting it to 48 kHz:
  * ffmpeg -i faulty.mp4 -c:v copy -c:a aac -ar 48000 -b:a 192k output.mp4 -
  
    4. Use VLC’s native decoder: VLC might be using a different audio decoder, which could explain why it plays differently. You can test if re-encoding the file outside of VLC solves the issue, or see if updating VLC to the latest version resolves any compatibility issues.
    5. Try a different player: If FFmpeg and VLC are both having trouble, try using a different player like MPC-HC or PotPlayer to see if the issue persists. This can help narrow down if it’s a software issue or a problem with the file itself.
    6. Check for damaged frames or packets: You can also try extracting the audio track alone to analyze or repair it:
  * ffmpeg -i faulty.mp4 -vn -acodec copy output\_audio.aac -
  
  After extracting the audio, try playing it in a different audio player to see if the issue is specific to the video file.
  
  
  ---
  
  