Commits

Zakhar Zibarov committed 8ab403f Draft

getting bit rate from video stream

  • Participants
  • Parent commits 987d89b

Comments (0)

Files changed (5)

 
     sudo aptitude install python-dev cython libavcodec-dev libavformat-dev libswscale-dev
 
-    tar -xf FFVideo-0.0.12.tar.gz
-    cd FFVideo-0.0.12
+    tar -xf FFVideo-0.0.13.tar.gz
+    cd FFVideo-0.0.13
     python setup.py install
 
 or::
         print '-' * 20
         print "codec: %s" % vs.codec_name
         print "duration: %.2f" % vs.duration
+        print "bit rate: %d" % vs.bitrate
         print "frame size: %dx%d" % (vs.frame_width, vs.frame_height)
         print "frame_mode: %s" % vs.frame_mode
 

ffvideo/ffvideo.c

-/* Generated by Cython 0.18 on Fri Feb 22 22:32:01 2013 */
+/* Generated by Cython 0.18 on Mon Feb 25 02:32:14 2013 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
   PyObject *__pyx___frame_mode;
   PyObject *filename;
   PyObject *codec_name;
+  int bitrate;
   double framerate;
   double duration;
   int width;
 };
 
 
-/* "ffvideo.pyx":352
+/* "ffvideo.pyx":354
  * 
  * 
  * cdef class VideoFrame:             # <<<<<<<<<<<<<<
 static PyObject *__pyx_pf_7ffvideo_11VideoStream_26__repr__(struct __pyx_obj_7ffvideo_VideoStream *__pyx_v_self); /* proto */
 static PyObject *__pyx_pf_7ffvideo_11VideoStream_8filename___get__(struct __pyx_obj_7ffvideo_VideoStream *__pyx_v_self); /* proto */
 static PyObject *__pyx_pf_7ffvideo_11VideoStream_10codec_name___get__(struct __pyx_obj_7ffvideo_VideoStream *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_7ffvideo_11VideoStream_7bitrate___get__(struct __pyx_obj_7ffvideo_VideoStream *__pyx_v_self); /* proto */
 static PyObject *__pyx_pf_7ffvideo_11VideoStream_9framerate___get__(struct __pyx_obj_7ffvideo_VideoStream *__pyx_v_self); /* proto */
 static PyObject *__pyx_pf_7ffvideo_11VideoStream_8duration___get__(struct __pyx_obj_7ffvideo_VideoStream *__pyx_v_self); /* proto */
 static PyObject *__pyx_pf_7ffvideo_11VideoStream_5width___get__(struct __pyx_obj_7ffvideo_VideoStream *__pyx_v_self); /* proto */
   return __pyx_r;
 }
 
-/* "ffvideo.pyx":86
+/* "ffvideo.pyx":87
  * 
  *     property frame_mode:
  *         def __set__(self, mode):             # <<<<<<<<<<<<<<
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__set__", 0);
 
-  /* "ffvideo.pyx":87
+  /* "ffvideo.pyx":88
  *     property frame_mode:
  *         def __set__(self, mode):
  *             if mode not in FRAME_MODES:             # <<<<<<<<<<<<<<
  *                 raise FFVideoValueError("Not supported frame mode")
  *             self.__frame_mode = mode
  */
-  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__FRAME_MODES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__FRAME_MODES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_mode, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_mode, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
 
-    /* "ffvideo.pyx":88
+    /* "ffvideo.pyx":89
  *         def __set__(self, mode):
  *             if mode not in FRAME_MODES:
  *                 raise FFVideoValueError("Not supported frame mode")             # <<<<<<<<<<<<<<
  *             self.__frame_mode = mode
  *             self.ffmpeg_frame_mode = FRAME_MODES[mode]
  */
-    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__FFVideoValueError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__FFVideoValueError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "ffvideo.pyx":89
+  /* "ffvideo.pyx":90
  *             if mode not in FRAME_MODES:
  *                 raise FFVideoValueError("Not supported frame mode")
  *             self.__frame_mode = mode             # <<<<<<<<<<<<<<
   __Pyx_DECREF(__pyx_v_self->__pyx___frame_mode);
   __pyx_v_self->__pyx___frame_mode = __pyx_v_mode;
 
-  /* "ffvideo.pyx":90
+  /* "ffvideo.pyx":91
  *                 raise FFVideoValueError("Not supported frame mode")
  *             self.__frame_mode = mode
  *             self.ffmpeg_frame_mode = FRAME_MODES[mode]             # <<<<<<<<<<<<<<
  * 
  *         def __get__(self):
  */
-  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__FRAME_MODES); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__FRAME_MODES); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __pyx_t_1 = PyObject_GetItem(__pyx_t_3, __pyx_v_mode); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetItem(__pyx_t_3, __pyx_v_mode); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_v_self->ffmpeg_frame_mode = __pyx_t_4;
 
   return __pyx_r;
 }
 
-/* "ffvideo.pyx":92
+/* "ffvideo.pyx":93
  *             self.ffmpeg_frame_mode = FRAME_MODES[mode]
  * 
  *         def __get__(self):             # <<<<<<<<<<<<<<
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__get__", 0);
 
-  /* "ffvideo.pyx":93
+  /* "ffvideo.pyx":94
  * 
  *         def __get__(self):
  *             return self.__frame_mode             # <<<<<<<<<<<<<<
   return __pyx_r;
 }
 
-/* "ffvideo.pyx":96
+/* "ffvideo.pyx":97
  * 
  *     property frame_size:
  *         def __set__(self, size):             # <<<<<<<<<<<<<<
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__set__", 0);
 
-  /* "ffvideo.pyx":97
+  /* "ffvideo.pyx":98
  *     property frame_size:
  *         def __set__(self, size):
  *             try:             # <<<<<<<<<<<<<<
     __Pyx_XGOTREF(__pyx_t_3);
     /*try:*/ {
 
-      /* "ffvideo.pyx":98
+      /* "ffvideo.pyx":99
  *         def __set__(self, size):
  *             try:
  *                 fw, fh = size             # <<<<<<<<<<<<<<
         if (unlikely(size != 2)) {
           if (size > 2) __Pyx_RaiseTooManyValuesError(2);
           else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
-          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         }
         #if CYTHON_COMPILING_IN_CPYTHON
         if (likely(PyTuple_CheckExact(sequence))) {
         __Pyx_INCREF(__pyx_t_4);
         __Pyx_INCREF(__pyx_t_5);
         #else
-        __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         __Pyx_GOTREF(__pyx_t_4);
-        __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         __Pyx_GOTREF(__pyx_t_5);
         #endif
       } else
       {
         Py_ssize_t index = -1;
-        __pyx_t_6 = PyObject_GetIter(__pyx_v_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        __pyx_t_6 = PyObject_GetIter(__pyx_v_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         __Pyx_GOTREF(__pyx_t_6);
         __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
         index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L11_unpacking_failed;
         __Pyx_GOTREF(__pyx_t_4);
         index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed;
         __Pyx_GOTREF(__pyx_t_5);
-        if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         __pyx_t_7 = NULL;
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         goto __pyx_L12_unpacking_done;
         __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
         __pyx_t_7 = NULL;
         if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
         __pyx_L12_unpacking_done:;
       }
       __pyx_v_fw = __pyx_t_4;
     __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
 
-    /* "ffvideo.pyx":99
+    /* "ffvideo.pyx":100
  *             try:
  *                 fw, fh = size
  *             except (TypeError, ValueError), e:             # <<<<<<<<<<<<<<
     __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_TypeError) || PyErr_ExceptionMatches(__pyx_builtin_ValueError);
     if (__pyx_t_8) {
       __Pyx_AddTraceback("ffvideo.VideoStream.frame_size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
-      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
       __Pyx_GOTREF(__pyx_t_5);
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_GOTREF(__pyx_t_6);
       __Pyx_INCREF(__pyx_t_4);
       __pyx_v_e = __pyx_t_4;
 
-      /* "ffvideo.pyx":100
+      /* "ffvideo.pyx":101
  *                 fw, fh = size
  *             except (TypeError, ValueError), e:
  *                 raise FFVideoValueError("frame_size must be a tuple (int, int)")             # <<<<<<<<<<<<<<
  *             if fw is None and fh is None:
  *                 raise FFVideoValueError("both width and height cannot be None")
  */
-      __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__FFVideoValueError); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+      __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__FFVideoValueError); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
       __Pyx_GOTREF(__pyx_t_9);
-      __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+      __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
       __Pyx_GOTREF(__pyx_t_10);
       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
       __Pyx_Raise(__pyx_t_10, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __pyx_L10_try_end:;
   }
 
-  /* "ffvideo.pyx":101
+  /* "ffvideo.pyx":102
  *             except (TypeError, ValueError), e:
  *                 raise FFVideoValueError("frame_size must be a tuple (int, int)")
  *             if fw is None and fh is None:             # <<<<<<<<<<<<<<
   }
   if (__pyx_t_13) {
 
-    /* "ffvideo.pyx":102
+    /* "ffvideo.pyx":103
  *                 raise FFVideoValueError("frame_size must be a tuple (int, int)")
  *             if fw is None and fh is None:
  *                 raise FFVideoValueError("both width and height cannot be None")             # <<<<<<<<<<<<<<
  * 
  *             if fw is None:
  */
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__FFVideoValueError); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__FFVideoValueError); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L15;
   }
   __pyx_L15:;
 
-  /* "ffvideo.pyx":104
+  /* "ffvideo.pyx":105
  *                 raise FFVideoValueError("both width and height cannot be None")
  * 
  *             if fw is None:             # <<<<<<<<<<<<<<
   __pyx_t_13 = (__pyx_v_fw == Py_None);
   if (__pyx_t_13) {
 
-    /* "ffvideo.pyx":105
+    /* "ffvideo.pyx":106
  * 
  *             if fw is None:
  *                 self.frame_width = round(fh * <float>self.width / self.height / 2.0) * 2             # <<<<<<<<<<<<<<
  *                 self.frame_height = round(fh / 2.0) * 2
  *             elif fh is None:
  */
-    __pyx_t_4 = PyFloat_FromDouble(((float)__pyx_v_self->width)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyFloat_FromDouble(((float)__pyx_v_self->width)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_6 = PyNumber_Multiply(__pyx_v_fh, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyNumber_Multiply(__pyx_v_fh, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyInt_FromLong(__pyx_v_self->height); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyInt_FromLong(__pyx_v_self->height); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
-    __Pyx_GIVEREF(__pyx_t_6);
-    __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_v_self->frame_width = __pyx_t_8;
-
-    /* "ffvideo.pyx":106
- *             if fw is None:
- *                 self.frame_width = round(fh * <float>self.width / self.height / 2.0) * 2
- *                 self.frame_height = round(fh / 2.0) * 2             # <<<<<<<<<<<<<<
- *             elif fh is None:
- *                 self.frame_width = round(fw / 2.0) * 2
- */
-    __pyx_t_4 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_fh, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_v_self->frame_width = __pyx_t_8;
+
+    /* "ffvideo.pyx":107
+ *             if fw is None:
+ *                 self.frame_width = round(fh * <float>self.width / self.height / 2.0) * 2
+ *                 self.frame_height = round(fh / 2.0) * 2             # <<<<<<<<<<<<<<
+ *             elif fh is None:
+ *                 self.frame_width = round(fw / 2.0) * 2
+ */
+    __pyx_t_4 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_fh, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
+    __Pyx_GIVEREF(__pyx_t_6);
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __pyx_v_self->frame_height = __pyx_t_8;
     goto __pyx_L16;
   }
 
-  /* "ffvideo.pyx":107
+  /* "ffvideo.pyx":108
  *                 self.frame_width = round(fh * <float>self.width / self.height / 2.0) * 2
  *                 self.frame_height = round(fh / 2.0) * 2
  *             elif fh is None:             # <<<<<<<<<<<<<<
   __pyx_t_13 = (__pyx_v_fh == Py_None);
   if (__pyx_t_13) {
 
-    /* "ffvideo.pyx":108
+    /* "ffvideo.pyx":109
  *                 self.frame_height = round(fh / 2.0) * 2
  *             elif fh is None:
  *                 self.frame_width = round(fw / 2.0) * 2             # <<<<<<<<<<<<<<
  *                 self.frame_height = round(fw * <float>self.height / self.width / 2.0) * 2
  *             else:
  */
-    __pyx_t_4 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_fw, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
-    __Pyx_GIVEREF(__pyx_t_6);
-    __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_v_self->frame_width = __pyx_t_8;
-
-    /* "ffvideo.pyx":109
- *             elif fh is None:
- *                 self.frame_width = round(fw / 2.0) * 2
- *                 self.frame_height = round(fw * <float>self.height / self.width / 2.0) * 2             # <<<<<<<<<<<<<<
- *             else:
- *                 self.frame_width = round(fw / 2.0) * 2
- */
-    __pyx_t_4 = PyFloat_FromDouble(((float)__pyx_v_self->height)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_6 = PyNumber_Multiply(__pyx_v_fw, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyInt_FromLong(__pyx_v_self->width); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_5);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __pyx_t_4 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_fw, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_v_self->frame_width = __pyx_t_8;
+
+    /* "ffvideo.pyx":110
+ *             elif fh is None:
+ *                 self.frame_width = round(fw / 2.0) * 2
+ *                 self.frame_height = round(fw * <float>self.height / self.width / 2.0) * 2             # <<<<<<<<<<<<<<
+ *             else:
+ *                 self.frame_width = round(fw / 2.0) * 2
+ */
+    __pyx_t_4 = PyFloat_FromDouble(((float)__pyx_v_self->height)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = PyNumber_Multiply(__pyx_v_fw, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyInt_FromLong(__pyx_v_self->width); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
+    __Pyx_GIVEREF(__pyx_t_6);
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __pyx_v_self->frame_height = __pyx_t_8;
     goto __pyx_L16;
   }
   /*else*/ {
 
-    /* "ffvideo.pyx":111
+    /* "ffvideo.pyx":112
  *                 self.frame_height = round(fw * <float>self.height / self.width / 2.0) * 2
  *             else:
  *                 self.frame_width = round(fw / 2.0) * 2             # <<<<<<<<<<<<<<
  *                 self.frame_height = round(fh / 2.0) * 2
  * 
  */
-    __pyx_t_4 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_fw, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
-    __Pyx_GIVEREF(__pyx_t_6);
-    __pyx_t_6 = 0;
-    __pyx_t_6 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_6);
-    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
-    __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
-    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    __pyx_v_self->frame_width = __pyx_t_8;
-
-    /* "ffvideo.pyx":112
- *             else:
- *                 self.frame_width = round(fw / 2.0) * 2
- *                 self.frame_height = round(fh / 2.0) * 2             # <<<<<<<<<<<<<<
- * 
- *         def __get__(self):
- */
     __pyx_t_4 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_fh, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_fw, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_v_self->frame_width = __pyx_t_8;
+
+    /* "ffvideo.pyx":113
+ *             else:
+ *                 self.frame_width = round(fw / 2.0) * 2
+ *                 self.frame_height = round(fh / 2.0) * 2             # <<<<<<<<<<<<<<
+ * 
+ *         def __get__(self):
+ */
+    __pyx_t_4 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_fh, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
+    __Pyx_GIVEREF(__pyx_t_6);
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __pyx_v_self->frame_height = __pyx_t_8;
   }
   __pyx_L16:;
   return __pyx_r;
 }
 
-/* "ffvideo.pyx":114
+/* "ffvideo.pyx":115
  *                 self.frame_height = round(fh / 2.0) * 2
  * 
  *         def __get__(self):             # <<<<<<<<<<<<<<
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__", 0);
 
-  /* "ffvideo.pyx":115
+  /* "ffvideo.pyx":116
  * 
  *         def __get__(self):
  *             return (self.frame_width, self.frame_height)             # <<<<<<<<<<<<<<
  *     def __cinit__(self, filename, frame_size=None, frame_mode='RGB',
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->frame_width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->frame_width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->frame_height); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->frame_height); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__frame_size,&__pyx_n_s__frame_mode,&__pyx_n_s__scale_mode,0};
     PyObject* values[4] = {0,0,0,0};
 
-    /* "ffvideo.pyx":117
+    /* "ffvideo.pyx":118
  *             return (self.frame_width, self.frame_height)
  * 
  *     def __cinit__(self, filename, frame_size=None, frame_mode='RGB',             # <<<<<<<<<<<<<<
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("ffvideo.VideoStream.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__cinit__", 0);
 
-  /* "ffvideo.pyx":119
+  /* "ffvideo.pyx":120
  *     def __cinit__(self, filename, frame_size=None, frame_mode='RGB',
  *                   scale_mode=BICUBIC):
  *         self.format_ctx = NULL             # <<<<<<<<<<<<<<
  */
   __pyx_v_self->format_ctx = NULL;
 
-  /* "ffvideo.pyx":120
+  /* "ffvideo.pyx":121
  *                   scale_mode=BICUBIC):
  *         self.format_ctx = NULL
  *         self.codec_ctx = NULL             # <<<<<<<<<<<<<<
  */
   __pyx_v_self->codec_ctx = NULL;
 
-  /* "ffvideo.pyx":121
+  /* "ffvideo.pyx":122
  *         self.format_ctx = NULL
  *         self.codec_ctx = NULL
  *         self.frame = avcodec_alloc_frame()             # <<<<<<<<<<<<<<
  */
   __pyx_v_self->frame = avcodec_alloc_frame();
 
-  /* "ffvideo.pyx":122
+  /* "ffvideo.pyx":123
  *         self.codec_ctx = NULL
  *         self.frame = avcodec_alloc_frame()
  *         self.duration = 0             # <<<<<<<<<<<<<<
  */
   __pyx_v_self->duration = 0.0;
 
-  /* "ffvideo.pyx":123
+  /* "ffvideo.pyx":124
  *         self.frame = avcodec_alloc_frame()
  *         self.duration = 0
  *         self.width = 0             # <<<<<<<<<<<<<<
  */
   __pyx_v_self->width = 0;
 
-  /* "ffvideo.pyx":124
+  /* "ffvideo.pyx":125
  *         self.duration = 0
  *         self.width = 0
  *         self.height = 0             # <<<<<<<<<<<<<<
  */
   __pyx_v_self->height = 0;
 
-  /* "ffvideo.pyx":125
+  /* "ffvideo.pyx":126
  *         self.width = 0
  *         self.height = 0
  *         self.frameno = 0             # <<<<<<<<<<<<<<
  */
   __pyx_v_self->frameno = 0;
 
-  /* "ffvideo.pyx":126
+  /* "ffvideo.pyx":127
  *         self.height = 0
  *         self.frameno = 0
  *         self.streamno = -1             # <<<<<<<<<<<<<<
     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__frame_size,&__pyx_n_s__frame_mode,&__pyx_n_s__scale_mode,0};
     PyObject* values[4] = {0,0,0,0};
 
-    /* "ffvideo.pyx":128
+    /* "ffvideo.pyx":129
  *         self.streamno = -1
  * 
  *     def __init__(self, filename, frame_size=None, frame_mode='RGB',             # <<<<<<<<<<<<<<
         }
       }
       if (unlikely(kw_args > 0)) {
-        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
     } else {
       switch (PyTuple_GET_SIZE(__pyx_args)) {
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
-  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
   __Pyx_AddTraceback("ffvideo.VideoStream.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __Pyx_RefNannyFinishContext();
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__init__", 0);
 
-  /* "ffvideo.pyx":133
+  /* "ffvideo.pyx":134
  *         cdef int i
  * 
  *         self.filename = filename             # <<<<<<<<<<<<<<
   __Pyx_DECREF(__pyx_v_self->filename);
   __pyx_v_self->filename = __pyx_v_filename;
 
-  /* "ffvideo.pyx":135
+  /* "ffvideo.pyx":136
  *         self.filename = filename
  * 
  *         self.frame_mode = frame_mode             # <<<<<<<<<<<<<<
  *         self.scale_mode = scale_mode
  * 
  */
-  if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__frame_mode, __pyx_v_frame_mode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "ffvideo.pyx":136
+  if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__frame_mode, __pyx_v_frame_mode) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "ffvideo.pyx":137
  * 
  *         self.frame_mode = frame_mode
  *         self.scale_mode = scale_mode             # <<<<<<<<<<<<<<
  * 
  *         ret = avformat_open_input(&self.format_ctx, filename, NULL, NULL)
  */
-  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_scale_mode); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_scale_mode); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_self->scale_mode = __pyx_t_1;
 
