Answers.Body: <p>Right now the only solution I found is a two steps process:</p>
  <p>Extract the mp3 stream:</p>
  <pre><code>$ ffmpeg -i input.avi -c:a copy input.mp3
  </code></pre>
  <p>Combine it back into the original AVI container:</p>
  <pre><code>$ ffmpeg -i input.avi -i input.mp3 -c:v copy -c:a copy -map 0:v:0 -map 1:a:0 output.avi
  </code></pre>
  <p>Leads to:</p>
  <pre><code>% ffprobe -hide_banner -i output.avi
  Input #0, avi, from 'output.avi':
    Metadata:
      encoder         : Lavf58.20.100
    Duration: 01:19:44.96, start: 0.000000, bitrate: 1211 kb/s
      Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 512x408 [SAR 1:1 DAR 64:51], 1071 kb/s, 25 fps, 25 tbr, 25 tbn, 30k tbc
      Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp, 128 kb/s
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-23T14:58:26.143Z
Answers.LastActivityDate: 2020-11-23T14:58:26.143Z
Answers.UserDisplayName: malat
Body: <p>I'd like to fix some old AVI files without re-encoding them. I was hoping ffmpeg would do the job, but for some reason I cannot find the right command to fix the MP3 header.</p>
  <p>Steps:</p>
  <pre><code>% ffprobe  -hide_banner -i input.avi
  [mp3float @ 0x56498fcfa740] Header missing
  Input #0, avi, from 'input.avi':
    Metadata:
      encoder         : Lavf58.20.100
    Duration: 01:19:44.96, start: 0.000000, bitrate: 1211 kb/s
      Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 512x408 [SAR 1:1 DAR 64:51], 1071 kb/s, 25 fps, 25 tbr, 25 tbn, 30k tbc
      Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp, 128 kb/s
  </code></pre>
  <p>If I now try:</p>
  <pre><code>$ ffmpeg -i input.avi -c copy output.avi
  </code></pre>
  <p>This results in:</p>
  <pre><code>% ffprobe  -hide_banner -i output.avi 
  [mp3float @ 0x56369d7ff740] Header missing
  Input #0, avi, from 'output.avi':
    Metadata:
      encoder         : Lavf58.20.100
    Duration: 01:19:44.96, start: 0.000000, bitrate: 1211 kb/s
      Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 512x408 [SAR 1:1 DAR 64:51], 1071 kb/s, 25 fps, 25 tbr, 25 tbn, 30k tbc
      Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp, 128 kb/s
  </code></pre>
  <p>Is there a way to fix this error <code>[mp3float @ 0x56369d7ff740] Header missing</code> using ffmpeg without re-encoding the mp3 file ?</p>
  
Tags: <ffmpeg><ffprobe>
Title: Fix mp3float Header missing without re-encode
UserDisplayName: malat
ThreadText: # Fix mp3float Header missing without re-encode
  
  (Asked by: username_0 on 2020-11-23)
  
  I'd like to fix some old AVI files without re-encoding them. I was hoping ffmpeg would do the job, but for some reason I cannot find the right command to fix the MP3 header.
  
  Steps:
  
  ```
  % ffprobe  -hide_banner -i input.avi
  [mp3float @ 0x56498fcfa740] Header missing
  Input #0, avi, from 'input.avi':
    Metadata:
      encoder         : Lavf58.20.100
    Duration: 01:19:44.96, start: 0.000000, bitrate: 1211 kb/s
      Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 512x408 [SAR 1:1 DAR 64:51], 1071 kb/s, 25 fps, 25 tbr, 25 tbn, 30k tbc
      Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp, 128 kb/s
  
  ```
  
  If I now try:
  
  ```
  $ ffmpeg -i input.avi -c copy output.avi
  
  ```
  
  This results in:
  
  ```
  % ffprobe  -hide_banner -i output.avi 
  [mp3float @ 0x56369d7ff740] Header missing
  Input #0, avi, from 'output.avi':
    Metadata:
      encoder         : Lavf58.20.100
    Duration: 01:19:44.96, start: 0.000000, bitrate: 1211 kb/s
      Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 512x408 [SAR 1:1 DAR 64:51], 1071 kb/s, 25 fps, 25 tbr, 25 tbn, 30k tbc
      Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp, 128 kb/s
  
  ```
  
  Is there a way to fix this error `[mp3float @ 0x56369d7ff740] Header missing` using ffmpeg without re-encoding the mp3 file ?
  
  **Tags:** ffmpeg, ffprobe
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-11-23. Score: 3 | Accepted answer
  
  Right now the only solution I found is a two steps process:
  
  Extract the mp3 stream:
  
  ```
  $ ffmpeg -i input.avi -c:a copy input.mp3
  
  ```
  
  Combine it back into the original AVI container:
  
  ```
  $ ffmpeg -i input.avi -i input.mp3 -c:v copy -c:a copy -map 0:v:0 -map 1:a:0 output.avi
  
  ```
  
  Leads to:
  
  ```
  % ffprobe -hide_banner -i output.avi
  Input #0, avi, from 'output.avi':
    Metadata:
      encoder         : Lavf58.20.100
    Duration: 01:19:44.96, start: 0.000000, bitrate: 1211 kb/s
      Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 512x408 [SAR 1:1 DAR 64:51], 1071 kb/s, 25 fps, 25 tbr, 25 tbn, 30k tbc
      Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp, 128 kb/s
  
  ```
  
  
  ---
  
  