Moviepy videos not playing on YouTube

388 views Asked by At

I am trying to upload videos made using moviepy to YouTube but when i finally upload them, i can't play them. The video playback stops at 6 seconds. (e.g. https://www.youtube.com/watch?v=CLSWs63ygH0).

I've tried changing the audio codec from mp3 to acc and i've tried changing the video extensions and codecs. I tried .mp4 (mpeg4 and libx264) and .webm but nothing seems to change :(

The videos are pretty long, i know, but if I make the video using a video editing tool, everything works. I'm not sure what is the difference between making a video using a video editor and moviepy. The thing is that exporting a video with a video editor takes x20 the time that exporting with moviepy takes.

My code:

from moviepy.editor import *
from cairosvg import svg2png
import wget

base_url="/Users/Nicolas/Desktop/Programacion/AUDIOLIBROS/Descarga_Libros/libros/pagina_1/"

filename="a-a-milne_the-red-house-mystery_advanced.mp3"
name=filename.replace("_advanced.mp3", "")


myclip = ImageClip(base_url+f"cover-a-a-milne_the-red-house-mystery-min.png")

audioclip = AudioFileClip(base_url+f"{name}_advanced.mp3").subclip((1,13), None)
myclip.set_duration(5).set_audio(audioclip).write_videofile(base_url+f"{name}_advanced.webm", fps=29.97)

EDIT: The video visibility is know set to "hidden" so you can actually get to the video using the link provided.

1

There are 1 answers

0
dennischege On

According to MoviePy's documentation on creating and exporting video clips(https://zulko.github.io/moviepy/getting_started/videoclips.html), the duration of the clip has to be set manually and on your code, that line myclip.set_duration(5) does exactly that. You have set the duration to 5 seconds. code from the official documentation