How to make a animation from separate images: Difference between revisions

From Rsewiki
No edit summary
No edit summary
 
Line 6: Line 6:


  #! /bin/bash
  #! /bin/bash
mkdir -p tmp
rm tmp/*
  let COUNTER=1000000
  let COUNTER=1000000
  for f in $( ls drone*.bmp ); do  
  for f in $( ls drone*.bmp ); do  
   echo convert $f path$COUNTER.png
   echo convert $f tmp/path$COUNTER.png
   convert $f path$COUNTER.png
   convert $f tmp/path$COUNTER.png
   let PREV=$COUNTER
   let PREV=$COUNTER
   let COUNTER+=1
   let COUNTER+=1
   # use same image again to lower framerate
   # use same image again to lower framerate
   convert $f path$COUNTER.png
   convert $f tmp/path$COUNTER.png
   let PREV=$COUNTER
   let PREV=$COUNTER
   let COUNTER+=1
   let COUNTER+=1
Line 21: Line 23:
  # -b:v 5000000 video bitrate på 5Mbit/sec
  # -b:v 5000000 video bitrate på 5Mbit/sec
  # -y betyder overskriv destination
  # -y betyder overskriv destination
  ffmpeg -y -i:path1%06d.png -r 20 -b:v 5000000 r2raw4.mpeg
  ffmpeg -y -i tmp/path1%06d.png -r 20 -b:v 5000000 r2raw4.mpeg
  ls -l *.mpeg
  ls -l *.mpeg



Latest revision as of 07:41, 23 July 2016

Using ffmpeg to convert a list of files with timestamped filenames into an mpeg video

Change the line "for f in $( ls drone*.bmp ); do" to filter the images to be used - here "drone*.bmp"

The last filename in the ffmpeg line to the destination name.

#! /bin/bash
mkdir -p tmp
rm tmp/*
let COUNTER=1000000
for f in $( ls drone*.bmp ); do 
  echo convert $f tmp/path$COUNTER.png
  convert $f tmp/path$COUNTER.png
  let PREV=$COUNTER
  let COUNTER+=1
  # use same image again to lower framerate
  convert $f tmp/path$COUNTER.png
  let PREV=$COUNTER
  let COUNTER+=1
  done
# convert to mpeg format
# -r 25 frames per second
# -b:v 5000000 video bitrate på 5Mbit/sec
# -y betyder overskriv destination
ffmpeg -y -i tmp/path1%06d.png -r 20 -b:v 5000000 r2raw4.mpeg
ls -l *.mpeg

Save the modified file as e.g. "makempeg"

then make it runable and run it

chmod +x makempeg
./makempeg