Skip to content
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

video clip from URI #780

Closed
lordcenzin opened this issue Apr 27, 2018 · 7 comments
Closed

video clip from URI #780

lordcenzin opened this issue Apr 27, 2018 · 7 comments
Labels
lib-misc Issues pertaining to misc. 3rd-party libraries.

Comments

@lordcenzin
Copy link

lordcenzin commented Apr 27, 2018

Hi
I was wondering if it is possible to create a VideoFileClip using a URI instead a string?
My video is stored under GCP cloud storage, therefore the filepath follows the following structure:
gs://bucketname/filename.mp4

I put a file in cloud storage and tried to create a VideoFileClip:

video_path = 'gs://bucketname/filename.mp4'
vc = VideoFileClip(video_path)
OSError: MoviePy error: failed to read the duration of file gs://sky-video-analysis/dataset/tavecchio.mp4.
Here are the file infos returned by ffmpeg:

ffmpeg version N-86111-ga441aa90e8-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.1 (Debian 5.4.1-8) 20170304
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
  libavutil      55. 63.100 / 55. 63.100
  libavcodec     57. 96.101 / 57. 96.101
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 89.101 /  6. 89.101
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
gs://bucketname/filename.mp4: Protocol not found
Did you mean file:gs://bucketname/filename.mp4?`

Do you have any idea?

@Zulko
Copy link
Owner

Zulko commented Apr 27, 2018

Not sure, but it looks like the last line of your logs tells you that maybe your file path should be file:gs://bucketname/filename.mp4

@lordcenzin
Copy link
Author

lordcenzin commented Apr 27, 2018

well, actually gs:// is the uri
it looks like a ffmpeg message

@tburrows13
Copy link
Collaborator

Yes, it is an ffmpeg message. It’s saying that you haven’t given it a recognised protocol. Try it with

video_path = 'file:gs://bucketname/filename.mp4'
vc = VideoFileClip(video_path)

@lordcenzin
Copy link
Author

no, my understanding is that "gs" is the "google storage" way to define the uri, similar to "ftp://".
However that seems worse:

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-8-4f47f6f2d562> in <module>()
      3 video_path = 'file:gs://bucketname/dataset/filename.mp4'
      4 outfile = 'file:gs://bucketname/dataset/filename.mp3'
----> 5 vc = VideoFileClip(video_path)
      6 #vc.audio.write_audiofile(outfile)

/usr/local/envs/py3env/lib/python3.5/site-packages/moviepy/video/io/VideoFileClip.py in __init__(self, filename, has_mask, audio, audio_buffersize, target_resolution, resize_algorithm, audio_fps, audio_nbytes, verbose, fps_source)
     89                                          target_resolution=target_resolution,
     90                                          resize_algo=resize_algorithm,
---> 91                                          fps_source=fps_source)
     92 
     93         # Make some of the reader's attributes accessible from the clip

/usr/local/envs/py3env/lib/python3.5/site-packages/moviepy/video/io/ffmpeg_reader.py in __init__(self, filename, print_infos, bufsize, pix_fmt, check_duration, target_resolution, resize_algo, fps_source)
     31         self.proc = None
     32         infos = ffmpeg_parse_infos(filename, print_infos, check_duration,
---> 33                                    fps_source)
     34         self.fps = infos['video_fps']
     35         self.size = infos['video_size']

/usr/local/envs/py3env/lib/python3.5/site-packages/moviepy/video/io/ffmpeg_reader.py in ffmpeg_parse_infos(filename, print_infos, check_duration, fps_source)
    270         raise IOError(("MoviePy error: the file %s could not be found!\n"
    271                       "Please check that you entered the correct "
--> 272                       "path.")%filename)
    273 
    274     result = dict()

OSError: MoviePy error: the file file:gs://bucketname/dataset/filename.mp4 could not be found!
Please check that you entered the correct path.

@tburrows13
Copy link
Collaborator

There’s a list of protocols supported by ffmpeg here. Doesn’t look like gs:, is on there, so might have to try something else.

@keikoro keikoro added the lib-misc Issues pertaining to misc. 3rd-party libraries. label Dec 16, 2018
@keikoro
Copy link
Collaborator

keikoro commented Dec 16, 2018

@lordcenzin Can we close this?

@lordcenzin
Copy link
Author

yes, please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lib-misc Issues pertaining to misc. 3rd-party libraries.
Projects
None yet
Development

No branches or pull requests

4 participants