[FFmpeg-user] Synchronize videos

Thomas Seilund tps at netmaster.dk
Tue Mar 15 23:55:46 CET 2016


Thanks for the tips.

The fact that I only have audio on one of the videos makes i difficult 
to use the concept of reference audio for video synchronization.

What about this?

Before video capture I sync. the devices running ffmpeg.

As all videos are captured using ffmpeg I imagine that I can embed the 
wall clock in the video through some ffmpeg option.

If that is possible then I also imagine that I can extract the wall 
clock from each video and cut the videos so they all cover the same wall 
clock period.

With the adjusted video cuts I can safely create a video that shows 
video from all cameras at the same time, knowing that the video cuts 
cover the same wall clock period.

Would that be a way to synchronize the videos?

What options would you use to embed the wall clock in the video?

How would you extract the wall clock from the videos?

Thanks

Thomas S


On 03/14/2016 10:31 PM, Jannes Faber wrote:
> 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
>>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user



More information about the ffmpeg-user mailing list