-  /* "ffvideo.pyx":138
+  /* "ffvideo.pyx":139
  *         self.scale_mode = scale_mode
  * 
  *         ret = avformat_open_input(&self.format_ctx, filename, NULL, NULL)             # <<<<<<<<<<<<<<
  *         if ret != 0:
  *             raise DecoderError("Unable to open file %s" % filename)
  */
-  __pyx_t_2 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_v_ret = avformat_open_input((&__pyx_v_self->format_ctx), __pyx_t_2, NULL, NULL);
 
-  /* "ffvideo.pyx":139
+  /* "ffvideo.pyx":140
  * 
  *         ret = avformat_open_input(&self.format_ctx, filename, NULL, NULL)
  *         if ret != 0:             # <<<<<<<<<<<<<<
   __pyx_t_3 = (__pyx_v_ret != 0);
   if (__pyx_t_3) {
 
-    /* "ffvideo.pyx":140
+    /* "ffvideo.pyx":141
  *         ret = avformat_open_input(&self.format_ctx, filename, NULL, NULL)
  *         if ret != 0:
  *             raise DecoderError("Unable to open file %s" % filename)             # <<<<<<<<<<<<<<
  * 
  *         ret = avformat_find_stream_info(self.format_ctx, NULL)
  */
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DecoderError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DecoderError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_v_filename); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_v_filename); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_5));
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
     __pyx_t_5 = 0;
-    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
     __Pyx_Raise(__pyx_t_5, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "ffvideo.pyx":142
+  /* "ffvideo.pyx":143
  *             raise DecoderError("Unable to open file %s" % filename)
  * 
  *         ret = avformat_find_stream_info(self.format_ctx, NULL)             # <<<<<<<<<<<<<<
  */
   __pyx_v_ret = avformat_find_stream_info(__pyx_v_self->format_ctx, NULL);
 
-  /* "ffvideo.pyx":143
+  /* "ffvideo.pyx":144
  * 
  *         ret = avformat_find_stream_info(self.format_ctx, NULL)
  *         if ret < 0:             # <<<<<<<<<<<<<<
   __pyx_t_3 = (__pyx_v_ret < 0);
   if (__pyx_t_3) {
 
-    /* "ffvideo.pyx":144
+    /* "ffvideo.pyx":145
  *         ret = avformat_find_stream_info(self.format_ctx, NULL)
  *         if ret < 0:
  *             raise DecoderError("Unable to find stream info: %d" % ret)             # <<<<<<<<<<<<<<
  * 
  *         for i in xrange(self.format_ctx.nb_streams):
  */
-    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__DecoderError); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__DecoderError); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
-    __pyx_t_6 = PyInt_FromLong(__pyx_v_ret); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyInt_FromLong(__pyx_v_ret); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(((PyObject *)__pyx_t_4));
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4));
     __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
     __pyx_t_4 = 0;
