V
V
Viktor Suprun2015-05-08 14:06:15
fmpeg
Viktor Suprun, 2015-05-08 14:06:15

How to synchronize streams in FFmpeg?

Given:

  • IP camera JVC VN-H257;
  • Linux based OS
  • fmpeg.

Task:
Combine audio and video stream into one file, because the camera does not mix audio and video itself, and distributes them separately (to different addresses).
Problem:
FFmpeg for some reason opens input streams in turn: opens the first stream, buffers, then opens the second stream, buffers, and only after that it starts to mix them, for this reason, the audio / video series is out of sync within 10- 15 seconds.
Question:
How can I force FFmpeg to open all input streams at the same time, and only after that start muxing? I would like to reduce the desynchronization to a minimum, ± 1s.
Peculiarities:
Because the camera gives audio exclusively in its proprietary µ-Law format mixed with various data, then the audio stream is pulled out from stdin (with the help of a small utility I cut out the excess to get a “normal” µ-Law) + audio is encoded using libfaac during mixing. There may be additional overhead associated with this, and it may also increase desynchronization. But this moment can be omitted.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
monah_tuk, 2015-05-08
@monah_tuk

Try lzone.de/cheat-sheet/ffmpeg with the words "Correcting Time-Shift" and, in general, google on this topic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question