I'm working on a Transcoding video project and I need to split a video file into multiple files.
Input file is in Y4M format.
Output files are also in Y4M format with 8 frames per video file.
How can I do it using ffmpeg?
I'm working on a Transcoding video project and I need to split a video file into multiple files.
Input file is in Y4M format.
Output files are also in Y4M format with 8 frames per video file.
How can I do it using ffmpeg?
I found a solution (using ffmpeg).
The following example creates sample input file (for testing), and split it into parts.
In my example, the input file contains 8 frames per second, and the splitting process creates one output file for each second.
(I tried using option -segment_frames 8 instead of -segment_time 1, but it's not working).
Create input file (for testing):
Create AVI file and convert AVI file into y4m format file:
ffmpeg -f lavfi -i testsrc=duration=10:size=160x120:rate=8 -c:v rawvideo -pix_fmt bgr24 -y input.avi
ffmpeg -i input.avi -pix_fmt yuv444p input.y4m
Split file into segments of 8 frames (1 second per video file):
For Windows (use %%):
ffmpeg -i input.y4m -f segment -segment_time 1 -pix_fmt yuv444p output%%4d.y4m
For Linux (use %):
ffmpeg -i input.y4m -f segment -segment_time 1 -pix_fmt yuv444p output%4d.y4m