-    __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
     __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L4;
   }
   __pyx_L4:;
 
-  /* "ffvideo.pyx":146
+  /* "ffvideo.pyx":147
  *             raise DecoderError("Unable to find stream info: %d" % ret)
  * 
  *         for i in xrange(self.format_ctx.nb_streams):             # <<<<<<<<<<<<<<
   for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_1; __pyx_t_7+=1) {
     __pyx_v_i = __pyx_t_7;
 
-    /* "ffvideo.pyx":147
+    /* "ffvideo.pyx":148
  * 
  *         for i in xrange(self.format_ctx.nb_streams):
  *             if self.format_ctx.streams[i].codec.codec_type == AVMEDIA_TYPE_VIDEO:             # <<<<<<<<<<<<<<
     __pyx_t_3 = ((__pyx_v_self->format_ctx->streams[__pyx_v_i])->codec->codec_type == AVMEDIA_TYPE_VIDEO);
     if (__pyx_t_3) {
 
-      /* "ffvideo.pyx":148
+      /* "ffvideo.pyx":149
  *         for i in xrange(self.format_ctx.nb_streams):
  *             if self.format_ctx.streams[i].codec.codec_type == AVMEDIA_TYPE_VIDEO:
  *                 self.streamno = i             # <<<<<<<<<<<<<<
  */
       __pyx_v_self->streamno = __pyx_v_i;
 
-      /* "ffvideo.pyx":149
+      /* "ffvideo.pyx":150
  *             if self.format_ctx.streams[i].codec.codec_type == AVMEDIA_TYPE_VIDEO:
  *                 self.streamno = i
  *                 break             # <<<<<<<<<<<<<<
   }
   /*else*/ {
 
-    /* "ffvideo.pyx":151
+    /* "ffvideo.pyx":152
  *                 break
  *         else:
  *             raise DecoderError("Unable to find video stream")             # <<<<<<<<<<<<<<
  * 
  *         self.stream = self.format_ctx.streams[self.streamno]
  */
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DecoderError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DecoderError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_L6_break:;
 
-  /* "ffvideo.pyx":153
+  /* "ffvideo.pyx":154
  *             raise DecoderError("Unable to find video stream")
  * 
  *         self.stream = self.format_ctx.streams[self.streamno]             # <<<<<<<<<<<<<<
  */
   __pyx_v_self->stream = (__pyx_v_self->format_ctx->streams[__pyx_v_self->streamno]);
 
-  /* "ffvideo.pyx":154
+  /* "ffvideo.pyx":155
  * 
  *         self.stream = self.format_ctx.streams[self.streamno]
  *         self.framerate = av_q2d(self.stream.r_frame_rate)             # <<<<<<<<<<<<<<
  */
   __pyx_v_self->framerate = av_q2d(__pyx_v_self->stream->r_frame_rate);
 
-  /* "ffvideo.pyx":156
+  /* "ffvideo.pyx":157
  *         self.framerate = av_q2d(self.stream.r_frame_rate)
  * 
  *         if self.stream.duration == 0 or self.stream.duration == AV_NOPTS_VALUE:             # <<<<<<<<<<<<<<
   }
   if (__pyx_t_9) {
 
-    /* "ffvideo.pyx":157
+    /* "ffvideo.pyx":158
  * 
  *         if self.stream.duration == 0 or self.stream.duration == AV_NOPTS_VALUE:
  *             self.duration = self.format_ctx.duration / <double>AV_TIME_BASE             # <<<<<<<<<<<<<<
  */
     if (unlikely(((double)AV_TIME_BASE) == 0)) {
       PyErr_Format(PyExc_ZeroDivisionError, "float division");
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     __pyx_v_self->duration = (__pyx_v_self->format_ctx->duration / ((double)AV_TIME_BASE));
     goto __pyx_L8;
   }
   /*else*/ {
 
-    /* "ffvideo.pyx":159
+    /* "ffvideo.pyx":160
  *             self.duration = self.format_ctx.duration / <double>AV_TIME_BASE
  *         else:
  *             self.duration = self.stream.duration * av_q2d(self.stream.time_base)             # <<<<<<<<<<<<<<
   }
   __pyx_L8:;
 
-  /* "ffvideo.pyx":161
+  /* "ffvideo.pyx":162
  *             self.duration = self.stream.duration * av_q2d(self.stream.time_base)
  * 
  *         self.codec_ctx = self.stream.codec             # <<<<<<<<<<<<<<
   __pyx_t_10 = __pyx_v_self->stream->codec;
   __pyx_v_self->codec_ctx = __pyx_t_10;
 
-  /* "ffvideo.pyx":162
+  /* "ffvideo.pyx":163
  * 
  *         self.codec_ctx = self.stream.codec
  *         self.codec = avcodec_find_decoder(self.codec_ctx.codec_id)             # <<<<<<<<<<<<<<
  */
   __pyx_v_self->codec = avcodec_find_decoder(__pyx_v_self->codec_ctx->codec_id);
 
-  /* "ffvideo.pyx":164
+  /* "ffvideo.pyx":165
  *         self.codec = avcodec_find_decoder(self.codec_ctx.codec_id)
  * 
  *         if self.codec == NULL:             # <<<<<<<<<<<<<<
   __pyx_t_9 = (__pyx_v_self->codec == NULL);
   if (__pyx_t_9) {
 
-    /* "ffvideo.pyx":165
+    /* "ffvideo.pyx":166
  * 
  *         if self.codec == NULL:
  *             raise DecoderError("Unable to get decoder")             # <<<<<<<<<<<<<<
  * 
  *         if self.frame_mode in ('L', 'F'):
  */
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__DecoderError); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__DecoderError); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L9;
   }
   __pyx_L9:;
 
