I am trying to write Python code which will call ffmpeg via subprocess package and generate a video (.mp4) which was created by inserting multiple audio clips (.wav) at different time points.
temporary_output_path = "./output_0.mp4"
command_line = [
"ffmpeg", "-y", "-i", "./Output.mp4", "-i", first_video_output_path,
"-map", "0:0", "-map", "1:0", "-c:v", "copy", "-preset", "ultrafast", "-async", "1", temporary_output_path
]
subprocess.run(command_line)
cnt = 0
for k, v in audio_time_dict.items():
command_line = [
"ffmpeg", "-y", "-i", "output_"+str(cnt) +".mp4", "-i", k,
"-filter_complex", f"[1:a] adelay={v}|{v} [tmp];[0:a][tmp] amix=inputs=2,volume=3[audio_out]",
"-map", "0:v", "-map", "[audio_out]", "output_" + str(cnt+1) + ".mp4"
]
subprocess.run(command_line)
cnt +=1
The video is generated successfully, and it can be played via VLC player, but when I try to insert it into HTML tag, as follows:
<div className="row">
<div className="col-12">
<div
className="tour__content"
data-aos="fade-up"
data-aos-duration="600">
<video muted loop autoPlay controls>
<source src="/images/video/demo.mp4" type="video/mp4" />
</video>
</div>
</div>
</div>
I get the following error:
What exactly am I doing wrong? What could be the reason why the video is NOT supported?