ffmpeg:tldr:95009
ffmpeg: Convert MP4 video to VP9 codec. For the best quality, use a CRF value (recommended range 15-35) and -b:v MUST be 0.
$ ffmpeg -i ${input_video}.mp4 -codec:v libvpx-vp9 -crf ${30} -b:v 0 -codec:a libopus -vbr on -threads ${number_of_threads} ${output_video}.webm
try on your machine
This command uses the FFmpeg tool to convert a video file (in .mp4 format) to a WebM video file (in .webm format), using the VP9 video codec and Opus audio codec. Here is a breakdown of the command:
ffmpeg
: This is the command to run the FFmpeg tool.-i ${input_video}.mp4
: Specifies the input video file.${input_video}
represents a variable, so the command is expecting you to substitute it with the actual filename (without the extension) of your input video.-codec:v libvpx-vp9
: Specifies the video codec to be used for encoding the video stream.libvpx-vp9
is the codec for VP9 video compression.-crf ${30}
: Sets the Constant Rate Factor (CRF) for video compression. The value${30}
is again expecting a variable substitution, so it should be replaced with a specific value. A lower value results in better video quality but larger file size, while a higher value reduces quality but yields a smaller file size.-b:v 0
: Sets the video bitrate to 0, which enables the VP9 codec to use variable bitrate mode (bitrate determined by CRF value).-codec:a libopus
: Specifies the audio codec to be used for encoding the audio stream.libopus
is the codec for Opus audio compression.-vbr on
: Enables variable bitrate mode for audio encoding.-threads ${number_of_threads}
: Sets the number of threads to use for video encoding.${number_of_threads}
is expecting a variable substitution representing the desired number of threads.${output_video}.webm
: Specifies the output video file. Similar to${input_video}
,${output_video}
expects a variable substitution. The resulting output video will be in .webm format.
To use this command, you need to replace ${input_video}
, ${30}
, ${number_of_threads}
, and ${output_video}
with the appropriate values for your specific case.
This explanation was created by an AI. In most cases those are correct. But please always be careful and
never run a command you are not sure if it is safe.