• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

audio

FFMPEG Offset Audio

June 19, 2020

If your audio is out of sync, you can fix using ffmpeg.

ffmpeg -i source.mp4 \
-i livestream.mp4 \
-map 0:0 -map 1:1 \
-acodec copy \
-vcodec copy \
-itsoffset 0.100 \
output.mp4

ffmpeg -i source.mp4 \ -i livestream.mp4 \ -map 0:0 -map 1:1 \ -acodec copy \ -vcodec copy \ -itsoffset 0.100 \ output.mp4

The ffmpeg fix is fast. A 1GB file took less than 30 seconds to run. Adjust -tsoffset until you find the sweet spot.

Filed Under: Linux Tagged With: audio, ffmpeg, offset, sync, video

FFMPEG Fix Audio Sync

June 14, 2020

If you have a video with audio sync issues, you can easily fix it using ffmpeg. It takes 2 inputs: the filename and delay: 0.100 is 100 ms or 0.1 seconds. Output file has -fixed appended to it. It’s fast. Only takes 2-3 seconds to process a 1.5 hour recording.

Here’s the script.

ffmpeg -i livestream.mp4 \
-itsoffset 0.100 \
-i livestream.mp4 \
-map 0:0 -map 1:1 \
-acodec copy \
-vcodec copy \
livestream-fixed.mp4

ffmpeg -i livestream.mp4 \ -itsoffset 0.100 \ -i livestream.mp4 \ -map 0:0 -map 1:1 \ -acodec copy \ -vcodec copy \ livestream-fixed.mp4

Filed Under: Linux Tagged With: audio, delay, ffmpeg, fix, sync

  • Home
  • About
  • Archives

Copyright © 2023