AAC stream in MP4 file has wrong duration. How to fix? I've got an MP4 file that is actually 2:09:42 long. But when playing it in VLC player it is being shown as 7:13:45 long. I'm trying to fix this file.

I remuxed it using ffmpeg -i input.mp4 -codec copy output.mp4 which did not change anything.

ffprobe reports:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2012-12-12T09:35:27.000000Z
  Duration: 07:13:45.09, start: 0.000000, bitrate: 578 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x800
[SAR 1:1 DAR 12:5], 1618 kb/s, 23.98 fps, 23.98 tbr, 96k tbn, 47.95 tbc (default
)
    Metadata:
      creation_time   : 2012-12-12T09:35:27.000000Z
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, flt
p, 92 kb/s (default)
    Metadata:
      creation_time   : 2012-12-12T09:36:27.000000Z
      handler_name    : GPAC ISO Audio Handler


I demuxed the file and tried to recombine the streams. Here, this is shown:

Input #0, h264, from 'x.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x800 [SAR 1:1 DAR
 12:5], 23.98 fps, 23.98 tbr, 1200k tbn, 47.95 tbc
[aac @ 000000000328a8c0] Estimating duration from bitrate, this may be inaccurat
e
Input #1, aac, from 'x.aac':
  Duration: 07:14:19.51, bitrate: 94 kb/s
    Stream #1:0: Audio: aac (LC), 48000 Hz, stereo, fltp, 94 kb/s
Output #0, mp4, to 'x.mp4':
  Metadata:
    encoder         : Lavf58.38.101
    Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1
920x800 [SAR 1:1 DAR 12:5], q=2-31, 23.98 fps, 23.98 tbr, 1200k tbn, 1200k tbc
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 94
 kb/s
Stream mapping:
  Stream #0:0 -&gt; #0:0 (copy)
  Stream #1:0 -&gt; #0:1 (copy)


Here, the wrong duration is shown for the aac stream. Does this mean that the aac stream has wrong time information?

When I play the aac file VLC player shows 7 hours duration. When I play the h264 file no duration is shown.

I then tried to remux specifying -t 2:09:42. This makes VLC player display the correct duration. The movie plays normally and appears complete. But the file size dropped from 1.8 GB to 1.6 GB which makes me suspect that I somehow lost data.

How can I fix this file?

Update: I have now recoded the aac stream to MP3. It really is 7 hours long. The audio is repeated multiple times. No idea why. So I guess I can just trim that stream? Is that appropriate?
How do you know file is 2:09:42 long?

From ffmpeg documention:


  Get duration by decoding
  You can also use ffmpeg to get the duration by fully decoding the file. The null muxer is used so no output file is created. Refer to time= in the last line of the console output. In this example the input has a duration of 00:57:28.87. 


$ ffmpeg -i input.webm -f null -
...
frame=206723 fps=1390 q=-0.0 Lsize=N/A time=00:57:28.87 bitrate=N/A speed=23.2x



  
  This method will report the correct duration in case the methods using ffprobe are incorrect or missing due to corrupt, truncated, or damaged files. 
  The command may take some time depending on the input file duration and decoding complexity. 
  


So it seems that your file timings are "incorrect or missing due to corrupt, truncated, or damaged files."
Hence your ffprobe report contains wrong duration.
Your remux "did not change anything" because you did not encode the file: -codec copy

2nd line of your report shows: "Duration: N/A, bitrate: N/A" which is another indication of damaged file.
Further in the report, you'll notice "Estimating duration from bitrate, this may be inaccurate"

Try this:

ffmpeg -i input.mp4 -c:v libx264 x.mp4


With a very good computer, this should be done in about 2 hrs. 
Enjoy.