Как запустить видео с водяным знаком, когда оно появится?

908
stuzzo

Это мой сценарий:

Я хочу добавить видео с водяными знаками в другое видео, но хочу, чтобы он появлялся при его появлении.

На самом деле я могу отображать видео с водяными знаками и воспроизводить его с самого начала. Если я пытаюсь добавить водяной знак через определенный промежуток времени, он отображается правильно в указанный период, но водяной знак кажется остановленным, потому что он запускается при воспроизведении основного видео.

Это команда, которую я использую:

ffmpeg -y -i big_buck_bunny.mp4 -i alpha.mov -filter_complex "[1: v] fade = out: st = 30: d = 1: alpha = 1 [ov]; [0: v] [ov] оверлей = 10: main_h-overlay_h-10: enable = между (t \, 3 \, 5) [v] "-map" [v] "-map 0: a -c: v libx264 -c: копия out.mp4

Любая помощь будет оценена. Спасибо

2
Добро пожаловать в супер пользователя. Этот вопрос нуждается в небольшом уточнении. В частности, заявления _ «Я хочу, чтобы водяной знак начинался, когда он появляется« _ и _ », он останавливался, потому что он запускался, когда воспроизводилось основное видео.» _ Добро пожаловать и удачи. Twisty Impersonator 9 лет назад 1

1 ответ на вопрос

5
NuTTyX

Use -itsoffset just before the overlayed input with the same ammount of seconds you are using in the start of the filter (3 in your case)

This is maintaining the fade out filter you had, but that filter does not produce any visible results:

ffmpeg -y -i big_buck_bunny.mp4 -itsoffset 3 -i alpha.mov -filter_complex "[1:v] fade=out:st=30:d=1:alpha=1 [ov]; [0:v][ov] overlay=10:main_h-overlay_h-10:enable=between(t\,3\,5) [v]" -map "[v]" -map 0:a -c:v libx264 -c:a copy out.mp4 

This is with 3 inputs (2 overlays and a base) and without that other filter:

ffmpeg -y -i basevideo.mp4 -itsoffset 3 -i overlay1.mp4 -itsoffset 8 -i overlay2.mp4 -filter_complex "[0:v][1:v] overlay=0:0:enable=between(t\,3\,5) [oa]; [oa][2:v] overlay=0:0:enable=between(t\,8\,10) [ob]" -map "[ob]" -map 0:a -c:v libx264 -c:a copy output.mp4 

To keep adding overlayed videos:

  • add -itsoffset **X** -i newinput.mp4 after last input file.
    • Order of input files is important
    • **X** is the time the overlay video will start playing (this will not show the overlay, just start internally the play of the video). Adjust it as neccesary (probably matching the value of **X** in the next step)
  • insert another [**previous_output**][**Y**:v] overlay=0:0:enable=between(t\,**X**\,**Z**) [**new_output**] after last block.
    • **Y** is the Yth input file, starting on 0 (in my example basevideo is 0, overlay1 is 1, overlay2 is 2, etc).
    • **X** is the time the overlay will show up in the output video.
    • **Z** is the time the overlay will hide in the output video.
    • Time is counted as for the start of the basevideo, not the lenght of the overlayed video, so do your calculations on duration: if the overlay video is 2 seconds long, **Z** will be **X** + 2.
  • Adjust the -map "[**XX**] at the end of the command to match the **new_output**, or you will be writing to file the previous step!

NOTE audio is grabbed directly from basevideo. The audios from the other sources are ignored and will not play at all.

Спасибо! Могу ли я спросить вас, как настроить команду, если у меня более одного оверлея? stuzzo 9 лет назад 0
@stuzzo улучшенный ответ NuTTyX 9 лет назад 0
Все чисто! Большое спасибо!!!!!!! stuzzo 9 лет назад 0

Похожие вопросы