-  /* "ffvideo.pyx":167
+  /* "ffvideo.pyx":168
  *             raise DecoderError("Unable to get decoder")
  * 
  *         if self.frame_mode in ('L', 'F'):             # <<<<<<<<<<<<<<
  *             self.codec_ctx.flags |= CODEC_FLAG_GRAY
  * 
  */
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__frame_mode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__frame_mode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_n_s__L), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_n_s__L), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   if (!((int)__pyx_t_9)) {
-    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_n_s__F), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, ((PyObject *)__pyx_n_s__F), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __pyx_t_8 = ((int)__pyx_t_3);
   } else {
   __pyx_t_9 = __pyx_t_8;
   if (__pyx_t_9) {
 
-    /* "ffvideo.pyx":168
+    /* "ffvideo.pyx":169
  * 
  *         if self.frame_mode in ('L', 'F'):
  *             self.codec_ctx.flags |= CODEC_FLAG_GRAY             # <<<<<<<<<<<<<<
   }
   __pyx_L10:;
 
-  /* "ffvideo.pyx":170
+  /* "ffvideo.pyx":171
  *             self.codec_ctx.flags |= CODEC_FLAG_GRAY
  * 
  *         self.width = self.codec_ctx.width             # <<<<<<<<<<<<<<
   __pyx_t_1 = __pyx_v_self->codec_ctx->width;
   __pyx_v_self->width = __pyx_t_1;
 
-  /* "ffvideo.pyx":171
+  /* "ffvideo.pyx":172
  * 
  *         self.width = self.codec_ctx.width
  *         self.height = self.codec_ctx.height             # <<<<<<<<<<<<<<
   __pyx_t_1 = __pyx_v_self->codec_ctx->height;
   __pyx_v_self->height = __pyx_t_1;
 
-  /* "ffvideo.pyx":174
+  /* "ffvideo.pyx":175
  * 
  *         # Open codec
  *         ret = avcodec_open2(self.codec_ctx, self.codec, NULL)             # <<<<<<<<<<<<<<
  */
   __pyx_v_ret = avcodec_open2(__pyx_v_self->codec_ctx, __pyx_v_self->codec, NULL);
 
-  /* "ffvideo.pyx":175
+  /* "ffvideo.pyx":176
  *         # Open codec
  *         ret = avcodec_open2(self.codec_ctx, self.codec, NULL)
  *         if ret < 0:             # <<<<<<<<<<<<<<
   __pyx_t_9 = (__pyx_v_ret < 0);
   if (__pyx_t_9) {
 
-    /* "ffvideo.pyx":176
+    /* "ffvideo.pyx":177
  *         ret = avcodec_open2(self.codec_ctx, self.codec, NULL)
  *         if ret < 0:
  *             raise DecoderError("Unable to open codec")             # <<<<<<<<<<<<<<
  * 
  *         # for some videos, avcodec_open2 will set these to 0,
  */
-    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DecoderError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DecoderError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L11;
   }
   __pyx_L11:;
 
-  /* "ffvideo.pyx":181
+  /* "ffvideo.pyx":182
  *         # so we'll only be using it if it is not 0, otherwise,
  *         # we rely on the resolution provided by the header;
  *         if self.codec_ctx.width != 0 and self.codec_ctx.height !=0:             # <<<<<<<<<<<<<<
   }
   if (__pyx_t_3) {
 
-    /* "ffvideo.pyx":182
+    /* "ffvideo.pyx":183
  *         # we rely on the resolution provided by the header;
  *         if self.codec_ctx.width != 0 and self.codec_ctx.height !=0:
  *             self.width = self.codec_ctx.width             # <<<<<<<<<<<<<<
     __pyx_t_1 = __pyx_v_self->codec_ctx->width;
     __pyx_v_self->width = __pyx_t_1;
 
-    /* "ffvideo.pyx":183
+    /* "ffvideo.pyx":184
  *         if self.codec_ctx.width != 0 and self.codec_ctx.height !=0:
  *             self.width = self.codec_ctx.width
  *             self.height = self.codec_ctx.height             # <<<<<<<<<<<<<<
   }
   __pyx_L12:;
 
-  /* "ffvideo.pyx":185
+  /* "ffvideo.pyx":186
  *             self.height = self.codec_ctx.height
  * 
  *         if self.width <= 0 or self.height <= 0:             # <<<<<<<<<<<<<<
   }
   if (__pyx_t_8) {
 
-    /* "ffvideo.pyx":186
+    /* "ffvideo.pyx":187
  * 
  *         if self.width <= 0 or self.height <= 0:
  *             raise DecoderError("Video width/height is 0; cannot decode")             # <<<<<<<<<<<<<<
  * 
  *         if frame_size is None:
  */
-    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__DecoderError); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__DecoderError); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L13;
   }
   __pyx_L13:;
 
-  /* "ffvideo.pyx":188
+  /* "ffvideo.pyx":189
  *             raise DecoderError("Video width/height is 0; cannot decode")
  * 
  *         if frame_size is None:             # <<<<<<<<<<<<<<
   __pyx_t_8 = (__pyx_v_frame_size == Py_None);
   if (__pyx_t_8) {
 
-    /* "ffvideo.pyx":189
+    /* "ffvideo.pyx":190
  * 
  *         if frame_size is None:
  *             self.frame_size = (self.width, self.height)             # <<<<<<<<<<<<<<
  *         else:
  *             self.frame_size = frame_size
  */
-    __pyx_t_4 = PyInt_FromLong(__pyx_v_self->width); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = PyInt_FromLong(__pyx_v_self->width); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_4);
-    __pyx_t_6 = PyInt_FromLong(__pyx_v_self->height); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_6 = PyInt_FromLong(__pyx_v_self->height); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_6);
-    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_5);
     PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
     __Pyx_GIVEREF(__pyx_t_4);
     __Pyx_GIVEREF(__pyx_t_6);
     __pyx_t_4 = 0;
     __pyx_t_6 = 0;
-    if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__frame_size, ((PyObject *)__pyx_t_5)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__frame_size, ((PyObject *)__pyx_t_5)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
     goto __pyx_L14;
   }
   /*else*/ {
 
-    /* "ffvideo.pyx":191
+    /* "ffvideo.pyx":192
  *             self.frame_size = (self.width, self.height)
  *         else:
  *             self.frame_size = frame_size             # <<<<<<<<<<<<<<
  * 
  *         self.codec_name = self.codec.name
  */
-    if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__frame_size, __pyx_v_frame_size) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (PyObject_SetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__frame_size, __pyx_v_frame_size) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
   __pyx_L14:;
 
-  /* "ffvideo.pyx":193
+  /* "ffvideo.pyx":194
  *             self.frame_size = frame_size
  * 
  *         self.codec_name = self.codec.name             # <<<<<<<<<<<<<<
- * 
- *         self.__decode_next_frame()
- */
-  __pyx_t_5 = PyBytes_FromString(__pyx_v_self->codec->name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ *         self.bitrate = self.format_ctx.bit_rate
+ * 
+ */
+  __pyx_t_5 = PyBytes_FromString(__pyx_v_self->codec->name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_5));
   __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
   __Pyx_GOTREF(__pyx_v_self->codec_name);
   __pyx_t_5 = 0;
 
   /* "ffvideo.pyx":195
+ * 
  *         self.codec_name = self.codec.name
+ *         self.bitrate = self.format_ctx.bit_rate             # <<<<<<<<<<<<<<
+ * 
+ *         self.__decode_next_frame()
+ */
+  __pyx_t_1 = __pyx_v_self->format_ctx->bit_rate;
+  __pyx_v_self->bitrate = __pyx_t_1;
+
+  /* "ffvideo.pyx":197
+ *         self.bitrate = self.format_ctx.bit_rate
  * 
  *         self.__decode_next_frame()             # <<<<<<<<<<<<<<
  * 
  *     def __dealloc__(self):
  */
-  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____decode_next_frame); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____decode_next_frame); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_6);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
   __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
   __Pyx_RefNannyFinishContext();
 }
 
-/* "ffvideo.pyx":197
+/* "ffvideo.pyx":199
  *         self.__decode_next_frame()
  * 
  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
   int __pyx_t_1;
   __Pyx_RefNannySetupContext("__dealloc__", 0);
 
-  /* "ffvideo.pyx":198
+  /* "ffvideo.pyx":200
  * 
  *     def __dealloc__(self):
  *         if self.packet.data:             # <<<<<<<<<<<<<<
   __pyx_t_1 = (__pyx_v_self->packet.data != 0);
   if (__pyx_t_1) {
 
-    /* "ffvideo.pyx":199
+    /* "ffvideo.pyx":201
  *     def __dealloc__(self):
  *         if self.packet.data:
  *             av_free_packet(&self.packet)             # <<<<<<<<<<<<<<
   }
   __pyx_L3:;
 
-  /* "ffvideo.pyx":201
+  /* "ffvideo.pyx":203
  *             av_free_packet(&self.packet)
  * 
  *         av_free(self.frame)             # <<<<<<<<<<<<<<
  */
   av_free(__pyx_v_self->frame);
 
-  /* "ffvideo.pyx":202
+  /* "ffvideo.pyx":204
  * 
  *         av_free(self.frame)
  *         if self.codec:             # <<<<<<<<<<<<<<
   __pyx_t_1 = (__pyx_v_self->codec != 0);
   if (__pyx_t_1) {
 
-    /* "ffvideo.pyx":203
+    /* "ffvideo.pyx":205
  *         av_free(self.frame)
  *         if self.codec:
  *             avcodec_close(self.codec_ctx)             # <<<<<<<<<<<<<<
  */
     avcodec_close(__pyx_v_self->codec_ctx);
 
