[FFmpeg-user] Synchronize videos
Jannes Faber
jannes.faber at gmail.com
Mon Mar 14 22:31:54 CET 2016
I'm very interested in the same thing. One recording from a laptop and one
recording from a crappy handheld camera without NTP. File timestamps easily
multiple seconds out of sync.
One option I've been working on a little bit is using the audio to
automatically sync.
I found this little gem somewhere deeply hidden in the interwebs:
http://www.fon.hum.uva.nl/praat/manual/Sounds__Cross-correlate___.html
http://www.dsg-bielefeld.de/dsg_wp/wp-content/uploads/2014/10/video_syncing_fun.pdf
If I remember correctly from some experiments it was quite reliable. If you
can use rough timestamps of your video files, extract some pieces of audio
from it (say 30 seconds) and then this tool can find the offset fairly well.
cat > "$TEMP2_DIR/corrolate_audio_offset.praat" <<~~~
form Cross Correlate two Sounds
sentence Input_sound_1
sentence Input_sound_2
real start_time 0
real end_time 30
endform
Open long sound file... 'Input_sound_1$'
Extract part: 0, 60, "no"
Extract one channel... 1
sound1 = selected("Sound")
Open long sound file... 'Input_sound_2$'
Extract part: 0, 60, "no"
Extract one channel... 1
sound2 = selected("Sound")
select sound1
plus sound2
Cross-correlate: "peak 0.99", "zero"
offset = Get time of maximum: 0, 0, "Sinc70"
writeInfoLine: 'offset'
~~~
praat corrolate_audio_offset.praat camera_audio_original.wav
laptop_audio_original.wav
Please share if you end up getting this or anything else to work.
--
Jannes
On 14 March 2016 at 18:23, Thomas Seilund <tps at netmaster.dk> wrote:
> Hi,
>
> I have a number of devices. Each with a camera attached. Video from each
> camera is captured to a file. Audio is only captured from one of the
> cameras. Capture is done using ffmpeg.
>
> Once I am done capturing data from the cameras I process the files, again
> using ffmpeg. I create a single video where video from each camera is shown
> at the same time.
>
> My question is how can I make sure that the videos are synced correctly. I
> am not able to start capturing at the same time, so I can not be sure that
> the videos from each camera cover exactly the same period.
>
> Any hints would be very much appreciated.
>
> Thanks
>
> Thomas S
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
More information about the ffmpeg-user
mailing list