Previous response had warnings:
WARNINGS: - Extra text detected before JSON object
- Extra text detected after JSON object

New Terminal Output:

root@d7299c7f5982:/app# python3 -c "
> import struct
> with open('/app/frames.tza', 'rb') as f:
>     magic = f.read(4)
>     width, height = struct.unpack('<HH', f.read(4))
>     n_frames, max_bytes = struct.unpack('<II', f.read(8))
>     frames = [f.read(width * height) for _ in range(n_frames)]
>
> prev = b' ' * (width * height)
> total_changes = 0
> max_changes = 0
> min_changes = width * height
> for frame in frames:
>     changes = sum(1 for i in range(width * height) if prev[i] != frame[i])
>     total_changes += changes
>     max_changes = max(max_changes, changes)
>     min_changes = min(min_changes, changes)
>     prev = frame
>
> print(f'Average changes per frame: {total_changes / n_frames:.1f}')
> print(f'Max changes in a frame: {max_changes}')
> print(f'Min changes in a frame: {min_changes}')
> print(f'Total changes: {total_changes}')
> print(f'Budget per frame: {max_bytes / n_frames:.1f}')
> "
Average changes per frame: 131.1
Max changes in a frame: 901
Min changes in a frame: 4
Total changes: 157316
Budget per frame: 57.5
root@d7299c7f5982:/app#
