Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'start' #191

Closed
encompass opened this issue Aug 9, 2015 · 5 comments
Closed

AttributeError: 'NoneType' object has no attribute 'start' #191

encompass opened this issue Aug 9, 2015 · 5 comments
Labels
stale For issues lacking activity, whose creators have become unresponsive,... video Related to VideoClip and related classes, or handling of video in general.

Comments

@encompass
Copy link

I am not sure I have everything setup correctly.

This is the error:

 encompass@fallow:~/Projects/video_builder/web2py/applications/video_builder/private$ python         video_test.py
 Traceback (most recent call last):
File "video_test.py", line 5, in <module>
clip = VideoFileClip("test.webm")
File "/usr/local/lib/python2.7/dist-packages/moviepy/video/io/VideoFileClip.py", line 55, in __init__
reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt)
File "/usr/local/lib/python2.7/dist-packages/moviepy/video/io/ffmpeg_reader.py", line 32, in __init__
infos = ffmpeg_parse_infos(filename, print_infos, check_duration)
File "/usr/local/lib/python2.7/dist-packages/moviepy/video/io/ffmpeg_reader.py", line 305, in                                                      ffmpeg_parse_infos
result['video_fps'] = float(line[match.start():match.end()].split(' ')[1])
AttributeError: 'NoneType' object has no attribute 'start'
Exception AttributeError: "VideoFileClip instance has no attribute 'reader'" in <bound method VideoFileClip.__del__ of <moviepy.video.io.VideoFileClip.VideoFileClip instance at 0x7fc3fbcedb48>>     ignored
encompass@fallow:~/Projects/video_builder/web2py/applications/video_builder/private$ 

This in my command:

from moviepy.editor import *
clip = VideoFileClip("test.webm")

My Working Directory Contents:

encompass@fallow:~/Projects/video_builder/web2py/applications/video_builder/private$ ls
appconfig.ini  test.webm  video_test.py  video_test.pyc
encompass@fallow:~/Projects/video_builder/web2py/applications/video_builder/private$

This is my FFMPEG version:

encompass@fallow:~/Projects/video_builder/web2py/applications/video_builder/private$ ffmpeg -version
ffmpeg version 2.5.8-0ubuntu0.15.04.1 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
configuration: --prefix=/usr --extra-version=0ubuntu0.15.04.1 --build-suffix=-ffmpeg --    toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --shlibdir=/usr/lib/x86_64-linux-gnu --    incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-    avresample --enable-avisynth --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --    enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-    libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-    libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libshine --enable-    libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libwavpack -    -enable-libwebp --enable-libxvid --enable-opengl --enable-x11grab --enable-libdc1394 --enable-    libiec61883 --enable-libzvbi --enable-libzmq --enable-frei0r --enable-libvpx --enable-libx264 --enable-    libsoxr --enable-gnutls --enable-openal --enable-libopencv --enable-librtmp --enable-libx265
libavutil      54. 15.100 / 54. 15.100
libavcodec     56. 13.100 / 56. 13.100
libavformat    56. 15.102 / 56. 15.102
libavdevice    56.  3.100 / 56.  3.100
libavfilter     5.  2.103 /  5.  2.103
libavresample   2.  1.  0 /  2.  1.  0
libswscale      3.  1.101 /  3.  1.101
libswresample   1.  1.100 /  1.  1.100
libpostproc    53.  3.100 / 53.  3.100
 encompass@fallow:~/Projects/video_builder/web2py/applications/video_builder/private$ 
@flothesof
Copy link
Contributor

Hi,

I have exactly the same error message than you. By inspecting the point where the exception is raised, I believe the problem is as follows:

  • we want moviepy to open a file from the disk
  • it opens it and tries to extract the FPS information
  • it fails doing so because the header of the file does not contain the information expected by moviepy

In particular, I printed the line moviepy tries to find the FPS information on. It reads:

' Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1440x1080, 90k tbr, 90k tbn, 90k tbc'

Moviepy tried to match a regular expression with FPS in it, while that information is not there. The question is: why isn't the info here in our case?

Can you confirm that you have the same problem? What does the header of your file say?

Best
Florian

@flothesof
Copy link
Contributor

I think I know where this comes from: Moviepy tries to match the first stream in the file. Here I have three streams. Thus it doesn't look for it on the right line. I wonder if this is fixable.

[wmv3 @ 003f8480] Extra data: 8 bits left, value: 0
[mjpeg @ 04d7dfe0] ignoring invalid SAR: 0/0
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, asf, from 'Media1.wmv':
Metadata:
WMFSDKNeeded : 0.0.0.0000
DeviceConformanceTemplate: MP
WMFSDKVersion : 12.0.7601.17514
IsVBR : 0
Duration: 00:00:59.69, start: 0.000000, bitrate: 16816 kb/s
Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1440x1080, 90k tbr, 90k tbn, 90k tbc
Metadata:
comment : Movie/video screen capture
Stream #0:1(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, 2 channels, fltp, 192 kb/s
Stream #0:2(eng): Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 1440x1080, 24000 kb/s, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc
At least one output file must be specified

So there are fps indicated, it's just not where moviepy expects it...

@flothesof
Copy link
Contributor

Additional information: there are two lines containing information about the video. They are:

>lines_video
['    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1440x1080, 90k tbr, 90k tbn, 90k tbc', '    Stream #0:2(eng): Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 1440x1080, 24000 kb/s, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc']

@keikoro keikoro added the video Related to VideoClip and related classes, or handling of video in general. label Dec 17, 2018
@keikoro
Copy link
Collaborator

keikoro commented Dec 17, 2018

@flothesof This is kind of an old issue and I'm trying to close old and stale ones. I'm guessing this problem persists? What would be a solution?

@keikoro keikoro added the stale For issues lacking activity, whose creators have become unresponsive,... label Dec 17, 2018
@flothesof
Copy link
Contributor

Hey @keikoro
I cannot report actualized test results since the test files haven't been uploaded. I think a fix is possible: iterate over the other stream descriptions and match the regular expression looking for the FPS information on these.
However, since the files to replicate the problem haven't been uploaded anywhere (mine included), I would say it's reasonable to close the issue. And if it surfaces again, we could then ask the person to link to the actual file that yields the error and try to resolve it then.

@keikoro keikoro closed this as completed Apr 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale For issues lacking activity, whose creators have become unresponsive,... video Related to VideoClip and related classes, or handling of video in general.
Projects
None yet
Development

No branches or pull requests

3 participants