Check out MechaPip!

Twitch    Youtube    Twitter    Merch    MechaPip   


Jerky Jesse
Software Engineer.


FFMPEG Commands List

Loop Commands

  1. for %i in (*.*) do ffmpeg -n -threads 1 -i "%i" -vcodec libx265 -acodec copy "%~ni_2.mp4" This command loops over all files in the current directory and uses ffmpeg to convert each file to an MP4 file with the H.265 (libx265) video codec, while keeping the original audio codec. The output files have the same name as the input files with _2.mp4 appended.
  2. for %i in (*.*) do ffmpeg -n -threads 1 -i "%i" -vf crop='iw-mod(iw,2)':'ih-mod(ih,2)' -vcodec libx265 -acodec copy "%~ni_2.mp4" This command is similar to the previous one, but it also crops the input video to make its width and height divisible by 2. This is useful for codecs that require even dimensions.
  3. for %i in (*.*) do ffmpeg -n -i "%i" -vcodec hevc_nvenc -preset slow -acodec copy "%~ni_2.mp4" This command converts each file in the current directory to an MP4 file using the HEVC (hevc_nvenc) codec with a slow preset, which provides a better compression rate but takes more time.
  4. for /r %a in (*.mp4) do ffmpeg -n -i "%~a" -vcodec hevc_nvenc -preset slow -acodec copy "%~dpna_2.mp4" This command is similar to the previous one, but it operates recursively on all MP4 files in the current directory and its subdirectories.

Non-loop Commands

  1. ffmpeg -r 24 -f image2 -s 1920x1080 -i pic%d.png -vcodec libx264 test.mp4 This command generates a 24 fps MP4 video from a sequence of PNG images named pic0.png, pic1.png, etc. The video resolution is 1920x1080 and the video codec is H.264 (libx264).
  2. ffmpeg -i input.mp3 -i input.mp4 output.mp4 This command adds an MP3 audio track to an MP4 video. The output is an MP4 file with the original video and the added audio.
  3. ffmpeg -i input.mp4 output.avi This command converts an MP4 video to an AVI video. The codecs of the output video will be chosen based on the AVI format.
  4. ffmpeg -r 24 -i pic%d.png output.gif This command generates a 24 fps GIF from a sequence of PNG images.
  5. ffmpeg -i output.mp4 image.gif This command converts an MP4 video to a GIF.
  6. ffmpeg -ss 00:00:0.0 -i input.mp4 -c copy -t 00:01:29.0 output.mp4 This command extracts a segment from an MP4 video without re-encoding. The segment starts at the beginning of the video and lasts for 1 minute and 29 seconds.
  7. ffmpeg -i output.mp4 audio.mp3 This command extracts the audio track from an MP4 video and saves it as an MP3 file.
  8. ffmpeg -loop 1 -f image2 -i flower.jpg -i input.mp3 -vf crop=in_w:in_w*9/16,scale=1920:1080,fps=30 -pix_fmt yuv420p -vcodec libx264 -shortest output.mp4 This command creates a video with a single image and an audio track. The image is looped to match the duration of the audio. The video has a resolution of 1920x1080 and a frame rate of 30 fps. The video codec is H.264 (libx264).
  9. ffmpeg -i input.mp4 -c copy output.mkv This command converts an MP4 video to an MKV video without re-encoding.
  10. ffmpeg -stream_loop 5 -i input.mkv -c copy output.mp4 This command loops an MKV video 5 times and outputs an MP4 video.
  11. ffmpeg -i inputs.mp4 -ss 00:00:00 -t 00:32:18 -async 1 cut.mp4 This command extracts a 32-minute and 18-second segment from the beginning of an MP4 video.
  12. ffmpeg -r 60 -f image2 -s 1920x1080 -start_number 1 -i %d.png -vframes 1440 -vcodec libx264 -crf 25 -pix_fmt yuv420p output.mp4 This command generates a 60 fps MP4 video from 1440 PNG images. The video resolution is 1920x1080 and the video codec is H.264 (libx264).
  13. ffmpeg -ss 00:00:00 -i input.mkv -c copy -t 13:32:00 output.mkv This command extracts a 13-hour and 32-minute segment from the beginning of an MKV video without re-encoding.
  14. ffmpeg -y -r 16 -f image2 -s 1080x1920 -i %d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p "output.mp4" This command generates a 16 fps MP4 video from a sequence of PNG images. The video resolution is 1080x1920 and the video codec is H.264 (libx264).
  15. ffmpeg -r 60 -i %d.png output.gif This command generates a 60 fps GIF from a sequence of PNG images.

Video Speed Commands

  1. ffmpeg -i input.mkv -filter_complex "[0:v]setpts=<1/x>*PTS[v];[0:a]atempo=<x>[a]" -map "[v]" -map "[a]" output.mkv This command changes the speed of an MKV video. The <1/x> and <x> should be replaced with the desired speed factor. For example, to double the speed, use 0.5 and 2.0 respectively.

Rename or Change Extension Commands

  1. ren *.mp4 *.avi This command renames all MP4 files in the current directory to AVI files. It only changes the file extensions, not the file formats.
  2. $i = 0; Get-ChildItem "*.png" | foreach-object {Rename-Item $_ "$($i.ToString('D4')).png"; $i++} This PowerShell command renames all PNG files in the current directory to 0000.png, 0001.png, etc.
delta 8
Jerky Jesse Logo © Copyright, Jesse A Phipps
www.theforexpert.com
www.mechapip.com