sbraz/pymediainfo

TypeError - Files when parsed by MediaInfo returning as 'NoneType'

d-elv opened this issue · 2 comments

d-elv commented

Hi there,

First of all I'd like to say what a fantastic package/module/library this is. It's perfect for what I'm trying to achieve!

Unfortunately except for the above snag. When trying to parse certain files I get the below error, claiming that what it's parsed is 'NoneType'. I've done some tests with a few different files, and the only obvious thing I'm seeing is that it relates to the Writing library, all of the files that have issues have the Writing library attribute 'Apple Quicktime'. I was able to get this information via using MediaInfo normally. (Version 20.09)

I suspect these are files made using Adobe Media Encoder, and it could just well be that this isn't in libmediainfo library? Either way, confirmation if that is problem would be greatly appreciated.

I'm running this on an iMac, looking to test on a Windows machine soon.

Here is the error, and some information on the files I scanned, ones that did have errors and ones that didn't.
I have changed the filenames due to sensitivity of the content, rest assured there are no illegal characters in any of the filenames.

THE ERROR

media_info = MediaInfo.parse(input_file)

  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pymediainfo/__init__.py", line 497, in parse
 return cls(info, encoding_errors)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pymediainfo/__init__.py", line 167, in __init__
    self.tracks.append(Track(xml_track))
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pymediainfo/__init__.py", line 86, in __init__
    setattr(self, primary, int(getattr(self, primary)))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Files that have issues:

_filename1.mov_
Format                                   : MPEG-4
Format profile                           : QuickTime
Codec ID                                 : qt   2005.03 (qt  )
File size                                : 450 MiB
Duration                                 : 2 min 42 s
Overall bit rate                         : 23.2 Mb/s
Encoded date                             : UTC 2019-03-05 11:45:51
Tagged date                              : UTC 2019-03-05 11:50:01
Writing library                          : Apple QuickTime
**Video**
ID                                       : 1
Format                                   : AVC

_filename2.mov_
Format                                   : MPEG-4
Format profile                           : QuickTime
Codec ID                                 : qt   2005.03 (qt  )
File size                                : 2.75 GiB
Duration                                 : 2 min 30 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 157 Mb/s
Encoded date                             : UTC 2020-10-08 15:23:37
Tagged date                              : UTC 2020-10-08 15:28:59
Writing library                          : Apple QuickTime 7.7.3
com.apple.quicktime.player.movie.audio.m : (Binary)
**Video**
ID                                       : 1
Format                                   : ProRes

_filename3.mov_
Format                                   : MPEG-4
Format profile                           : QuickTime
Codec ID                                 : qt   2005.03 (qt  )
File size                                : 442 MiB
Duration                                 : 38 s 958 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 95.1 Mb/s
Encoded date                             : UTC 2020-11-25 17:04:50
Tagged date                              : UTC 2020-11-16 17:05:16
Writing library                          : Apple QuickTime
TIM                                      : 01:00:00:00
TSC                                      : 24
TSZ                                      : 1
**Video**
ID                                       : 1
Format                                   : ProRes

Files that don’t have issues:

_filename4.mp4_
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42 (mp42/mp41)
File size                                : 102 MiB
Duration                                 : 42 s 0 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 20.4 Mb/s
Encoded date                             : UTC 2019-08-24 19:47:53
Tagged date                              : UTC 2019-08-24 19:48:41
TIM                                      : 00:00:00:00
TSC                                      : 25
TSZ                                      : 1
Video
ID                                       : 1
Format                                   : AVC

_filename5.mov_
Format                                   : MPEG-4
Format profile                           : QuickTime
Codec ID                                 : qt   0000.02 (qt  )
File size                                : 1.19 MiB
Duration                                 : 10 s 171 ms
Overall bit rate                         : 982 kb/s
Writing application                      : Lavf56.25.101
**Video**
ID                                       : 1
Format                                   : AVC

_filename6.mp4_
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42 (mp42/mp41)
File size                                : 122 MiB
Duration                                 : 38 s 958 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 26.2 Mb/s
Encoded date                             : UTC 2020-11-16 17:04:20
Tagged date                              : UTC 2020-11-16 17:04:34
TIM                                      : 01:00:00:00
TSC                                      : 24000
TSZ                                      : 1000
**Video**
ID                                       : 1
Format                                   : AVC
sbraz commented

Hi, are you using v5.0.3? It looks a lot like the issue I fixed yesterday for #100.

d-elv commented

Yep you're absolutely right, I'd re-installed the package a couple of times yesterday evening when troubleshooting but I guess 5.0.3 hadn't rolled out by then. I'm now up to 5.0.3 and it works like a dream.

Thank you and apologies for repeating a problem! I thought I'd looked for a similar issue but apparently not!