-    /* "ffvideo.pyx":204
+    /* "ffvideo.pyx":206
  *         if self.codec:
  *             avcodec_close(self.codec_ctx)
  *             self.codec_ctx = NULL             # <<<<<<<<<<<<<<
   }
   __pyx_L4:;
 
-  /* "ffvideo.pyx":205
+  /* "ffvideo.pyx":207
  *             avcodec_close(self.codec_ctx)
  *             self.codec_ctx = NULL
  *         if self.format_ctx:             # <<<<<<<<<<<<<<
   __pyx_t_1 = (__pyx_v_self->format_ctx != 0);
   if (__pyx_t_1) {
 
-    /* "ffvideo.pyx":206
+    /* "ffvideo.pyx":208
  *             self.codec_ctx = NULL
  *         if self.format_ctx:
  *             avformat_close_input(&self.format_ctx)             # <<<<<<<<<<<<<<
   return __pyx_r;
 }
 
-/* "ffvideo.pyx":208
+/* "ffvideo.pyx":210
  *             avformat_close_input(&self.format_ctx)
  * 
  *     def dump(self):             # <<<<<<<<<<<<<<
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("dump", 0);
 
-  /* "ffvideo.pyx":209
+  /* "ffvideo.pyx":211
  * 
  *     def dump(self):
  *         print "max_b_frames=%s" % self.codec_ctx.max_b_frames             # <<<<<<<<<<<<<<
  *         av_log_set_level(AV_LOG_VERBOSE);
  *         av_dump_format(self.format_ctx, 0, self.filename, 0);
  */
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->codec_ctx->max_b_frames); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->codec_ctx->max_b_frames); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "ffvideo.pyx":210
+  /* "ffvideo.pyx":212
  *     def dump(self):
  *         print "max_b_frames=%s" % self.codec_ctx.max_b_frames
  *         av_log_set_level(AV_LOG_VERBOSE);             # <<<<<<<<<<<<<<
  */
   av_log_set_level(AV_LOG_VERBOSE);
 
-  /* "ffvideo.pyx":211
+  /* "ffvideo.pyx":213
  *         print "max_b_frames=%s" % self.codec_ctx.max_b_frames
  *         av_log_set_level(AV_LOG_VERBOSE);
  *         av_dump_format(self.format_ctx, 0, self.filename, 0);             # <<<<<<<<<<<<<<
  *         av_log_set_level(AV_LOG_ERROR);
  * 
  */
-  __pyx_t_3 = PyBytes_AsString(__pyx_v_self->filename); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyBytes_AsString(__pyx_v_self->filename); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   av_dump_format(__pyx_v_self->format_ctx, 0, __pyx_t_3, 0);
 
-  /* "ffvideo.pyx":212
+  /* "ffvideo.pyx":214
  *         av_log_set_level(AV_LOG_VERBOSE);
  *         av_dump_format(self.format_ctx, 0, self.filename, 0);
  *         av_log_set_level(AV_LOG_ERROR);             # <<<<<<<<<<<<<<
   return __pyx_r;
 }
 
-/* "ffvideo.pyx":214
+/* "ffvideo.pyx":216
  *         av_log_set_level(AV_LOG_ERROR);
  * 
  *     def __decode_next_frame(self):             # <<<<<<<<<<<<<<
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__decode_next_frame", 0);
 
-  /* "ffvideo.pyx":216
+  /* "ffvideo.pyx":218
  *     def __decode_next_frame(self):
  *         cdef int ret
  *         cdef int frame_finished = 0             # <<<<<<<<<<<<<<
  */
   __pyx_v_frame_finished = 0;
 
-  /* "ffvideo.pyx":219
+  /* "ffvideo.pyx":221
  *         cdef int64_t pts
  * 
  *         while not frame_finished:             # <<<<<<<<<<<<<<
     __pyx_t_1 = (!__pyx_v_frame_finished);
     if (!__pyx_t_1) break;
 
-    /* "ffvideo.pyx":220
+    /* "ffvideo.pyx":222
  * 
  *         while not frame_finished:
  *             ret = av_read_frame(self.format_ctx, &self.packet)             # <<<<<<<<<<<<<<
  */
     __pyx_v_ret = av_read_frame(__pyx_v_self->format_ctx, (&__pyx_v_self->packet));
 
-    /* "ffvideo.pyx":221
+    /* "ffvideo.pyx":223
  *         while not frame_finished:
  *             ret = av_read_frame(self.format_ctx, &self.packet)
  *             if ret < 0:             # <<<<<<<<<<<<<<
     __pyx_t_1 = (__pyx_v_ret < 0);
     if (__pyx_t_1) {
 
-      /* "ffvideo.pyx":222
+      /* "ffvideo.pyx":224
  *             ret = av_read_frame(self.format_ctx, &self.packet)
  *             if ret < 0:
  *                 raise NoMoreData("Unable to read frame. [%d]" % ret)             # <<<<<<<<<<<<<<
  * 
  *             if self.packet.stream_index == self.streamno:
  */
-      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__NoMoreData); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__NoMoreData); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_2);
-      __pyx_t_3 = PyInt_FromLong(__pyx_v_ret); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyInt_FromLong(__pyx_v_ret); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
-      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(((PyObject *)__pyx_t_4));
       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_3);
       PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
       __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
       __pyx_t_4 = 0;
-      __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       __Pyx_GOTREF(__pyx_t_4);
       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
       __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
       goto __pyx_L5;
     }
     __pyx_L5:;
 
-    /* "ffvideo.pyx":224
+    /* "ffvideo.pyx":226
  *                 raise NoMoreData("Unable to read frame. [%d]" % ret)
  * 
  *             if self.packet.stream_index == self.streamno:             # <<<<<<<<<<<<<<
     __pyx_t_1 = (__pyx_v_self->packet.stream_index == __pyx_v_self->streamno);
     if (__pyx_t_1) {
 
-      /* "ffvideo.pyx":225
+      /* "ffvideo.pyx":227
  * 
  *             if self.packet.stream_index == self.streamno:
  *                 with nogil:             # <<<<<<<<<<<<<<
           Py_UNBLOCK_THREADS
           /*try:*/ {
 
-            /* "ffvideo.pyx":227
+            /* "ffvideo.pyx":229
  *                 with nogil:
  *                     ret = avcodec_decode_video2(self.codec_ctx, self.frame,
  *                                                &frame_finished, &self.packet)             # <<<<<<<<<<<<<<
             __pyx_v_ret = avcodec_decode_video2(__pyx_v_self->codec_ctx, __pyx_v_self->frame, (&__pyx_v_frame_finished), (&__pyx_v_self->packet));
           }
 
-          /* "ffvideo.pyx":225
+          /* "ffvideo.pyx":227
  * 
  *             if self.packet.stream_index == self.streamno:
  *                 with nogil:             # <<<<<<<<<<<<<<
           }
       }
 
-      /* "ffvideo.pyx":228
+      /* "ffvideo.pyx":230
  *                     ret = avcodec_decode_video2(self.codec_ctx, self.frame,
  *                                                &frame_finished, &self.packet)
  *                 if ret < 0:             # <<<<<<<<<<<<<<
       __pyx_t_1 = (__pyx_v_ret < 0);
       if (__pyx_t_1) {
 
-        /* "ffvideo.pyx":229
+        /* "ffvideo.pyx":231
  *                                                &frame_finished, &self.packet)
  *                 if ret < 0:
  *                     av_free_packet(&self.packet)             # <<<<<<<<<<<<<<
  */
         av_free_packet((&__pyx_v_self->packet));
 
-        /* "ffvideo.pyx":230
+        /* "ffvideo.pyx":232
  *                 if ret < 0:
  *                     av_free_packet(&self.packet)
  *                     raise IOError("Unable to decode video picture: %d" % ret)             # <<<<<<<<<<<<<<
  * 
  *                 if self.packet.pts == AV_NOPTS_VALUE:
  */
-        __pyx_t_4 = PyInt_FromLong(__pyx_v_ret); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = PyInt_FromLong(__pyx_v_ret); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_4);
-        __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(((PyObject *)__pyx_t_3));
         __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_4);
         PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
         __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
         __pyx_t_3 = 0;
-        __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         __Pyx_GOTREF(__pyx_t_3);
         __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
         __Pyx_Raise(__pyx_t_3, 0, 0, 0);
         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
         goto __pyx_L12;
       }
       __pyx_L12:;
 
-      /* "ffvideo.pyx":232
+      /* "ffvideo.pyx":234
  *                     raise IOError("Unable to decode video picture: %d" % ret)
  * 
  *                 if self.packet.pts == AV_NOPTS_VALUE:             # <<<<<<<<<<<<<<
       __pyx_t_1 = (__pyx_v_self->packet.pts == AV_NOPTS_VALUE);
       if (__pyx_t_1) {
 
-        /* "ffvideo.pyx":233
+        /* "ffvideo.pyx":235
  * 
  *                 if self.packet.pts == AV_NOPTS_VALUE:
  *                     pts = self.packet.dts             # <<<<<<<<<<<<<<
       }
       /*else*/ {
 
-        /* "ffvideo.pyx":235
+        /* "ffvideo.pyx":237
  *                     pts = self.packet.dts
  *                 else:
  *                     pts = self.packet.pts             # <<<<<<<<<<<<<<
     }
     __pyx_L6:;
 
-    /* "ffvideo.pyx":237
+    /* "ffvideo.pyx":239
  *                     pts = self.packet.pts
  * 
  *             av_free_packet(&self.packet)             # <<<<<<<<<<<<<<
     av_free_packet((&__pyx_v_self->packet));
   }
 
-  /* "ffvideo.pyx":243
+  /* "ffvideo.pyx":245
  * #        print "ts=%.3f" % av_q2d(av_mul_q(AVRational(pts-self.stream.start_time, 1), self.stream.time_base))
  * 
  *         self.frame.pts = av_rescale_q(pts-self.stream.start_time,             # <<<<<<<<<<<<<<
  */
   __pyx_v_self->frame->pts = av_rescale_q((__pyx_v_pts - __pyx_v_self->stream->start_time), __pyx_v_self->stream->time_base, AV_TIME_BASE_Q);
 
-  /* "ffvideo.pyx":246
+  /* "ffvideo.pyx":248
  *                                       self.stream.time_base, AV_TIME_BASE_Q)
  *         self.frame.display_picture_number = <int>av_q2d(
  *             av_mul_q(av_mul_q(AVRational(pts - self.stream.start_time, 1),             # <<<<<<<<<<<<<<
   __pyx_t_6.num = (__pyx_v_pts - __pyx_v_self->stream->start_time);
   __pyx_t_6.den = 1;
 
-  /* "ffvideo.pyx":245
+  /* "ffvideo.pyx":247
  *         self.frame.pts = av_rescale_q(pts-self.stream.start_time,
  *                                       self.stream.time_base, AV_TIME_BASE_Q)
  *         self.frame.display_picture_number = <int>av_q2d(             # <<<<<<<<<<<<<<
  */
   __pyx_v_self->frame->display_picture_number = ((int)av_q2d(av_mul_q(av_mul_q(__pyx_t_6, __pyx_v_self->stream->r_frame_rate), __pyx_v_self->stream->time_base)));
 
-  /* "ffvideo.pyx":250
+  /* "ffvideo.pyx":252
  *                      self.stream.time_base)
  *         )
  *         return self.frame.pts             # <<<<<<<<<<<<<<
  *     def dump_next_frame(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_3 = PyLong_FromLongLong(__pyx_v_self->frame->pts); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyLong_FromLongLong(__pyx_v_self->frame->pts); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   __pyx_r = __pyx_t_3;
   __pyx_t_3 = 0;
   return __pyx_r;
 }
 
-/* "ffvideo.pyx":252
+/* "ffvideo.pyx":254
  *         return self.frame.pts
  * 
  *     def dump_next_frame(self):             # <<<<<<<<<<<<<<
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("dump_next_frame", 0);
 
-  /* "ffvideo.pyx":253
+  /* "ffvideo.pyx":255
  * 
  *     def dump_next_frame(self):
  *         pts = self.__decode_next_frame()             # <<<<<<<<<<<<<<
  *         print "pts=%d, frameno=%d" % (pts, self.frameno)
  *         print "f.pts=%s, " % (self.frame.pts,)
  */
-  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____decode_next_frame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____decode_next_frame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_v_pts = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "ffvideo.pyx":254
+  /* "ffvideo.pyx":256
  *     def dump_next_frame(self):
  *         pts = self.__decode_next_frame()
  *         print "pts=%d, frameno=%d" % (pts, self.frameno)             # <<<<<<<<<<<<<<
  *         print "f.pts=%s, " % (self.frame.pts,)
  *         print "codec_ctx.frame_number=%s" % self.codec_ctx.frame_number
  */
-  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->frameno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->frameno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __Pyx_INCREF(__pyx_v_pts);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pts);
   PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __pyx_t_2 = 0;
-  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "ffvideo.pyx":255
+  /* "ffvideo.pyx":257
  *         pts = self.__decode_next_frame()
  *         print "pts=%d, frameno=%d" % (pts, self.frameno)
  *         print "f.pts=%s, " % (self.frame.pts,)             # <<<<<<<<<<<<<<
  *         print "codec_ctx.frame_number=%s" % self.codec_ctx.frame_number
  *         print "f.coded_picture_number=%s, f.display_picture_number=%s" % \
  */
-  __pyx_t_2 = PyLong_FromLongLong(__pyx_v_self->frame->pts); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyLong_FromLongLong(__pyx_v_self->frame->pts); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __pyx_t_2 = 0;
-  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
-  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
-  /* "ffvideo.pyx":256
+  /* "ffvideo.pyx":258
  *         print "pts=%d, frameno=%d" % (pts, self.frameno)
  *         print "f.pts=%s, " % (self.frame.pts,)
  *         print "codec_ctx.frame_number=%s" % self.codec_ctx.frame_number             # <<<<<<<<<<<<<<
  *         print "f.coded_picture_number=%s, f.display_picture_number=%s" % \
  *               (self.frame.coded_picture_number, self.frame.display_picture_number)
  */
-  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->codec_ctx->frame_number); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->codec_ctx->frame_number); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_24), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_24), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_1));
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
 
-  /* "ffvideo.pyx":258
+  /* "ffvideo.pyx":260
  *         print "codec_ctx.frame_number=%s" % self.codec_ctx.frame_number
  *         print "f.coded_picture_number=%s, f.display_picture_number=%s" % \
  *               (self.frame.coded_picture_number, self.frame.display_picture_number)             # <<<<<<<<<<<<<<
  * 
  *     def current(self):
  */
-  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->frame->coded_picture_number); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyInt_FromLong(__pyx_v_self->frame->coded_picture_number); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->frame->display_picture_number); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->frame->display_picture_number); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_2);
   __pyx_t_1 = 0;
   __pyx_t_2 = 0;
-  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_25), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_25), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
-  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   return __pyx_r;
 }
 
