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

Unable to load a gif created by moviepy. Fault of avconv? #337

Closed
drewm1980 opened this issue Oct 17, 2016 · 1 comment
Closed

Unable to load a gif created by moviepy. Fault of avconv? #337

drewm1980 opened this issue Oct 17, 2016 · 1 comment

Comments

@drewm1980
Copy link

I created some .gif videos using moviepy, and would like to reload them to combine them into a bigger movie. The .gif files I created play great in mplayer, but ffmpeg / avplay fails to play them (see error below).

If gif loading is broken in avconv, is there some other lossless format that's not broken? Or even better, a way to avoid avconv entirely? Thanks!

In [26]: movie = VideoFileClip('database/evaluation_set/movies/2016_07_05__15_59_04.gif')
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
/home/awagner/venv_widgets/lib/python3.4/site-packages/moviepy/video/io/ffmpeg_reader.py in ffmpeg_parse_infos(filename, print_infos, check_duration)
    264             line = [l for l in lines if keyword in l][0]
--> 265             match = re.findall("([0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9])", line)[0]
    266             result['duration'] = cvsecs(match)

IndexError: list index out of range

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
<ipython-input-26-9bfa53fabb70> in <module>()
----> 1 movie = VideoFileClip('database/evaluation_set/movies/2016_07_05__15_59_04.gif')

/home/awagner/venv_widgets/lib/python3.4/site-packages/moviepy/video/io/VideoFileClip.py in __init__(self, filename, has_mask, audio, audio_buffersize, audio_fps, audio_nbytes, verbose)
     53         # Make a reader
     54         pix_fmt= "rgba" if has_mask else "rgb24"
---> 55         reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt)
     56         self.reader = reader
     57         # Make some of the reader's attributes accessible from the clip

/home/awagner/venv_widgets/lib/python3.4/site-packages/moviepy/video/io/ffmpeg_reader.py in __init__(self, filename, print_infos, bufsize, pix_fmt, check_duration)
     30 
     31         self.filename = filename
---> 32         infos = ffmpeg_parse_infos(filename, print_infos, check_duration)
     33         self.fps = infos['video_fps']
     34         self.size = infos['video_size']

/home/awagner/venv_widgets/lib/python3.4/site-packages/moviepy/video/io/ffmpeg_reader.py in ffmpeg_parse_infos(filename, print_infos, check_duration)
    268             raise IOError(("MoviePy error: failed to read the duration of file %s.\n"
    269                            "Here are the file infos returned by ffmpeg:\n\n%s")%(
--> 270                               filename, infos))
    271 
    272     # get the output line that speaks about video

OSError: MoviePy error: failed to read the duration of file database/evaluation_set/movies/2016_07_05__15_59_04.gif.
Here are the file infos returned by ffmpeg:

avconv version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developers
  built on Mar 16 2015 13:19:10 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
Input #0, image2, from 'database/evaluation_set/movies/2016_07_05__15_59_04.gif':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: gif, pal8, 800x600, 25 tbn
Output #0, null, to '/dev/null':
  Metadata:
    encoder         : Lavf54.20.4
    Stream #0.0: Video: rawvideo, pal8, 800x600, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (gif -> rawvideo)
Press ctrl-c to stop encoding
frame=    1 fps=  0 q=0.0 Lsize=       0kB time=0.04 bitrate=   0.0kbits/s    
video:0kB audio:0kB global headers:0kB muxing overhead -nan%

@drewm1980
Copy link
Author

I was able to get past this error by installing ffmpeg from https://launchpad.net/~mc3man/+archive/ubuntu/trusty-media

The new ffmpeg generates corrupt files with the png encoder, but I guess that's a separate issue, so I'm closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant