Skip to content

Instantly share code, notes, and snippets.

@peterdalle
Last active October 19, 2022 19:52
Show Gist options
  • Select an option

  • Save peterdalle/0f74a174abc3f47042c93e8698870ff6 to your computer and use it in GitHub Desktop.

Select an option

Save peterdalle/0f74a174abc3f47042c93e8698870ff6 to your computer and use it in GitHub Desktop.

Revisions

  1. peterdalle revised this gist Oct 19, 2022. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions ffmpeg.md
    Original file line number Diff line number Diff line change
    @@ -9,8 +9,8 @@ Command | Description
    `ffmpeg -i in.mp4 -vf scale=640:480 out.mp4` | Resize video to 640 x 480
    `ffmpeg -i in.mp4 -vf "transpose=1" out.mp4` | Rotate video 90 degrees clockwise (range: 0-3)
    `ffmpeg -i in.mp4 -vf "transpose=2,transpose=2" out.mp4` | Rotate video 180 degrees
    `ffmpeg -i inp.mp4 out%04d.jpg -hide_banner` | Extract all frames
    `ffmpeg -i inp.mp4 -ss 00:00:10.000 -vframes 1 out.jpg` | Extract only one frame
    `ffmpeg -i in.mp4 out%04d.jpg -hide_banner` | Extract all frames
    `ffmpeg -i in.mp4 -ss 00:00:10.000 -vframes 1 out.jpg` | Extract only one frame
    `ffmpeg -i in.mp4 -fps=1 -vsync 0 out%d.png` | Extract one frame per second
    `ffmpeg -i in.mp4 -vf select='between(t,1,5)+between(t,11,15)' -vsync 0 out%d.png` | Extract frames between 1-5 seconds & 11-15 seconds
    `ffmpeg -i in.mp4 -vf yadif out.mp4` | Deinterlace
  2. peterdalle created this gist Oct 19, 2022.
    18 changes: 18 additions & 0 deletions ffmpeg.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    # ffmpeg example commands

    Command | Description
    :--------- | :----------------------
    `ffmpeg -i in.mp4 out.avi` | Convert from one format to another
    `ffmpeg -i in.mp4 -preset slower -crf 18 out.mp4` | Convert with custom quality: lower crf = higher quality (range: 0-51)
    `ffmpeg -i in.mkv -c:v copy -c:a copy out.mp4` | Remux MKV file into MP4 (no quality loss)
    `ffmpeg -i onlyvideo.mp4 -i onlyaudio.mp4 -c copy -map 0:0 -map 1:1 -shortest out.mp4` | Mux video and audio from different videos (no quality loss)
    `ffmpeg -i in.mp4 -vf scale=640:480 out.mp4` | Resize video to 640 x 480
    `ffmpeg -i in.mp4 -vf "transpose=1" out.mp4` | Rotate video 90 degrees clockwise (range: 0-3)
    `ffmpeg -i in.mp4 -vf "transpose=2,transpose=2" out.mp4` | Rotate video 180 degrees
    `ffmpeg -i inp.mp4 out%04d.jpg -hide_banner` | Extract all frames
    `ffmpeg -i inp.mp4 -ss 00:00:10.000 -vframes 1 out.jpg` | Extract only one frame
    `ffmpeg -i in.mp4 -fps=1 -vsync 0 out%d.png` | Extract one frame per second
    `ffmpeg -i in.mp4 -vf select='between(t,1,5)+between(t,11,15)' -vsync 0 out%d.png` | Extract frames between 1-5 seconds & 11-15 seconds
    `ffmpeg -i in.mp4 -vf yadif out.mp4` | Deinterlace

    Source: https://gist.github.com/peterdalle/27d370fa457e6ec7ba85fb34cf2e6768