Git Product home page Git Product logo

ffmpeg-scripts's Introduction

๐Ÿ“œ FFMPEG Scripts

Make sure ffmpeg is already installed on your system (download here). Outputs are placed inside output directory and creates itself if it does not exist.

Action Script Usage
Convert video or audio converter.sh ./converter.sh input.mkv output_converted.mp4
Rescale video rescale_video.sh ./rescale_video.sh input.mp4 360 output_rescale.mp4
Trim video trim_video.sh ./trim_video.sh 00:03:26 input.mp4 00:05:46 output_trimmed.mp4
Concatenate MP4 videos Multiple scripts Refer to the details
Convert GIF to web-optimized MP4 and WEBM gif_to_video.sh ./gif_to_video.sh input.gif output_web
Convert video to WEBM webm_converter.sh ./webm_converter.sh input.mp4 output

๐Ÿ”€ Convert video or audio

./converter.sh <1> <2>
  • 1: File to convert
  • 2: The file with expected format

Example

./converter.sh input.mkv output_converted.mp4
# What it does
ffmpeg -i input.mkv output/output_converted.mp4

Move to top

โ†•๏ธ Rescale video

Rescales video while maintaining its aspect ratio

./rescale_video.sh <1> <2> <3>
  • 1: file to convert
  • 2: expected height in pixels
  • 3: output file

Example

./converter.sh input.mp4 360 output_rescaled.mp4
# What it does
ffmpeg -i input.mp4 -vf scale=-2:360 output/"output_rescaled.mp4"

Move to top

โœ‚๏ธ Trim video

./trim_video.sh <1> <2> <3> <4>
  • 1: seek start with HH:MM:SS.mmm* format
  • 2: input file
  • 3: seek end with HH:MM:SS.mmm* format
  • 4: output file

*H: hours, M: minutes, S: seconds, mmm (optional): miliseconds

Example

./trim_video.sh 00:03:26 input.mp4 00:05:46 output_trimmed.mp4
# What it does
ffmpeg -ss 00:03:26 -i "input.mp4" -to 00:05:46 -c copy -copyts output/"output_trimmed.mp4"

Move to top

๐Ÿ”— Concatenate MP4 videos

Do the following:

  1. Convert MP4 to transport streams
  2. Concatenate transport streams

Move to top

Convert MP4 to transport streams

./mp4_to_intermediate_ts.sh <1> <2>
  • 1: MP4 input file
  • 2: output name (without extension)

Example

./mp4_to_intermediate_ts.sh input.mp4 output_intermediate
# What it does
ffmpeg -i input.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts output/output_intermediate.ts

Move to top

Concatenate transport streams

./concat_ts.sh <1> <2>
  • 1: transport streams to concacenate, separated with "|". Example: "intermediate_1.ts|intermediate_2.ts"
  • 2: output file

Example

./concat_ts.sh "intermediate_1.ts|intermediate_2.ts|intermediate_3.ts" output_concatenated.mp4
# What it does
ffmpeg -i "concat:intermediate_1.ts|intermediate_2.ts|intermediate_3.ts" -c copy -bsf:a aac_adtstoasc output/output_concatenated.mp4

Move to top

๐Ÿ”€ Convert GIF to web-optimized MP4 and WEBM

This action creates two different files; MP4 and WEBM. Implementation: Replace animated GIFs with video for faster page loads

./trim_video.sh <1> <2>
  • 1: GIF input file
  • 2: output name (without extension)

Example

./gif_to_video.sh input.gif output_web
# What it does
ffmpeg -i input.gif -b:v 0 -crf 25 -f mp4 -vcodec libx264 -pix_fmt yuv420p output/output_web.mp4
ffmpeg -i input.gif -c vp9 -b:v 0 -crf 41 output/output_web.webm

Move to top

๐Ÿ”€ Convert video to WEBM

./webm_converter.sh <1> <2>
  • 1: input file
  • 2: output name (without extension)

Example

./webm_converter.sh input.mp4 output
# What it does
ffmpeg -i "input.mp4" -vf setsar=1:1 output/output.webm

Move to top

ffmpeg-scripts's People

Contributors

vyonizr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.