banner
 

Path: content/Tips/Media/Video.md

Video Tips

Converting with ffmpeg

ffmpeg is really powerful, but doesn't have the simplest UI! Here are some useful conversions:

Shrink and speed up and rotate 180 degrees

ffmpeg -i 20170614_024144.MOV -c:v libx265 -vf "scale=800:-1:flags=lanczos,transpose=2,transpose=2,setpts=0.125*PTS" ~/Videos/outputfile2.mp4

Convert to H.265

ffmpeg -i inputfile.mov -vf yadif -c:v libx265 /tmp/outputfile.mp4

There's also a -crf option which controls how much compression is done. 0 is lossless, 51 is lowest quality, 23 is the default.

de-interlace 1080i AVCHD video from a camcorder into H265

Produces a file about a quarter of the size without the interlacing artifacts:

ffmpeg -i inputfile.MTS -vf yadif -c:v libx265 /tmp/outputfile.mp4

Pick a deinterlacing engine from one of:

see https://github.com/kfrn/ffmpeg-things/blob/master/deinterlacing.md

Transcode to GIF

ffmpeg -i simplescreenrecorder-2021-10-13_15.54.26.mkv -vf "fps=10,scale=320:-1:flags=lanczos" -c:v pam -f image2pipe - | convert -delay 10 - -loop 0 -layers optimize output.gif

Compress all videos recursively from current folder down

IFS=$'\n' ; for i in `find . -name '*MOV' -o -name '*AVI' `; do echo $i ; ffmpeg -loglevel quiet -stats -i "$i" -vcodec libx265 -crf 24 "$i".mp4; mv "$i" "$i".done; done

Scale video

-vf scale=w=1280:h=720

Links in this section

Images
Video

free website hit counter