-/* "ffvideo.pyx":260
+/* "ffvideo.pyx":262
  *               (self.frame.coded_picture_number, self.frame.display_picture_number)
  * 
  *     def current(self):             # <<<<<<<<<<<<<<
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("current", 0);
 
-  /* "ffvideo.pyx":266
+  /* "ffvideo.pyx":268
  *         cdef SwsContext *img_convert_ctx
  * 
  *         scaled_frame = avcodec_alloc_frame()             # <<<<<<<<<<<<<<
  */
   __pyx_v_scaled_frame = avcodec_alloc_frame();
 
-  /* "ffvideo.pyx":267
+  /* "ffvideo.pyx":269
  * 
  *         scaled_frame = avcodec_alloc_frame()
  *         if scaled_frame == NULL:             # <<<<<<<<<<<<<<
   __pyx_t_1 = (__pyx_v_scaled_frame == NULL);
   if (__pyx_t_1) {
 
-    /* "ffvideo.pyx":268
+    /* "ffvideo.pyx":270
  *         scaled_frame = avcodec_alloc_frame()
  *         if scaled_frame == NULL:
  *             raise MemoryError("Unable to allocate new frame")             # <<<<<<<<<<<<<<
  * 
  *         buflen = avpicture_get_size(self.ffmpeg_frame_mode,
  */
-    __pyx_t_2 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_2 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_2);
     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "ffvideo.pyx":271
+  /* "ffvideo.pyx":273
  * 
  *         buflen = avpicture_get_size(self.ffmpeg_frame_mode,
  *                                     self.frame_width, self.frame_height)             # <<<<<<<<<<<<<<
  */
   __pyx_v_buflen = avpicture_get_size(__pyx_v_self->ffmpeg_frame_mode, __pyx_v_self->frame_width, __pyx_v_self->frame_height);
 
-  /* "ffvideo.pyx":272
+  /* "ffvideo.pyx":274
  *         buflen = avpicture_get_size(self.ffmpeg_frame_mode,
  *                                     self.frame_width, self.frame_height)
  *         data = PyBuffer_New(buflen)             # <<<<<<<<<<<<<<
  *         PyObject_AsCharBuffer(data, &data_ptr, &buflen)
  * 
  */
-  __pyx_t_2 = PyBuffer_New(__pyx_v_buflen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyBuffer_New(__pyx_v_buflen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_v_data = __pyx_t_2;
   __pyx_t_2 = 0;
 
-  /* "ffvideo.pyx":273
+  /* "ffvideo.pyx":275
  *                                     self.frame_width, self.frame_height)
  *         data = PyBuffer_New(buflen)
  *         PyObject_AsCharBuffer(data, &data_ptr, &buflen)             # <<<<<<<<<<<<<<
  * 
  *         with nogil:
  */
-  __pyx_t_3 = PyObject_AsCharBuffer(__pyx_v_data, (&__pyx_v_data_ptr), (&__pyx_v_buflen)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "ffvideo.pyx":275
+  __pyx_t_3 = PyObject_AsCharBuffer(__pyx_v_data, (&__pyx_v_data_ptr), (&__pyx_v_buflen)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "ffvideo.pyx":277
  *         PyObject_AsCharBuffer(data, &data_ptr, &buflen)
  * 
  *         with nogil:             # <<<<<<<<<<<<<<
       Py_UNBLOCK_THREADS
       /*try:*/ {
 
-        /* "ffvideo.pyx":277
+        /* "ffvideo.pyx":279
  *         with nogil:
  *             avpicture_fill(<AVPicture *>scaled_frame, <uint8_t *>data_ptr,
  *                        self.ffmpeg_frame_mode, self.frame_width, self.frame_height)             # <<<<<<<<<<<<<<
  */
         avpicture_fill(((struct AVPicture *)__pyx_v_scaled_frame), ((__pyx_t_6ffmpeg_uint8_t *)__pyx_v_data_ptr), __pyx_v_self->ffmpeg_frame_mode, __pyx_v_self->frame_width, __pyx_v_self->frame_height);
 
-        /* "ffvideo.pyx":282
+        /* "ffvideo.pyx":284
  *                 self.width, self.height, self.codec_ctx.pix_fmt,
  *                 self.frame_width, self.frame_height, self.ffmpeg_frame_mode,
  *                 self.scale_mode, NULL, NULL, NULL)             # <<<<<<<<<<<<<<
  */
         __pyx_v_img_convert_ctx = sws_getContext(__pyx_v_self->width, __pyx_v_self->height, __pyx_v_self->codec_ctx->pix_fmt, __pyx_v_self->frame_width, __pyx_v_self->frame_height, __pyx_v_self->ffmpeg_frame_mode, __pyx_v_self->scale_mode, NULL, NULL, NULL);
 
-        /* "ffvideo.pyx":286
+        /* "ffvideo.pyx":288
  *             sws_scale(img_convert_ctx,
  *                 self.frame.data, self.frame.linesize, 0, self.height,
  *                 scaled_frame.data, scaled_frame.linesize)             # <<<<<<<<<<<<<<
  */
         sws_scale(__pyx_v_img_convert_ctx, __pyx_v_self->frame->data, __pyx_v_self->frame->linesize, 0, __pyx_v_self->height, __pyx_v_scaled_frame->data, __pyx_v_scaled_frame->linesize);
 
-        /* "ffvideo.pyx":288
+        /* "ffvideo.pyx":290
  *                 scaled_frame.data, scaled_frame.linesize)
  * 
  *             sws_freeContext(img_convert_ctx)             # <<<<<<<<<<<<<<
  */
         sws_freeContext(__pyx_v_img_convert_ctx);
 
-        /* "ffvideo.pyx":289
+        /* "ffvideo.pyx":291
  * 
  *             sws_freeContext(img_convert_ctx)
  *             av_free(scaled_frame)             # <<<<<<<<<<<<<<
         av_free(__pyx_v_scaled_frame);
       }
 
-      /* "ffvideo.pyx":275
+      /* "ffvideo.pyx":277
  *         PyObject_AsCharBuffer(data, &data_ptr, &buflen)
  * 
  *         with nogil:             # <<<<<<<<<<<<<<
       }
   }
 
-  /* "ffvideo.pyx":291
+  /* "ffvideo.pyx":293
  *             av_free(scaled_frame)
  * 
  *         return VideoFrame(data, self.frame_size, self.frame_mode,             # <<<<<<<<<<<<<<
  *                           frameno=self.frame.display_picture_number)
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__frame_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__frame_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__frame_mode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__frame_mode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_INCREF(__pyx_v_data);
   PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_data);
   __Pyx_GIVEREF(__pyx_t_4);
   __pyx_t_2 = 0;
   __pyx_t_4 = 0;
-  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_4));
 
-  /* "ffvideo.pyx":292
+  /* "ffvideo.pyx":294
  * 
  *         return VideoFrame(data, self.frame_size, self.frame_mode,
  *                           timestamp=<double>self.frame.pts/<double>AV_TIME_BASE,             # <<<<<<<<<<<<<<
  */
   if (unlikely(((double)AV_TIME_BASE) == 0)) {
     PyErr_Format(PyExc_ZeroDivisionError, "float division");
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   }
-  __pyx_t_2 = PyFloat_FromDouble((((double)__pyx_v_self->frame->pts) / ((double)AV_TIME_BASE))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyFloat_FromDouble((((double)__pyx_v_self->frame->pts) / ((double)AV_TIME_BASE))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__timestamp), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__timestamp), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
 
-  /* "ffvideo.pyx":293
+  /* "ffvideo.pyx":295
  *         return VideoFrame(data, self.frame_size, self.frame_mode,
  *                           timestamp=<double>self.frame.pts/<double>AV_TIME_BASE,
  *                           frameno=self.frame.display_picture_number)             # <<<<<<<<<<<<<<
  * 
  *     def get_frame_no(self, frameno):
  */
-  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->frame->display_picture_number); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyInt_FromLong(__pyx_v_self->frame->display_picture_number); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
-  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__frameno), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__frameno), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;