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

Failed to read duration of file, Samsung S6 MP4s #226

Closed
michaelhelmick opened this issue Nov 3, 2015 · 3 comments
Closed

Failed to read duration of file, Samsung S6 MP4s #226

michaelhelmick opened this issue Nov 3, 2015 · 3 comments

Comments

@michaelhelmick
Copy link

moviepy==0.2.2.11

I printed out each line of the file:

ffmpeg version 2.6.3-tessus Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --as=yasm --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
libavutil      54. 20.100 / 54. 20.100
libavcodec     56. 26.100 / 56. 26.100
libavformat    56. 25.101 / 56. 25.101
libavdevice    56.  4.100 / 56.  4.100
libavfilter     5. 11.102 /  5. 11.102
libswscale      3.  1.101 /  3.  1.101
libswresample   1.  1.100 /  1.  1.100
libpostproc    53.  3.100 / 53.  3.100
mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa73b012800] error reading header2015-11-03 16:31:57,489: WARNING/Worker-2] /var/folders/l7/cpczdrrs7znf87rhqj2hd78c0000gn/T/tmpoduvHA: End of file

File: https://www.dropbox.com/s/o6r4tbc1see7zf8/tixhr-1990104484.mp4?dl=0

It looks like there is no "Duration :" in the header, so this (https://github.com/Zulko/moviepy/blob/master/moviepy/video/io/ffmpeg_reader.py#L264) fails with List index out of range

Even if I skip that if statement and explicitly set result['duration'] to something random (float(5.31)), it fails later down the line here: https://github.com/Zulko/moviepy/blob/master/moviepy/video/io/ffmpeg_reader.py#L273

Any idea why the headers might be corrupt?

@michaelhelmick
Copy link
Author

Here's some information from VLC

screenshot 2015-11-04 10 42 13

@michaelhelmick
Copy link
Author

This is another video that gives the same "error reading headers" (from a Samsung S3) when trying to use MoviePy, but it succeeds if I use ffmpeg from CLI

ffmpeg -i test.mp4 -ss 00:00:01.000 -vframes 1 output.png
ffmpeg version N-76461-gfd0bf45 Copyright (c) 2000-2015 the FFmpeg developers
  built with Apple LLVM version 7.0.0 (clang-700.0.72)
  configuration: --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid
  libavutil      55.  5.100 / 55.  5.100
  libavcodec     57. 14.100 / 57. 14.100
  libavformat    57. 14.100 / 57. 14.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 14.101 /  6. 14.101
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.100 /  2.  0.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 0
    compatible_brands: isom3gp4
    creation_time   : 2015-11-03 21:46:07
  Duration: 00:00:06.83, start: 0.000000, bitrate: 15118 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 14937 kb/s, 29.88 fps, 30 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      rotate          : 90
      creation_time   : 2015-11-03 21:46:07
      handler_name    : VideoHandle
      encoder         :
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 110 kb/s (default)
    Metadata:
      creation_time   : 2015-11-03 21:46:07
      handler_name    : SoundHandle
Output #0, image2, to 'output.png':
  Metadata:
    major_brand     : isom
    minor_version   : 0
    compatible_brands: isom3gp4
    encoder         : Lavf57.14.100
    Stream #0:0(eng): Video: png, rgb24, 1080x1920, q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandle
      creation_time   : 2015-11-03 21:46:07
      encoder         : Lavc57.14.100 png
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> png (native))
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.03 bitrate=N/A
video:1803kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

output.png is exactly what I expect... not sure why moviepy can't read the headers. :/

@michaelhelmick
Copy link
Author

It looks like this was my fault.

I was reading in a file from s3 using requests and writing the contents to a tmp file and reading that into VideoFileClip. For some reason, it worked with some files, but wouldn't work with others without a .seek(0) on the new file.

Closing this for now.

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

No branches or pull requests

1 participant