Difference between revisions of "Movies"

From GRASS-Wiki
Jump to: navigation, search
(xganim r.out.mpeg TOC PNG driver)
Line 1: Line 1:
Q: If anyone has tips on constructing high-quality MPEG-4 movies (animations) from a series of still frames, I'd be interested in hearing them.
+
==== Q: If anyone has tips on constructing high-quality MPEG-4 movies (animations) from a series of still frames, I'd be interested in hearing them. ====
  
 
Maris wrote:
 
Maris wrote:
Line 20: Line 20:
  
 
Notice - by default encoding with lavc will set video fourcc to FMP4, that can be decoded with ffdshow. Option -ffourcc MP4S will change it to MPS4 ("official" MS fourcc for mpeg4) and video will be playable on Windows by standart MS mpeg4 decoder. It may lead to side effects, if MS mpeg4 decoder is buggy. More info: http://www.itdp.de/mplayer-users/2005-03/msg00069.html
 
Notice - by default encoding with lavc will set video fourcc to FMP4, that can be decoded with ffdshow. Option -ffourcc MP4S will change it to MPS4 ("official" MS fourcc for mpeg4) and video will be playable on Windows by standart MS mpeg4 decoder. It may lead to side effects, if MS mpeg4 decoder is buggy. More info: http://www.itdp.de/mplayer-users/2005-03/msg00069.html
 +
  
 
--------
 
--------
Q: How to generate an animated GIF, FLI, or MNG?
+
 
 +
 
 +
==== Q: How to generate an animated GIF, FLI, or MNG? ====
  
 
A: for animations of 300 frames or less, animated GIF, FLI, or MNG formats are smaller files and better quality (ie frames stored as PNG not JPEG). Create with [http://www.lcdf.org/gifsicle/ gifsicle], [http://vento.pi.tu-berlin.de/fli.html ppm2fli], or for MNG use [http://www.imagemagick.org/ ImageMagick's 'convert']. With more than 300 frames the players usually have memory issues. Animated GIFs are playable in any web browser of course and also in OpenOffice.
 
A: for animations of 300 frames or less, animated GIF, FLI, or MNG formats are smaller files and better quality (ie frames stored as PNG not JPEG). Create with [http://www.lcdf.org/gifsicle/ gifsicle], [http://vento.pi.tu-berlin.de/fli.html ppm2fli], or for MNG use [http://www.imagemagick.org/ ImageMagick's 'convert']. With more than 300 frames the players usually have memory issues. Animated GIFs are playable in any web browser of course and also in OpenOffice.
 +
  
 
--------
 
--------
Q: How to create dynamic surface movies in nviz
+
 
 +
 
 +
==== Q: How to create dynamic surface movies in nviz ====
  
 
A: see slides from the FOSS4G 2006 workshop: http://skagit.meas.ncsu.edu/~helena/grasswork/foss4g/FOSS4G06WKSVisual4anim.odp
 
A: see slides from the FOSS4G 2006 workshop: http://skagit.meas.ncsu.edu/~helena/grasswork/foss4g/FOSS4G06WKSVisual4anim.odp
 +
 +
 +
--------
 +
 +
 +
==== Q: How to animate a time series of raster maps? ====
 +
 +
A: Use [http://grass.ibiblio.org/grass63/manuals/html63_user/xganim.html xganim] to view on screen in X-windows, or [http://grass.ibiblio.org/grass63/manuals/html63_user/r.out.mpeg.html r.out.mpeg] to save to an MPEG-1 movie.
 +
 +
 +
--------
 +
 +
==== Q: How to animate a series of maps, including decorations? ====
 +
 +
A: Use the xmon drivers ([http://grass.ibiblio.org/grass63/manuals/html63_user/d.mon.html d.mon])
 +
to render the displays to a window via a shell script loop, then switch from the ''x0'' to ''PNG''driver to save as a series of PNG or PPM images. Use a method answered in a FAQ above to combine those into a single animation.
 +
 +
'''Example:''' ''[incomplete]''
 +
for IMG in `seq 0 100` ; do
 +
    d.rast
 +
    d.vect
 +
    d.graph << EOF
 +
      move $IMG 50
 +
      symbol basic/circle
 +
    EOF
 +
    echo "Title" | d.text
 +
done
  
  
 
[[Category:FAQ]]
 
[[Category:FAQ]]

Revision as of 14:51, 1 February 2007

Q: If anyone has tips on constructing high-quality MPEG-4 movies (animations) from a series of still frames, I'd be interested in hearing them.

Maris wrote:

Encode all .png files in directory to out.avi with 15 frames per second:

mencoder "mf:///path/to/files/*.png" -mf fps=15 -o out.avi # put -ovc here, see next lines

## for DivX - libavcodec MPEG 4 (DivX5), use:
-ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=1800 -ffourcc MP4S
## for XviD, use:
-ovc xvid -xvidencopts bitrate=1024
## for DivX4, use:
-ovc divx4 -divx4opts q=5

Uses mplayer's encoder. Choose one of encoding formats and append to end of "mencoder" line. Unfortunately only way to know quality settings is by encoding, watching result and reendocing with different params.

Notice - by default encoding with lavc will set video fourcc to FMP4, that can be decoded with ffdshow. Option -ffourcc MP4S will change it to MPS4 ("official" MS fourcc for mpeg4) and video will be playable on Windows by standart MS mpeg4 decoder. It may lead to side effects, if MS mpeg4 decoder is buggy. More info: http://www.itdp.de/mplayer-users/2005-03/msg00069.html




Q: How to generate an animated GIF, FLI, or MNG?

A: for animations of 300 frames or less, animated GIF, FLI, or MNG formats are smaller files and better quality (ie frames stored as PNG not JPEG). Create with gifsicle, ppm2fli, or for MNG use ImageMagick's 'convert'. With more than 300 frames the players usually have memory issues. Animated GIFs are playable in any web browser of course and also in OpenOffice.




Q: How to create dynamic surface movies in nviz

A: see slides from the FOSS4G 2006 workshop: http://skagit.meas.ncsu.edu/~helena/grasswork/foss4g/FOSS4G06WKSVisual4anim.odp




Q: How to animate a time series of raster maps?

A: Use xganim to view on screen in X-windows, or r.out.mpeg to save to an MPEG-1 movie.



Q: How to animate a series of maps, including decorations?

A: Use the xmon drivers (d.mon) to render the displays to a window via a shell script loop, then switch from the x0 to PNGdriver to save as a series of PNG or PPM images. Use a method answered in a FAQ above to combine those into a single animation.

Example: [incomplete]

for IMG in `seq 0 100` ; do
   d.rast
   d.vect
   d.graph << EOF
      move $IMG 50
      symbol basic/circle
   EOF
   echo "Title" | d.text
done