-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"KeyError: 'video_fps'" when trying to convert youtube webm to mp3 #899
Comments
I have the same issue. But im trying to convert mp4(only audio) to mp3 |
@adhoc92 provide the full path --> |
@adalbertopc I have the same issue, I am trying to convert an audio-only mp4 to mp3. Were you ever able to solve your problem? |
Linking #869 |
@utkarshmttl it's a bit of a hack, but you could go to |
have you tried this @utkarshmttl |
I got this problem when trying to do this for my personal mp3 yt downloader. I got the solution.
|
Thanks for the help, @sh0tzz. Presumably that’s because the video didn’t actually have any video, even though it was a mp4. It’s definitely something that could be fixed in MoviePy (or at least it could raise a better error), but that’s a good workaround for now. Would you be able to share a file (or instructions on how to create one) that demonstrates the error? |
The error occurs when the video doesn't contain any visual content, ensure you are uploading a video which is not blank. |
some videos doesn`t have visual content but have audio,how can I get the audio with mp3 |
Just import it as an AudioFileClip and it should work fine. |
it`s worked, thank you very much. |
Thank you for your contributions and for reporting issues in this repository. With the release of v2, which introduces significant changes to the codebase and API, we’ve reviewed the backlog of open PRs and issues. Due to the length of the backlog and the likelihood that many of these are either fixed or no longer applicable, we’ve made the decision to close all previous PRs and issues. If you believe that any of these are still relevant to the current version or if you'd like to reopen a related discussion, please feel free to create a new issue or pull request, referencing the old one. Thank you for your understanding and continued support! |
I'm downloading audio in mp4/web containers using Pytube, but I'm getting "KeyError: 'video_fps'" when trying to convert them to mp3 with moviepy.
Code:
import moviepy.editor as mp
from pytube import YouTube
#download video
youtubeurl = "https://www.youtube.com/watch?v=jYypQueS3ew&index=3&list=PL1nNuwHORUCPajRTocTSCJheaMzbWRu23&t=0s"
yt = YouTube(youtubeurl)
stream = yt.streams.filter(subtype='webm',only_audio=True).last().download("/home/jaws/Desktop/Stuff/Moosepy/temp/",
filename="temp_audio")
print
stream
print
"Done!"
#convert to mp3
clip = mp.VideoFileClip("/home/jaws/Desktop/Stuff/Moosepy/temp/temp_audio.webm").subclip()
clip.audio.write_audiofile("audio.mp3")
print "Done!"
Output:
Traceback (most recent call last):
File "/home/jaws/Desktop/Stuff/Moosepy/test.py", line 13, in
clip = mp.VideoFileClip("/home/jaws/Desktop/Stuff/Moosepy/temp/temp_audio.webm").subclip()
File "/home/jaws/.local/lib/python2.7/site-packages/moviepy/video/io/VideoFileClip.py", line 91, in init
fps_source=fps_source)
File "/home/jaws/.local/lib/python2.7/site-packages/moviepy/video/io/ffmpeg_reader.py", line 34, in init
self.fps = infos['video_fps']
KeyError: 'video_fps'
Am I missing the codec? It converts mp4 and Webm video files to mp3 fine. It's just these weird audio files in webm/mp4 containers that won't convert. I guess since the FPS is 0, that's throwing up the error? How can I get around this?
`
Moviepy 0.2.3.5
Python 2.7.12
The text was updated successfully, but these errors were encountered: