[FFmpeg-user] Lipsync of a UDP stream

German Geraskin german.geraskin at gmail.com
Tue Feb 28 23:27:07 EET 2023


> > Dear list,
> >
> > New ffmpeg user.
> >
> > I am currently using the following incantation to receive an H.264 stream:
> >
> > ffmpeg -hide_banner -nostats -loglevel panic -async 1 -i
> > udp://192.168.1.60:17001 -vcodec copy -codec:a aac -b:a 128k -f mpegts
> > pipe:1
> >
> > The media server ingesting the stream expects it on stdin, as you can see.
> >
> > The trouble is that audio is about half a second late relative to video,
> > and I'd like to correct that on the way into the media server.
> >
> > Guidance I've found to date on this subject involves feeding the input
> > into ffmpeg twice (i.e. by specifying -i twice with the same input
> > file). But that can't work with a stream, since the stream arrives only
> > once and can therefore also only be read once.
> >
> > Any hints?
> >
> > Many thanks, Jan

You can offset an audio track relative to a video track by adding or
subtracting a fixed value to the timestamps of one of the tracks.
http://ffmpeg.org/ffmpeg-all.html#setpts_002c-asetpts


More information about the ffmpeg-user mailing list