PyAV-Org / PyAV

Pythonic bindings for FFmpeg's libraries.
https://pyav.basswood-io.com/
BSD 3-Clause "New" or "Revised" License
2.52k stars 365 forks source link

PyAV doesn't seem to work with 8-bit grayscale FFV1 video #76

Closed ksze closed 9 years ago

ksze commented 9 years ago

I'm trying to work with YUYV H.264, 16-bit grayscale FFV1, and 8-bit grayscale FFV1 videos.

PyAV seems to have no big problem reading YUYV H.264 and 16-bit grayscale FFV1 from a variety of different container formats so far.

However, when I try to make it read 8-bit grayscale FFV1 video from .avi or .nut files, I get this (in iPython):

In [1]: import av

In [2]: container = av.open('/home/ksze/bidx-8-bit.nut')
No handlers could be found for logger "libav.nut"

In [3]: for p in container.demux():
   ...:     for frame in p.decode():
   ...:         print frame.time
   ...:
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-3-2b78bf2ce9e8> in <module>()
      1 for p in container.demux():
----> 2     for frame in p.decode():
      3         print frame.time
      4

/home/ksze/PyAV/av/packet.so in av.packet.Packet.decode (src/av/packet.c:1187)()

/home/ksze/PyAV/av/stream.so in av.stream.Stream.decode (src/av/stream.c:3934)()

/home/ksze/PyAV/av/video/stream.so in av.video.stream.VideoStream._decode_one (src/av/video/stream.c:1764)()

/home/ksze/PyAV/av/video/frame.so in av.video.frame.VideoFrame._init_properties (src/av/video/frame.c:1757)()

/home/kal/PyAV/av/frame.so in av.frame.Frame._init_planes (src/av/frame.c:1861)()

/home/ksze/PyAV/av/video/plane.so in av.video.plane.VideoPlane.__cinit__ (src/av/video/plane.c:1245)()

RuntimeError: could not find plane 1 of <av.VideoFormat gray, 512x424>
mikeboers commented 9 years ago

Can you point to any of the FATE suite that exhibits this behaviour, or provide a small sample?

Also, try logging.basicConfig() to see what the "nut" container is trying to say.

(I'm glad to have put in that RuntimeError, though. =P)

ksze commented 9 years ago

By small sample, you mean a small video clip?

mikeboers commented 9 years ago

Yes.

I think I made a bad assumption about the definition of video planes that works 99% of the time, but breaks down in this case. So... I just need to poke at it for a bit. =P

ksze commented 9 years ago

Here is a sample: https://www.dropbox.com/s/bnmxgss4zndm9bs/2015-01-26%2014-06-38.bidx.avi?dl=0

mikeboers commented 9 years ago

I'll try to figure this out today.

If I can't find something in the FATE suite that exhibits the same problem, may I bundle your sample in our own test suite?

mikeboers commented 9 years ago

I just pushed 444dd68194, which might address this problem.

ksze commented 9 years ago

PyAV can iterate through the frames in my 8-bit FFV1 videos now.