Skip to content

Instantly share code, notes, and snippets.

@kobybibas
Last active March 14, 2021 12:48
Show Gist options
  • Save kobybibas/a3b76829ba42deffe883b2bcb02d466a to your computer and use it in GitHub Desktop.
Save kobybibas/a3b76829ba42deffe883b2bcb02d466a to your computer and use it in GitHub Desktop.

Revisions

  1. kobybibas revised this gist Mar 14, 2021. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion ffmpeg_center_crop_and_scale.sh
    Original file line number Diff line number Diff line change
    @@ -2,4 +2,7 @@
    ffmpeg -i intput -filter:v "crop=ih:ih,scale=640:-2" -crf 28 output.mp4

    # Split a video to 280 sec segments
    ffmpeg -i input.mp4 -acodec copy -f segment -segment_time 280 -vcodec copy -reset_timestamps 1 -map 0 output_%d.mp4
    ffmpeg -i input.mp4 -acodec copy -f segment -segment_time 280 -vcodec copy -reset_timestamps 1 -map 0 output_%d.mp4

    # Crop with side by side merge (https://stackoverflow.com/questions/35349935/ffmpeg-crop-with-side-by-side-merge)
    ffmpeg -i in0.mp4 -i in1.mp4 -filter_complex "[0:v]crop=iw/2:ih:0:0[left]; [1:v]crop=iw/2:ih:ow:0[right]; [left][right]hstack" output.mp4
  2. kobybibas revised this gist Oct 21, 2020. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion ffmpeg_center_crop_and_scale.sh
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,5 @@
    # Crop such that the output is heightxheight. Then scale to 640:640. finally videeo compression ("28", higher is more compression)
    ffmpeg -i intput -filter:v "crop=ih:ih,scale=640:-2" -crf 28 output.mp4
    ffmpeg -i intput -filter:v "crop=ih:ih,scale=640:-2" -crf 28 output.mp4

    # Split a video to 280 sec segments
    ffmpeg -i input.mp4 -acodec copy -f segment -segment_time 280 -vcodec copy -reset_timestamps 1 -map 0 output_%d.mp4
  3. kobybibas created this gist Oct 21, 2020.
    2 changes: 2 additions & 0 deletions ffmpeg_center_crop_and_scale.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    # Crop such that the output is heightxheight. Then scale to 640:640. finally videeo compression ("28", higher is more compression)
    ffmpeg -i intput -filter:v "crop=ih:ih,scale=640:-2" -crf 28 output.mp4