Recent Changes - Search:

Basics

Languages

Tools

OS

Resources

PmWiki

pmwiki.org

edit SideBar

Ffmpeg

ffmpeg is a handy command line tool to create movies from images (amongst other things, possibly), with direct control over the encoder, the fps and many other parameters.

So far, I have had success with:

ffmpeg -framerate $fps -pattern_type glob -i "*$pattern*.png" -c:v libx264 -crf 24 -pix_fmt yuv420p -tune film -c:a aac -b:a 192k -ar 44100 -vol 300 -strict -2 -speed fastest $name.mp4

where

$fps
Is the framerate (frames per seconds) of the animation
$pattern
Is a series of characters shared by all the images from which to make a movie
$name
Is the name to be given to the resulting movie

This can all be combined in a handy little script like:

#! /bin/bash
# Script to make an mp4  movie from png pictures
# Input:    -root: shared root in all the picture filenames (default: '.png')
# Optional: -name: name of the resulting movie (default: 'movie.mp4')
#           -fps:  number of frames per seconds (default: 4)
if [ $# -gt 1 ]; then
   name=$2
else
   name=movie
fi

if [ $# -gt 2 ]; then
   fps=$3
   echo 'FPS is set to ' $fps
else
   fps=4
fi

ffmpeg -framerate $fps -pattern_type glob -i "*$1*.png" -c:v libx264 -crf 24 -pix_fmt yuv420p -tune film -c:a aac -b:a 192k -ar 44100 -vol 300 -strict -2 -speed fastest $name.mp4

which takes up to 3 inputs and saves you typing that long command every time.

Edit - History - Print - Recent Changes - Search
Page last modified on May 13, 2022, at 09:56 AM