I have a.yuv video file and a list containing some frame numbers. I need to make a new video with the frame numbers in the list and another video with the frame numbers that are not on the list. How can I do this using FFmpeg and subprocess module in python? I'm also using OpenCV in the program. I need the new videos in both.yuv and.avi formats.
Something like this:
Open the YUV file in `rb` mode.
Open `inlist.yuv` and `notinlist.yuv` in `wb` mode.
Zero frame counter
Repeat until no more data in input file
Read `framesize` bytes
if framenumber in list:
write to "inlist.yuv"
else:
write to "notinlist.yuv"
Increment frame counter
Close files
As Rotem suggests, use ffmpeg
to convert your 2 output files to AVI at the end.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.