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

ffmpeg_parse_infos failed get duration with Quicktime XMP metadata #207

Closed
maty974 opened this issue Sep 14, 2015 · 3 comments
Closed

ffmpeg_parse_infos failed get duration with Quicktime XMP metadata #207

maty974 opened this issue Sep 14, 2015 · 3 comments
Labels
lib-FFmpeg Issues pertaining to dependency FFmpeg. lib-misc Issues pertaining to misc. 3rd-party libraries.

Comments

@maty974
Copy link

maty974 commented Sep 14, 2015

Hi

I was trying to create a VideoFileClip() with a custom Quicktime .mov format, and
it seems that MoviePy don't like some metadata embedded in the file :P

: xmpDM:duration="0:32.303"

                    :       <xmpDM:duration
                    :        xmpDM:value="130667"
                    :        xmpDM:scale="1/1000"/>
                    :       <xmpMM:History>

xmpDM:duration="10584000000"

Maybe its causing a bug here ?

https://github.com/Zulko/moviepy/blob/master/moviepy/video/io/ffmpeg_reader.py#L261-L270

@maty974
Copy link
Author

maty974 commented Sep 14, 2015

Here is a full output of ffmpeg infos of a file that contain xmp metadata

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/110_PREV_FINAL.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2015-09-14 14:57:32
    xmp             : <?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
                    : <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.0-c060 61.136967, 2010/06/15-10:43:27        ">
                    :  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
                    :   <rdf:Description rdf:about=""
                    :     xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
                    :     xmlns:xmpDM="http://ns.adobe.com/xmp/1.0/DynamicMedia/"
                    :     xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#"
                    :     xmlns:dc="http://purl.org/dc/elements/1.1/"
                    :    xmpMM:DocumentID="xmp.did:39FA818BE85AE511B9009F953BF804AA"
                    :    xmpMM:InstanceID="xmp.iid:39FA818BE85AE511B9009F953BF804AA"
                    :    xmpDM:videoFrameRate="24.000000"
                    :    xmpDM:videoFieldOrder="Progressive"
                    :    xmpDM:videoPixelAspectRatio="1/1"
                    :    xmpDM:audioSampleRate="44100"
                    :    xmpDM:audioSampleType="16Int"
                    :    xmpDM:audioChannelType="Mono"
                    :    dc:format="QuickTime">
                    :    <xmpDM:startTimecode
                    :     xmpDM:timeValue="00:00:00:00"
                    :     xmpDM:timeFormat="24Timecode"/>
                    :    <xmpDM:altTimecode
                    :     xmpDM:timeValue="00:00:00:00"
                    :     xmpDM:timeFormat="24Timecode"/>
                    :    <xmpDM:videoFrameSize
                    :     stDim:w="768"
                    :     stDim:h="576"
                    :     stDim:unit="pixel"/>
                    :   </rdf:Description>
                    :  </rdf:RDF>
                    : </x:xmpmeta>
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                                                                                                     
                    :                            
                    : <?xpacket end="w"?>
  Duration: 00:02:10.67, start: 0.000000, bitrate: 26287 kb/s
    Stream #0:0(eng): Video: mjpeg (jpeg / 0x6765706A), yuvj422p(pc, bt470bg), 768x576 [SAR 72:72 DAR 4:3], 26213 kb/s, 24 fps, 24 tbr, 24 tbn, 24 tbc (default)
    Metadata:
      creation_time   : 2015-09-14 14:57:32
      handler_name    : Gestionnaire d�alias Apple
      encoder         : Photo - JPEG
      timecode        : 00:00:00:00
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 64 kb/s (default)
    Metadata:
      creation_time   : 2015-09-14 14:57:32
      handler_name    : Gestionnaire d�alias Apple
      timecode        : 00:00:00:00
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2015-09-14 14:58:24
      handler_name    : Gestionnaire d�alias Apple
      timecode        : 00:00:00:00
At least one output file must be specified

In this example another error occur in MoviePy:

Traceback (most recent call last):
  File "/home/test.py", line 27, in <module>
    "/home/110_PREV_FINAL.mov", verbose=True)
  File "/home/moviepy/0.2.2.11/common/moviepy/video/io/VideoFileClip.py", line 55, in __init__
    reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt)
  File "//home/moviepy/0.2.2.11/common/moviepy/video/io/ffmpeg_reader.py", line 32, in __init__
    infos = ffmpeg_parse_infos(filename, print_infos, check_duration)
  File "//home/moviepy/0.2.2.11/common/moviepy/video/io/ffmpeg_reader.py", line 241, in ffmpeg_parse_infos
    infos = proc.stderr.read().decode('utf8')
  File "/home/applications/anaconda/2.3.0/linux64/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 5985: invalid start byte
Exception AttributeError: "VideoFileClip instance has no attribute 'reader'" in <bound method VideoFileClip.__del__ of <moviepy.video.io.VideoFileClip.VideoFileClip instance at 0x7f6bdd841fc8>> ignored

@keikoro keikoro added the lib-misc Issues pertaining to misc. 3rd-party libraries. label Nov 25, 2017
@daniestrella1
Copy link

The error can be reproduced editing a video with iMovie. This will add a strange chars on video metadata like this (see com.apple.quicktime.artwork field):

ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/Shared/Development/django-files/cheerapp/files/video_clips/3b624062-c4bd-4292-9cfc-eef7683c1482.MOV':
  Metadata:
    major_brand     : qt  
    minor_version   : 0
    compatible_brands: qt  
    creation_time   : 2019-06-02T18:31:21.000000Z
    com.apple.quicktime.artwork: ����
    com.apple.quicktime.is-montage: iMovie
  Duration: 00:01:12.50, start: 0.000000, bitrate: 4753 kb/s
    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 239 kb/s (default)
    Metadata:
      creation_time   : 2019-06-02T18:31:21.000000Z
      handler_name    : Core Media Data Handler
    Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 4500 kb/s, 30 fps, 30 tbr, 600 tbn, 1200 tbc (default)
    Metadata:
      creation_time   : 2019-06-02T18:31:21.000000Z
      handler_name    : Core Media Data Handler
      encoder         : H.264
At least one output file must be specified

@mondeja mondeja added the lib-FFmpeg Issues pertaining to dependency FFmpeg. label Jan 23, 2021
@mondeja
Copy link
Collaborator

mondeja commented Jan 23, 2021

This was fixed in #959.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lib-FFmpeg Issues pertaining to dependency FFmpeg. lib-misc Issues pertaining to misc. 3rd-party libraries.
Projects
None yet
Development

No branches or pull requests

4 participants