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

Error using regex on ffmpeg #105

Open
ghost opened this issue Dec 5, 2016 · 0 comments
Open

Error using regex on ffmpeg #105

ghost opened this issue Dec 5, 2016 · 0 comments
Assignees
Labels
bug fixed in a branch high Highest priority issue
Milestone

Comments

@ghost
Copy link

ghost commented Dec 5, 2016

@doutriaux1 @chaosphere2112
Given the following doctest:

>>> a=vcs.init()
>>> import cdms2
>>> f = cdms2.open(vcs.sample_data+'/clt.nc')
>>> v = f('v') # use the data file to create a cdms2 slab
>>> u = f('u') # use the data file to create a cdms2 slab
>>> png_files = [] # for saving file names to make the mpeg
>>> for i in range(10): # create a number of pngs to use for an mpeg
...     a.clear()
...     if (i%2):
...         a.plot(u,v)
...     else:
...         a.plot(v,u)
...     a.png('my_png__%i' % i)
...     png_files.append('my_png__%i.png' % i)
>>> a.ffmpeg('mymovie.mpeg',png_files) # generates from list of files
True
>>> a.ffmpeg('mymovie.mpeg',files="my_png__[0-9]*\.png") # generate from files with name matching regex
True
>>> a.ffmpeg('mymovie.mpeg',png_files,bitrate=512) # generates mpeg at 512kbit
True
>>> a.ffmpeg('mymovie.mpeg',png_files,rate=50) # generates movie with 50 frame per second
True

I'm getting the exception:

---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
<ipython-input-14-221dba5d3e4b> in <module>()
----> 1 a.ffmpeg('mymovie.mpeg',files="my_png__[0-9]*\.png")

/Users/brown308/anaconda/envs/2.8/lib/python2.7/site-packages/vcs/Canvas.pyc in ffmpeg(self, movie, files, bitrate, rate, options)
   4589         args.extend(("-pix_fmt", "yuv420p"))
   4590 
-> 4591         if test_file is not False:
   4592             # H264 requires even numbered heights and widths
   4593             width, height = self.backend.png_dimensions(test_file)

UnboundLocalError: local variable 'test_file' referenced before assignment

I'm not sure if I'm using the regex functionality correctly or if it even works, but it looks like test_file isn't being declared before its value is checked.

@ghost ghost added the bug label Dec 15, 2016
@doutriaux1 doutriaux1 modified the milestone: 3.0 May 5, 2017
@doutriaux1 doutriaux1 modified the milestones: 3.0, post 3.0 Mar 29, 2018
@doutriaux1 doutriaux1 modified the milestones: 8.1, 8.2 Mar 27, 2019
@doutriaux1 doutriaux1 added the medium Medium Priority Bugs label Apr 18, 2019
@scottwittenburg scottwittenburg added fixed in a branch high Highest priority issue and removed medium Medium Priority Bugs labels May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fixed in a branch high Highest priority issue
Projects
None yet
Development

No branches or pull requests

2 participants