Konubinix' opinionated web of thoughts



speed up/slow down a video

This does not affect the audio speed. Use -an to not include audio in the output


ffmpeg -i input.mkv -filter:v “setpts=PTS/60” output.mkv


To double the speed of the video with the setpts filter, you can use:

ffmpeg -i input.mkv -filter:v “setpts=0.5*PTS” output.mkv


faster method, but which can have unexpected results with audio (pauses or async):

ffmpeg -itsscale 0.01666 -i input.mkv -c copy output.mkv


re-encode i.e. a timelapse, e.g. ffmpeg -i input -vf framestep=60,setpts=N/30/TB -r 30 -an out.mp4


encode VP8

there’s a constant quality mode (like in the x264 encoder) that will ensure that every frame gets the number of bits it deserves to achieve a certain quality level, rather than forcing the stream to have an average bit rate. This results in better overall quality and should be your method of choice when you encode video with libvpx.


this case, the target bitrate becomes the maximum allowed bitrate. You enable the constant quality mode with the CRF parameter:

ffmpeg -i input.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output.webm


By default the CRF value can be from 4–63, and 10 is a good starting point. Lower values mean better quality.


Important: If neither -b:v nor -crf are set, the encoder will use a low default bitrate and your result will probably look very bad. Always supply one of these options—ideally both.

If you want to tweak the quality even further, you can set two more parameters:

-qmin – the minimum quantizer (default 4, range 0–63) -qmax – the maximum quantizer (default 63, range qmin–63)

These Q values are quantization parameters, and lower generally means “better quality”. If you set the bounds from 0 to 63, this means the encoder has free choice of how to assign the quality. For a better overall quality, you can try to set -qmin to 0 and -qmax to 50 or lower. For example:

ffmpeg -i input.mp4 -c:v libvpx -qmin 0 -qmax 50 -crf 5 -b:v 1M -c:a libvorbis output.webm


should use constant bitrate encoding if you need your video files to have a certain size, or if you’re streaming the videos over a channel that only allows a certain bit rate.



set subtitles track as default

setting metadata in subtitles (like the language in english)

add a bunch of subtitles in a file stored in ipfs

ffmpeg add a bunch of subtitles in a file stored in ipfs Using

while read filename srt
    echo "$srt -> $filename"
    ffmpeg -nostdin -y -hide_banner -loglevel warning -stats -i $filename -i $srt -vcodec copy -acodec copy -map 0:a:0 -map 1:s:0 -metadata:s:s:0 language=eng -map 0:v:0 -disposition:s:0 default $srt.webm
done < data.txt

In short,

  1. take the videos and the subtitles put in data.txt,
  2. get the video and audio from the file and the subtitle from the subtitle file,
  3. set the subtitle as shown by default,
  4. tell that it is in English,

making mp4 videos streamable

Fast start Flag: -movflags +faststart. Moves some data to the beginning of the file, allowing the video to be played before it is completely downloaded


more silent, quiet, less verbose

make ffmpeg more silent (less verbose)

-hide_banner -loglevel warning -stats

What are reasonable values for -aq when creating mp3?

keeping quality during conversion

  • qmin integer (encoding,video) Set min video quantizer scale (VBR). Must be included between -1 and 69, default value is 2.
  • qmax integer (encoding,video) Set max video quantizer scale (VBR). Must be included between -1 and 1024, default value is 31.


Notes pointant ici