[FFmpeg-user] Lipsync of a UDP stream

Jan Ceuleers jan.ceuleers at gmail.com
Wed Mar 1 18:35:29 EET 2023

On 28/02/2023 22:27, German Geraskin wrote:
> 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

Brilliant, thank you.

For the benefit of search engines: my incantation has become:

/usr/bin/ffmpeg -hide_banner -nostats -loglevel panic \
-i udp:// \
-filter_complex "asetpts=PTS-0.3/TB" \
-vcodec copy -codec:a aac -b:a 256k -f mpegts pipe:1

This brings audio forward by 300ms relative to video.

It is audio that needed to be shifted, because one cannot combine a
filter and the copy codec.

Thanks again, Jan

More information about the ffmpeg-user mailing list