Outputs are placed inside output
directory. The folder creates itself if it does not exist.
Make sure FFmpeg is already installed on your system (download here).
Action | Script | Usage |
---|---|---|
Convert video or audio | converter.sh |
./converter.sh input.mkv output_converted.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 GIF | video_to_gif.sh |
./video_to_gif.sh input.mp4 output |
Convert video to WEBM | webm_converter.sh |
./webm_converter.sh input.mp4 output |
Rescale video | rescale_video.sh |
./rescale_video.sh input.mp4 360 output_rescale.mp4 |
Rotate Video | rotate_video.sh |
./rotate_video.sh input.mp4 output |
Trim video | trim_video.sh |
|
./converter.sh <1> <2>
1
: File to convert2
: The file with expected format
./converter.sh input.mkv output_converted.mp4
# What it does
ffmpeg -i input.mkv output/output_converted.mp4
Rescales video while maintaining its aspect ratio
./rescale_video.sh <1> <2> <3>
1
: file to convert2
: expected height in pixels3
: output file
./converter.sh input.mp4 360 output_rescaled.mp4
# What it does
ffmpeg -i input.mp4 -vf scale=-2:360 output/"output_rescaled.mp4"
./trim_video.sh <1> <2> <3> <4>
1
: seek start withHH:MM:SS.mmm
* format2
: input file3
: seek end withHH:MM:SS.mmm
* format4
: output file
*H: hours, M: minutes, S: seconds, mmm (optional): miliseconds
./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"
Do the following:
./mp4_to_intermediate_ts.sh <1> <2>
1
: MP4 input file2
: output name (without extension)
./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
./concat_ts.sh <1> <2>
1
: transport streams to concacenate, separated with "|". Example:"intermediate_1.ts|intermediate_2.ts"
2
: output file
./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
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 file2
: output name (without extension)
./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
./video_to_gif.sh <1> <2>
1
: input video file2
: output name (without extension)
./video_to_gif.sh input.mp4 output
# What it does
ffmpeg -i "input.mp4" \
-vf "fps=10,scale=360:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
-loop 0 output.gif \
./webm_converter.sh <1> <2>
1
: input file2
: output name (without extension)
./webm_converter.sh input.mp4 output
# What it does
ffmpeg -i "input.mp4" -vf setsar=1:1 output/output.webm
./rotate_video.sh <1> <2> <3>
1
: input file2
: refer to Rotate Mode3
: output name (without extension)
0 = 90° counter-clockwise and vertical flip
1 = 90° clockwise
2 = 90° counter-clockwise
3 = 90° clockwise and vertical flip
./rotate_video.sh input.mp4 1 output
# What it does
ffmpeg -i "input.mp4" -vf "transpose=1" output/"output.mp4"