

ffmpeg -f x11grab -video_size cif -framerate 25 -i :0.0 output.mpg Source.Ĭombining multiple images into a gif file can be easily achieved with the imageio package in Python. 0 is lossless, 23 is the default, 51 is the worst quality possible. -crf 23: constant rate factor, the parameter to set your output video's quality.libx264 is the codec name, copy is a special codec name indicating keeping the source stream unchanged. In c:v, c stands for c odec, v means selecting the first video stream. This option is optional because ffmpeg detects and uses H.264 as the default encoding when outputting. -c:v libx264: encode the video in H.264 format.In the sample command, yuv420p is used ( -pix_fmt yuv420p is an alias for -vf format=yuv420p).

To list all available pixel formats, use ffmpeg -pix_fmts. -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2": truncate the video size to be divisible by 2 because the H.264 format requires dimensions to be even numbers.-movflags faststart: optimize the video format for playing, this flag may slow down the video conversion process a bit ( source).Similar to the video-only cropping command:Ĭonvert. atrim=start=341:end=404,asetpts=PTS-STARTPTS \ atrim=start=157:end=226,asetpts=PTS-STARTPTS \ Remove video+audio segments from a stream ffmpeg \ 'screenrecord-cropped.mp4': output file path.-map : map user-mapped stream to the output file.

