Extract yuv frames from yuv video
10,430
Using ffmpeg,
ffmpeg -f rawvideo -framerate 25 -s 1280x720 -pixel_format yuv420p -i in.yuv -c copy -f segment -segment_time 0.01 frames%d.yuv
Replace the framerate, size and pixel format with the correct values, of course.
Author by
Pradheep Elango
Updated on September 18, 2022Comments
-
Pradheep Elango almost 2 years
What is the best way to extract individual yuv frames from a yuv video? Can we use ffmpeg?
I'm able to extract individual jpg frames but am struggling to extract individual yuv frames. I know that I can write my own script in python to extract this as the frames in yuv videos are just stacked against each other in raw format but wondering if there's a command line command I can just use for this.
-
Pradheep Elango almost 7 yearsThanks @mulvya! So the idea is to segment the video, and I should modify the segment_time such that only one frame is included in the segment? Will it be possible to precisely extract just one frame when fps is not integral (e.g: 24.58)? Should I first convert fps into 1 fps and then do this? Thanks!
-
Gyan almost 7 yearsAs long as segment_time is less than
1/fps
, each segment will be one frame. -
Pradheep Elango almost 7 yearsOh yes of course. Thanks @mulvya! Do you know what I should change if I want to use mp4 (hevc/h265 encoding) as input. Is the only way to first convert to yuv video and then apply the above
-
Gyan almost 7 years
ffmpeg -i in.mp4 -f segment -segment_time 0.01 frames%d.yuv