Skip to content

Instantly share code, notes, and snippets.

@heethesh
Last active September 17, 2021 23:02
Show Gist options
  • Save heethesh/6bdd6220941c2ac6bfdbd4ff81458866 to your computer and use it in GitHub Desktop.
Save heethesh/6bdd6220941c2ac6bfdbd4ff81458866 to your computer and use it in GitHub Desktop.
FFMPEG Commands
# Convert sequences images to video
ffmpeg -f image2 -r 10 -i folder/%*.png -vb 100M -codec:v libx264 output.mp4
ffmpeg -framerate 10 -i folder/%06d.png -vb 100M -codec:v libx264 output.mp4
ffmpeg -r 10 -i folder/%06d.png -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,format=yuv420p" -codec:v libx264 output.mp4
# 2x2 grid from videos
ffmpeg -i 1.mp4 -i 2.mp4 -i 3.mp4 -i 4.mp4 -filter_complex "[0:v][1:v]hstack[top];[2:v][3:v]hstack[bottom];[top][bottom]vstack,format=yuv420p[v]" -map "[v]" output.mp4
# Horizontal stack videos
ffmpeg -i input0.mp4 -i input1.mp4 -filter_complex hstack=inputs=2 horizontal-stacked-output.mp4
# Before/After labels
ffmpeg -i input.mp4 -vf "drawtext=text='Before':fontcolor=white:fontsize=40:box=1:[email protected]:boxborderw=5:x=50/2:y=h-75,drawtext=text='After':fontcolor=white:fontsize=40:box=1:[email protected]:boxborderw=5:x=1970:y=h-75" output.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment