Small gap in audio when encoding MP4 video

I’ve made a video/audio loop but when I encode it in Handbrake, as an MP4, there’s a very small gap (less than 1 frame) in the audio, right at the start. Not obvious until you play the file on a loop.

Screen grab shows H264 encoding at the top and MP4 encoding underneath.

MP4_Audio_Gap

Encodes fine using Quicktime H264, but the file size is too big. I’m creating a pack of looped videos so I need to keep the file sizes down.

Anyone had the same problem?

MP3/4 encoding introduces a short silence in the start of the file, making it unsuitable for seamless looping. Therefore WAV-format is most commonly used. I know there are alternatives that will work for looping and still compress the file, like Ogg Vorbis ( https://en.m.wikipedia.org/wiki/Vorbis ), but I dont have any experience with that myself.

Useful to know, thanks!

I’ll look into the Ogg container format.