Wednesday, December 21, 2022

FFMPEG command Cheat Sheet

I've made many FFMPEG command lines over the years and keep losing track of them. 

I've decided to post them here in a list and edit them as I find / make more.


Create a time lapse video from an input file, one frame every 15 frames, maximum VBR quality, rotate 90 degrees counterclockwise and vertical flip, delete audio and encode with h.265 using cuda and nvenc on a nvidia graphics card.

ffmpeg.exe -hwaccel cuda -i input.MP4  -vf framestep=15,setpts=N/60/TB,fps=60,transpose=0 -c:v hevc_nvenc -rc vbr -cq 0 -qmin 0 -qmax 1 -profile:v main10 -pix_fmt p010le -b:v 0K -an -max_interleave_delta 0 output.mkv


Combine an input video and two separate mono audio tracks into a single video file, encoding with dxva using nvenc on a nvidia graphics card. Example input would be video exported from Davinci Resolve

ffmpeg -y -hwaccel_output_format d3d11 -hwaccel d3d11va -i "video.mxf" -i "A01.mxf" -i "A02.mxf"  -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo[a]" -map "[a]" -map 0:v -c:v hevc_nvenc -rc vbr -cq 10 -qmin 6 -qmax 14 -profile:v main10 -pix_fmt p010le -b:v 0K out.mp4

Same as above but on an AMD/ATI card and with bitrate set to 100 megabit

ffmpeg -y -hwaccel_output_format d3d11 -hwaccel d3d11va -i '.\video.mxf' -i '.\A01.mxf' -i '.\A02.mxf'  -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo[a]" -map "[a]" -c:a pcm_s16le -map 0:v -c:v hevc_amf -b:v 100M "out.mkv"


Trapezoid transform a video with perspective example, trim a bit off the left top and left bottom of a 4k vertical video

Top left corner 29:490

Top right corner 2160:0

Bottom left corner 76:3241

Bottom right corner 2160:3840


-lavfi "perspective=29:490:2160:0:76:3241:2160:3840:interpolation=linear"

Tuesday, September 27, 2022

How to fix broken MP4 Videos for free

 if you have any broken mp4s, such as mov atom missing from your phone/camera/card dying during recording..


This gnu v2 app works Awesome!

https://github.com/ponchio/untrunc


I used it a few days ago to repair a video from a drone that was corrupted


I have a paid app on my android that I was using but it couldn't figure out the drone video so I had to find an alternative, this one worked much better


I used an Ubuntu virtual machine and followed the instructions on that page and fixed my video.

Friday, August 19, 2022

 If you get

./mp4grep/bin/mp4grep: error while loading shared libraries: libvosk.so: cannot open shared object file: No such file or directory

You probably need to run ldconfig on the folder containing libvosk

in my case it was

sudo ldconfig /home/nate/.local/lib/