ffmpeg-the-magic-formulae

Since ffmpeg is the essential tool used to make, optimize, rebuild, video and audio stream, i am collecting what I call magic formulas that a are daily needed.

Do not hesitate to subscribe : this page will be completed. Feel free to share your formulae.

Erich Cheng, exporting VR180

ffmpeg -i "in.mov" -vf "scale=4096x2048:out_range=full:out_color_matrix=bt709" -c:v libx264 -preset fast -crf 18 -pix_fmt yuv420p -c:a copy -g 60 -movflags faststart "out.mp4"

See also this link about exporting VR180 for Oculus

https://creator.oculus.com/blog/encoding-high-resolution-360-and-180-video-for-oculus-go/

Miha Rebernik, Manipulating sound without reexporting

To increase the volume of the first audio track for 10dB use:

ffmpeg -i inputfile -vcodec copy -af "volume=10dB" outputfile

To decrease the volume of the first audio track for 5dB use:

ffmpeg -i inputfile -vcodec copy -af "volume=-5dB" outputfile

How to cut out video file to shorten the length

Because too much black at the end 😉

  • -i means input followed by the name of your source file
  • -c copy means ffmpeg will just copy the video format without any modification
  • -t followed by a number in seconds to set the new length. Note that the cut is not accurate, you may have to add some seconds to get the right length. ffmpeg -i input.wmv -c copy -t 680 output.wmv

Useful links

Combine separate video files into one to make a SBS video (source)

ffmpeg -i inputleft.avi -vf "movie=inputright.avi [in1]; [in]pad=iw*2:ih:iw:0[in0]; [in0][in1] overlay=0:0 [out]" sidebyside.avi