That’s more to the question. Is there a “proper” way to create an MP4 / H.264 / AAC file?
I wrote some code to inject empty audio frames at the very beginning of the audio stream, which seems to help, but I had to restructure a lot of code to get it there. Am I missing a flag of the stream? the container? Oddly enough, once the audio stream is initially padded, it’s fine. So I can have: - 20 seconds of video - 5 second audio pause, 5 second audio, 5 second pause, 5 second audio The second audio part plays at the proper time, so it just seems like the initial audio padding is just needed. I have similar code on the Mac side using AVFoundation and their encoder seems to push in empty audio packets. - Stephen On Mar 14, 2014, at 11:49 AM, wm4 <[email protected]> wrote: > On Fri, 14 Mar 2014 09:34:31 -0400 > "Stephen H. Gerstacker" <[email protected]> wrote: > >> I’m constructing a video file from pre-encoded packets. Video is H.264, >> Audio is AAC, and the container is MP4. >> >> As an example, I have: >> - 20 seconds of video >> - 10 seconds of audio, starting at 5 seconds in. >> >> I’m checking PTSs and writing with av_write_frame in the proper order. The >> resulting file works great in VLC and QuickTime, but if I open the video in >> Windows Media Player, that audio starts playing immediately. Everything else >> about the audio is fine, it just starts at the wrong time. >> >> Any idea on why this would be happening? Is there a proper way to push audio >> in to a video file that doesn’t start immediately? >> >> I’ve also tried av_interleaved_write_frame, but that didn’t change anything. > > For starters, does windows media player even allow audio to start at a > different time? If so, you could e.g. take a "working" file and compare > it with a ffmpeg produced file. > _______________________________________________ > Libav-user mailing list > [email protected] > http://ffmpeg.org/mailman/listinfo/libav-user _______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
