[GRASS5] Re: NVIZ movie encoding
Hamish
hamish_nospam at yahoo.com
Tue Jan 17 03:09:23 EST 2006
Hi,
just building the latest CVS with FFMPEG support for NVIZ.
I haven't seen any feedback yet, so I though I'd post some.
Platform: Debian/stable (sarge) Linux on a Pentium4.
===
./configure needed to use:
--with-ffmpeg --with-ffmpeg-includes=/usr/include/ffmpeg
"/usr/include/ffmpeg" seems pretty generic, shouldn't the #include line be
#include <ffmpeg/avcodec.h> instead of #include <avcodec.h> ?
That seems to be where it lives in Cygwin & Debian builds.
(in configure and lib/ogsf/gsd_img_ppm.c)
To build on Debian I needed to install the CVS versions of the libavcodec
and libavutil packages from Christian Marillat's inofficial Debian video
repository, as the non-CVS version in Debian/main doesn't include
libavutil.
# various video debs (avi mjpeg xvid acrobat, etc)
deb ftp://ftp.nerim.net/debian-marillat/ sarge main
These packages need to be installed:
libavcodeccvs-dev
libavutilcvs-dev
===
To switch the encoder to XVID [MPEG4] (yay!) from MPEG1 (yuk!), I made
these changes to lib/ogsf/gsd_img_ppm.c line ~ 150
- register_avcodec(&mpeg1video_encoder); /* just mpeg1 */
+ register_avcodec(&xvid_encoder); /* just Xvid */
and a few lines later
- codec = avcodec_find_encoder(CODEC_ID_MPEG1VIDEO);
+ codec = avcodec_find_encoder(CODEC_ID_XVID);
and a few lines later
- c->bit_rate = 400000;
+ c->bit_rate = 2000000; /* 2000 kbps, near DVD quality */
Increasing bitrate leaves you with a bigger file, but a much nicer one.
I know Xvid ver 1.0 has a "cartoon" mode which may improve NVIZ
animations a bunch, not sure exactly how to turn it on here? Probably
many more tweaks could be done, but I don't know how to turn on/off
codec options in the c-> array. ??? any hints or online references?
The FFMPEG Doxygen API docs seem to be down currently.
I did get the following error once, but otherwise it worked fine using
Xvid. Maybe image frame wasn't multiple of 8 or something that time?
dunno.
-- in pop-up window:
Error: gsd_init_mpeg failed to initialize MPEG stream
-- in terminal:
Opening MPEG stream
[xvid @ 0x40cef110]XviD: Could not create encoder reference
could not open codec
===
Another candidate for default encoder is Ogg Theora:
register_avcodec(&oggtheora_encoder); /* just Ogg Theora */
..
codec = avcodec_find_encoder(CODEC_ID_THEORA);
trying that I get this error:
G61> nviz
nviz: relocation error: /usr/local/src/grass/grass61/dist.i686-pc-linux-gnu/lib/libgrass_ogsf.so: undefined symbol: oggtheora_encoder
G61> ldd -r /usr/local/src/grass/grass61/dist.i686-pc-linux-gnu/lib/libgrass_ogsf.so
[...]
libogg.so.0 => /usr/lib/libogg.so.0 (0x4194f000)
libtheora.so.0 => /usr/lib/libtheora.so.0 (0x41955000)
libavutil.so.0 => /usr/lib/libavutil.so.0 (0x41973000)
[...]
undefined symbol: oggtheora_encoder (/usr/local/src/grass/grass61/dist.i686-pc-linux-gnu/lib/libgrass_ogsf.so)
$ grep theora /usr/include/ffmpeg/avcodec.h
extern AVCodec oggtheora_encoder;
extern AVCodec oggtheora_decoder;
extern AVCodec theora_decoder;
any ideas?
===
Steps to setup & create a keyframe animation:
In NVIZ,
Panel->Surface, set Polygon res to 2. (1 gives me display artifacts)
Panel->Keyframe animation
Set first view, click [Add].
Set [New key time] to 0:03:00, change view, click [Add].
Set [New key time] to 0:06:00, change view, click [Add].
etc.
** annoyance: [New key time] defaults to 1 minute increments. Could
this be changed to 5 seconds or so?
rewind & press the play button to preview.
Next click "Animation: [Run and Save]", type in a basename.mpg, click
the "<> MPEG-1 button", click the "<> Full Rendering" button, click [Ok].
whiz-bang-whirl.
It works great Bob, thanks! I still need to figure out how to use d.nviz
correctly & have it use existing (saved/tweakable) vector file lines for
the camera track.
Hamish
ps - for general interest, FFMPEG (or at least my avcodec.h) seems to
support these codecs for encoding:
ac3
mp2
mp3lame
oggvorbis
oggtheora
faac
xvid
mpeg1video
mpeg2video
h261
h263
h263p
flv
rv10
rv20
dvvideo
mjpeg
ljpeg
png
ppm
pgm
pgmyuv
pbm
pam
mpeg4
msmpeg4v1
msmpeg4v2
msmpeg4v3
wmv1
wmv2
huffyuv
ffvhuff
h264
asv1
asv2
vcr1
ffv1
snow
mdec
zlib
sonic
sonic
svq1
x264
amr
amr
libgsm
rawvideo
dvbsub
.
More information about the grass-dev
mailing list