Skip to content

Instantly share code, notes, and snippets.

@figgis
figgis / gist:d3cff69be815491eff1ac9338aa78add
Last active May 21, 2024 13:40
H264 extract SEI using FFMPEG
// It's actually quite simple to extract unregistered sei data using ffmpeg, but I couln't find any documentation about how it's done
AVFrameSideData *sd;
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_SEI_UNREGISTERED);
if (sd) {
// First 15 bytes is the uuid, unregistered payload start at index 16 and the
// total size is given by sd->size
printf("side-data size %ld first-byte %u\n", sd->size, sd->data[16]);
@figgis
figgis / vqm.py
Last active April 18, 2024 15:55
vqm 2 xlsx
#!/usr/bin/env python
#
# vqm Run and parse the output of mitsuLinuxMultithread.
# Generate a xlsx-file with all the data as well as a summary sheet.
# Tested on Linux only.
#
# USAGE: vqm path
#
# NOTE: YCbcr files needs to be adhere to the following naming convention:
# NAME_WIDTHxHEIGHT_FPS_...yuv
@figgis
figgis / Makefile
Last active April 8, 2020 08:15
ffmpeg qp values
# use pkg-config for getting CFLAGS and LDLIBS
FFMPEG_LIBS= libavdevice \
libavformat \
libavfilter \
libavcodec \
libswresample \
libswscale \
libavutil \
CFLAGS += -Wall -g
@figgis
figgis / parse_h265.py
Last active June 14, 2023 08:46
H.265/HEVC bitstream parser
#!/usr/bin/env python
"""
- ae(v): context-adaptive arithmetic entropy-coded syntax element. The parsing process for this descriptor is
specified in clause 9.3.
- b(8): byte having any pattern of bit string (8 bits). The parsing process
for this descriptor is specified by the return value of the function
read_bits( 8 ).
- f(n): fixed-pattern bit string using n bits written (from left to right)
@figgis
figgis / rgb.py
Created April 23, 2012 19:56
YCbCr viewer
#!/usr/bin/env python
import pygame
import Image
import sys
W = 352
H = 288
WH = (W, H)
pygame.init()
@figgis
figgis / overlay.py
Created April 23, 2012 19:53
YCbCr viewer
#!/usr/bin/env python
import pygame
W = 352
H = 288
WH = (W, H)
pygame.init()
screen = pygame.display.set_mode(WH)
@figgis
figgis / username.py
Created July 1, 2011 09:23
user validation
#!/usr/bin/env python
import string
def check_length(s):
'''return length
>>> check_length('this is a string')
16
'''
@figgis
figgis / content
Created June 21, 2011 07:35
h264 parser
Decoding foreman_qcif_030kbps_15fps.264
*** Decoding NAL number 0 ***
NAL decoded
*** Decoding NAL number 1 ***
NAL decoded
*** Decoding NAL number 2 ***
Bytes picture (VCL only): 851