I'm trying to trim and copy a video using the -c copy
option of ffmpeg
. Unfortunately the resulting MPEG-4 file appears to have audio and video unsynchronized, with the audio delayed by approximately 1 second.
The syntax of ffmpeg
can be arcane, but one way to solve the problem is to open the input stream twice, one for audio, one for video, and use different starting times. Here's one example that compensates for a 1-second audio delay:
ffmpeg \
-ss 0:00:29.5 -i input.ts \
-ss 0:00:30.5 -i input.ts \
-map 0:v -map 1:a -c copy -to 1:32:14 output.mp4
It worked for me so I am recording this solution here for posterity, just in case I need it again.