Answer the question
In order to leave comments, you need to log in
How to fix the audio problem and overwrite the original video?
The final video has no sound at all, and if output.mp4 is replaced with my_video.mp4 , then you get a broken video .
As I understand it, ffmpeg does not put the video in the buffer, but immediately renders it, and therefore it turns out a broken video at the end, i.e. he renders it and immediately writes it down.
How then to process the video my_video.mp4 and immediately save it under the same name ?
import ffmpeg
def watermark(path): # для примера path = 'my_video.mp4'
watermark = ffmpeg.input('watermark.png') # картинка вотермарк
# asyn
(
ffmpeg
.input(
'my_video.mp4',
ss='00:00:00', t='00:00:15',
) # даю путь к исходному видео и обрезаю его первых 15 сек
.overlay(watermark, x=23, y=23) # накладываю вотермарк с отступами 23px
# если убрать .overlay(...), то звук появляется
.output(
'output.mp4',
acodec='copy',
aspect='9:16', # соотношение сторон 9:16 (ширина : высота)
s='hd1080' # разрешение 1080p
)
.global_args('-y') # перезапись полученного видео
.run()
)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question