image processing - Copy part of huge .YUV video file -
i looking win32 program copy part of large 1920x1080px 4:2:0 .yuv file (cca. 43gb) smaller .yuv files. of programs have used, i.e. yuv players, can copy/save 1 frame @ time. easiest/appropriate method cut yuv raw data smaller yuv videos(images)? similar ffmpeg command:
ffmpeg -ss [start_seconds] -t [duration_seconds] -i [input_file] [outputfile]
if have python available, can use approach store each frame separate file:
src_yuv = open(self.filename, 'rb') in xrange(number_of_frames): data = src_yuv.read(number_of_bytes) fname = "frame" + "%d" % + ".yuv" dst_yuv = open(fname, 'wb') dst_yuv.write(data) sys.stdout.write('.') sys.stdout.flush() dst_yuv.close() src_yuv.close()
just change capitalized variable valid numbers, e.g number_of_bytes 1 frame 1080p should 1920*1080*3/2=3110400
or if install cygwin can use dd
tool, e.g. first frame of 1080p clip do:
dd bs=3110400 count=1 if=sample.yuv of=frame1.yuv
Comments
Post a Comment