How to encode a video with timestamps in order to have audio/video sync

2

DISCLAIMER: I am unfortunately very new to codecs and using FFMPEG, so I apologize for any incorrect terminology or if this is in actuality a very easily resolved question.

I have a sequence of jpeg images and a sequence of mp3 frames where each has an associated timestamp.

By assuming a constant framerate which could be found from the number of images / duration of video, I have been able to assemble an AVI out of the jpeg images and a wav out of the mp3 frames (after some tomfoolery with FFMPEG). These can then be combined in a straightforward manner to create an avi container with sound and video.

Most of the time, the assumption that the framerate is constant is correct and produces a product where the audio and video is synced. However,there are times where the framerate was drastically reduced when the streams were originally recorded, which results in the final video being completely out of sync.

As I have the timestamps, I feel there must be a straightforward way to encode the video where each jpg frame is named its timestamp. However, my searches into encoding variable rate videos have yielded two solutions. The first requires using a codec like MJPEG that accepts variable rate encoding using a custom script (didn't look too simple as I am not a pro at FFMPEG). The other required repeating image frames in order to maintain a constant framerate.

What do you guys suggest I do?

sashu2012

Posted 2013-05-29T20:07:56.533

Reputation: 21

What command are you using to combine the audio and video? – OrangeDog – 2014-06-04T16:48:30.567

No answers