A question came up today if I could crop a video as someone had filmed it in portrait mode creating the wrong kind of letterbox effect
Well, it is indeed possible, but rather than faff about with some GUI program, I resorted to using FFMPEG to do the work. It’s actually very easy to do, and a quick Google found the below stackexchange discussion, worked perfectly
The command is:
ffmpeg -i in.mp4 -filter:v "crop=out_w:out_h:x:y" out.mp4
So to crop an 80×60 px section starting at 200px along the x axis and 100 down along the y axis
ffmpeg -i in.mp4 -filter:v "crop=80:60:200:100" -c:a copy out.mp4
https://video.stackexchange.com/questions/4563/how-can-i-crop-a-video-with-ffmpeg
Convert MP4 to WEBM (with sound)
I frequently have issues converting videos to webm and having no sound on Mac / Safari. The one-liner below solved the issue
ffmpeg -i out.mp4 -vcodec libvpx -acodec libvorbis out.webm
More random ffmpeg commands…
ffmpeg -f concat -safe 0 -i list.txt -c copy -an output.mp4
ffmpeg -i 20221120-cut2.mov -filter:v fps=30 -b:v 8M 20221120-30fps.mov
Cut a video from start to x time – https://linuxhint.com/cut-and-crop-a-video-with-ffmpeg/
ffmpeg -i 20230225_050922.MOV -t 00:02:00 -c copy -an 20230225_050922.mp4
ffmpeg -i 20221120_091206.MOV -t 00:21:30 -c copy cutend-20221120_091206.MOV
ffmpeg -i 20221127-cut.mp4 -t 00:20:45 -c copy 20221127_.mp4
Cut x to end
ffmpeg -i 20221127.mp4 -ss 00:00:18 -c copy 20221127-cut.mp4
ffmpeg -i 20221127-cut.mp4 -ss 00:20:45 -c copy 20221127_.mp4
Strip Audio
ffmpeg -i 20221120-30fpsx4.mov -c copy -an 20221120-30fpsx4na.mov
x4 Speed up
ffmpeg -i output.mp4 -filter:v “setpts=0.25*PTS” 20221127.mp4
https://video.stackexchange.com/questions/14907/how-to-downsample-4k-to-1080p-using-ffmpeg-while-maintaining-the-quality
ffmpeg -i output.mov -vf scale=1920:1080 -c:a copy 1080p.mov
speed up – https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video
ffmpeg -i 20221120-30fps.mov -filter:v “setpts=0.25*PTS” 20221120-30fpsx4.mov
ffmpeg -i 1080p.mov -r 240 -filter:v “setpts=0.25*PTS” x81080p.mov
Smooth
ffmpeg -i x81080p-cut-noaudio.mov -filter:v “minterpolate=’mi_mode=mci:mc_mode=aobmc:vsbmc=1:fps=60′” output.mkv
ffmpeg -i x81080p-cut-noaudio.mov -filter:v “minterpolate=’mi_mode=mci:mc_mode=aobmc:vsbmc=1:fps=240′” x81080p-cut-noaudio-smooth.mov
Cut a video from start to x time – https://linuxhint.com/cut-and-crop-a-video-with-ffmpeg/
ffmpeg -i x81080p.mov -t 00:13:12 -c copy x81080p-cut.mov
Cut x to end
ffmpeg -i 20221120-cut.mov -ss 00:47:00 -c copy 20221120-cut2.mov
Strip out audio track – https://superuser.com/questions/268985/remove-audio-from-video-file-with-ffmpeg
ffmpeg -i x81080p-cut.mov -c copy -an x81080p-cut-noaudio.mp4
ffmpeg -i 20221120-30fpsx4.mov -c copy -an 20221120-30fpsx4na.mov
Interpolate – https://www.reddit.com/r/ffmpeg/comments/l25l9i/comment/gk4clnq/
ffmpeg -i 20221120-30fpsx4na.mov -vf “minterpolate=fps=30:mi_mode=mci:mc_mode=aobmc:me_mode=bidir:vsbmc=1” 20221120-30fpsx4nainter.mov
Framerate
ffmpeg -i 20221120-cut2.mov -filter:v fps=30 -b:v 8M 20221120-30fps.mov
ffmpeg -i input -c:v libx264 -b:v 2M -maxrate 2M -bufsize 1M output.mp4