要处理的文件:
此处处理将00的数据干掉。
处理python脚本:
1 dir_fd = open(‘abc.yuv‘,‘rb+‘) 2 tmp_fd = open(‘tmp.yuv‘,‘wb+‘) 3 while True: 4 content = dir_fd.read(1) 5 6 # content.int(‘10‘,16) 7 if content==b‘\x00‘: 8 continue 9 if content==b‘‘: 10 tmp_fd.write("/n") 11 break 12 print(content) 13 tmp_fd.write(content) 14 tmp_fd.flush()
1 dir_fd = open(‘abc.yuv‘,‘rb+‘) 2 tmp_fd = open(‘tmp.yuv‘,‘wb+‘) 3 while True: 4 content = dir_fd.read(1) 5 6 # content.int(‘10‘,16) 7 if content==b‘\x00‘: 8 continue 9 if content==b‘‘: 10 tmp_fd.write("/n") 11 break 12 print(content) 13 tmp_fd.write(content) 14 tmp_fd.flush()
处理之后的效果:
原文:http://www.cnblogs.com/defen/p/5965706.html