0

I am trying to merge a video from my camera with a video via URL and show them [pip]. It shows great but the sound is out of sync. my code is

ffmpeg -i input1.mp4 -i urlInput.mp4 -filter_complex "[1]crop=450:230:80:215,scale=iw/1.5:ih/1.5 [pip]; [0][pip] overlay=main_w-overlay_w-10:main_h-overlay_h-300; [1]volume=0.2[vol1]; [0][vol1]amix" -shortest output.mp4

there is nearly a one second delay between url-input(video and audio shows first) and the first input. How can i get them to be synced?

Ittai Oren
  • 53
  • 6
  • Not clear. Is the sync between audio and video of url input lost, or for file input? – Gyan Nov 15 '17 at 13:28
  • The sync between both files. one video+audio input and the other video+audio. second stream is 1 second earlier. – Ittai Oren Nov 15 '17 at 13:49
  • Are they the same scene from different angles? If network latency can't be reduced, you can insert `-itsoffset 1` just before `-i urlInput.mp4` to delay the URL input by 1 second. – Gyan Nov 15 '17 at 13:59
  • it delays also the audio stream. the video is fine but the audio stream moves by 1 sec also – Ittai Oren Nov 15 '17 at 14:14
  • Remove the itsoffset and add `setpts=PTS+1/TB` before the crop. – Gyan Nov 15 '17 at 15:38

0 Answers0