Manually fixing malformed AAC bitstreams
Recently while running
youtube-dl on Windows,
ffmpeg wasn’t found in
%PATH%, so it was unable to automatically fix the AAC bitstream. The file will play fine, but in the interest of completeness I still wanted this to be applied to my new files.
Not wanting to alter my path variable for a one-off fix, I investigated the source code a little and found the
FFmpegFixupM3u8PP function here.
With that, you can now run:
ffmpeg -i "input_file.mp4" -c copy -f mp4 -bsf:a aac_adtstoasc "output_file.mp4"
And you’re done.