Skip to content

Instantly share code, notes, and snippets.

@valgur
Created February 12, 2023 18:31
Show Gist options
  • Save valgur/dd37b77f59ebb3483e0b0489b4277534 to your computer and use it in GitHub Desktop.
Save valgur/dd37b77f59ebb3483e0b0489b4277534 to your computer and use it in GitHub Desktop.
import av
# packets = [H.264 packets as byte arrays]
codec = av.CodecContext.create('h264', 'r')
for packet in packets:
for avpacket in codec.parse(packet):
frames = codec.decode(avpacket)
print(frames)
# Or, can also simply do
frames = av.open("blah.h264", 'rb').demux()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment