Open eladg opened 2 years ago
I suggest moving the time limit option, -t
, from the output to the input. Therefore:
ffmpeg -t 5 -f lavfi -i "color=c=0x4d1a7f" -s 1280x720 -r 30 -c:v libx264 -crf 31 solid.mp4
I have two reasons for the suggestion. First, this example is about generating the input, and putting the time limit with the generation makes the generation a complete unit. Second, when limiting streams by time, FFmpeg performs better when the limit are placed on the inputs rather than the outputs.
https://www.ffmpegbyexample.com/examples/6gzhzpjp/generate_solid_color_264_video_with_the_color_video_source_filter_color_hex_code/
The following uses a video source generator and the color filter to generate a solid color video.
The generated video frames are then scaled using
-s 1280x720
and a 30 fpsh.264
video is generated using-r 30 -c:v libx264 -crf 31
.Since this generated creates unlimited frames, the
-t 5
parameter limits the output to 5 seconds.