packet.decode() sometimes returns None
Created by: orf
Hello,
We have come across a video that appears to make packet.decode() return None instead of a list. When run with the simple code below it fails with a Nonetype object is not iterable error. As far as I can tell several packets at the end of the video return None. I can't post the video publicly, but I may be able to send it privately if you wish to reproduce. This happens on the latest master, as well as the latest release.
As far as I can tell no documentation or examples say that packet.decode() may return None? I'm guessing it's something to do with the 3rd and 4th streams with no data in the file.
Script:
container = av.open('test.mov')
for packet in container.demux():
for frame in packet.decode():
pass
FFMPeg video information:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mov':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2018-06-28T16:29:39.000000Z
com.apple.quicktime.location.ISO6709: +38.7235-009.1497+067.471/
com.apple.quicktime.make: Apple
com.apple.quicktime.model: iPhone 6
com.apple.quicktime.software: 11.4
com.apple.quicktime.creationdate: 2018-06-28T17:15:03+0100
Duration: 00:00:06.74, start: 0.000000, bitrate: 3357 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 99 kb/s (default)
Metadata:
creation_time : 2018-06-28T16:29:39.000000Z
handler_name : Core Media Data Handler
Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 360x640 [SAR 1:1 DAR 9:16], 3223 kb/s, 29.99 fps, 29.97 tbr, 600 tbn, 1200 tbc (default)
Metadata:
creation_time : 2018-06-28T16:29:39.000000Z
handler_name : Core Media Data Handler
encoder : H.264
Stream #0:2(und): Data: none (mebx / 0x7862656D), 22 kb/s (default)
Metadata:
creation_time : 2018-06-28T16:29:39.000000Z
handler_name : Core Media Data Handler
Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
Metadata:
creation_time : 2018-06-28T16:29:39.000000Z
handler_name : Core Media Data Handler