有没有办法解析 HEVC 比特流文件?
我希望能够创建一个新的比特流文件,其中包含从原始比特流文件中选择的最终单元数据包。
编辑:我插入了我的代码。请在此处找到我的比特流文件。
#library for searching in a string
import re
#library to keep dictionary order
import collections
import bitstring
from bitstring import BitStream, BitArray, ConstBitStream, pack
from bitstring import ByteStore, offsetcopy
#read bitstream file
s = BitStream(filename='11LTCCA_560x416_50Hz_8b_P420_GOP8_IP48_200frms_QP28.HEVC.str')
#find no of packets
pcks = list(s.findall('0x000001', bytealigned=True))
print len(pcks)
#set the current position, in the beginning of the nal unit.
s.pos =pcks[0]-8
print s.pos
#find the number of bits of first nal packet
no_p = pcks[1]-pcks[0]
forbidden_zero_bit = s.read(1)
nal_unit_type = s.read('uint:6')
# go to the beginning of the second nal unit
s.read(no_p)
# print nal unit type of the 1st packet
print nal_unit_type
no_p = pcks[2]-pcks[1]
s.pos = pcks[1]-8
print s.pos
forbidden_zero_bit = s.read(1)
nal_unit_type = s.read('uint:6')
s.read(no_p)
print nal_unit_type