[FFmpeg-user] hstack with one video offset in time (and keep audio synced)?

Steven Kan steven at kan.org
Thu Mar 18 20:41:56 EET 2021


> On Mar 17, 2021, at 11:57 AM, Michael Koch <astroelectronic at t-online.de> wrote:
> 
> Am 17.03.2021 um 19:31 schrieb Steven Kan:
>>> On Mar 6, 2021, at 11:22 AM, Steven Kan <steven at kan.org> wrote:
>>> 
>>>> On Mar 5, 2021, at 2:00 PM, Michael Koch <astroelectronic at t-online.de> wrote:
>>>> 
>>>> Am 05.03.2021 um 20:33 schrieb Steven Kan:
>>>>>>>> I’d like to assemble these videos, side-by-side, but synced in time, which
>>>>>>>> means the TrailDown video needs to start 50 seconds after the TrailUp
>>>>>>>> video.
>>>> try this command line:
>>>> 
>>>> ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex "[0]tpad=start_duration=50[a];[a][1]hstack” out.mp4
>>> Thank you! That worked perfectly, and now that I understand the syntax, this works as well (to pad the end of the second track by 15 sec:
>>> 
>>> ffmpeg -i Input1.mp4 -i Input2 -filter_complex "[0]tpad=start_duration=50[a];[1]tpad=stop_duration=15[b];[a][b]hstack” Out.mp4
>> More on this!
>> 
>> tpad=start_duration works to delay the start of one video, but now I need to fix the audio sync. For example this command:
>> 
>> ffmpeg -i TrailDown.mp4 -i TrailUp.mp4 -filter_complex "[0]tpad=start_duration=2.5[a];[a][1]hstack" -vcodec libx264 Coyote2Up.mp4
>> 
>> results in this video:
>> 
>> https://www.youtube.com/watch?v=_PDPONEU3YA#t=35s
>> 
>> Only the left half (TrailDown) camera has a microphone, and it’s apparent that the audio sync is off by the same 2.5 seconds that I’ve delayed its video. You can hear the female coyote (with the stumpy tail) scratching the ground 2.5 seconds before she actually does it.
>> 
>> What flag should I add to also delay its audio? Thanks!
> 
> Add the "adelay" filter to the filter chain:
> adelay=2500

Fixed!!!

https://youtu.be/89HAnwZuO9g

Thank you,


More information about the ffmpeg-user mailing list