Subject: [Viper-dev] [HG viper] Add movie making feature to Viper.

From: [email-masked]
Date: Mon, 15 Sep 2008 15:31:32 +0200 (CEST)

One or more new changesets pushed to the primary Viper repository.
A short summary of the last three changesets is included below.

changeset:   110:64d892b54a7781ec763a796882fc955b87acc8b8
tag:         tip
user:        "Ola Skavhaug <[email-masked]>"
date:        Mon Sep 15 15:33:19 2008 +0200
files:       src/viper/viper.py
description:
Add movie making feature to Viper.

changeset:   109:551c71828a3dc90e28284f239934d51c605a3859
user:        "Ola Skavhaug <[email-masked]>"
date:        Mon Sep 15 15:32:46 2008 +0200
files:       src/demo/test_movie.py
description:
Test of new movie making feature of Viper.

changeset:   108:69c12190b87e76724a6ab118c03ea2ea15cbd965
user:        "Johan Hake <[email-masked]>"
date:        Mon Sep 08 22:09:13 2008 +0200
files:       src/viper/viper.py
description:
Added:
 - support to write a simulation frame to a eps/ps/pdf image.
 - the keypress event of 'm' and 'n' for writing
   a simulation frame to a 'pdf' and 'eps' respectively
 - output information of keypress events for saving either
   data (vtk) or images (png,eps,pdf).

----------------------------------------------------------------------
For more details, visit http://www.fenics.org/hg/viper

---

From: Anders Logg <[email-masked]>
Date: Mon, 15 Sep 2008 15:34:38 +0200

> Add movie making feature to Viper.

Cool. How does it work?

-- 
Anders

---

From: Ola Skavhaug <[email-masked]>
Date: Mon, 15 Sep 2008 15:37:26 +0200

> > Add movie making feature to Viper.

Check src/demo/test_movie.py

Ola

> _______________________________________________
> Viper-dev mailing list
> [email-masked]
> http://fenics.org/mailman/listinfo/viper-dev

---

From: Anders Logg <[email-masked]>
Date: Mon, 15 Sep 2008 15:39:05 +0200

> Check src/demo/test_movie.py

Traceback (most recent call last):
  File "test_movie.py", line 6, in <module>
    plot.write_png()
  File "/usr/lib/python2.5/site-packages/viper/viper.py", line 308, in
  write_png
    if not self.basename: self.init_writer()
  File "/usr/lib/python2.5/site-packages/viper/viper.py", line 287, in
  init_writer
    self.pswriter = vtk.vtkGL2PSExporter()
AttributeError: 'module' object has no attribute 'vtkGL2PSExporter'

-- 
Anders

---

From: Ola Skavhaug <[email-masked]>
Date: Mon, 15 Sep 2008 15:51:25 +0200

> AttributeError: 'module' object has no attribute 'vtkGL2PSExporter'

OK, the patch from Johan worked fine here. Should be fixed now.

Ola

---

From: Anders Logg <[email-masked]>
Date: Mon, 15 Sep 2008 15:52:57 +0200

> OK, the patch from Johan worked fine here. Should be fixed now.

Yes!

-- 
Anders

---

From: Harish Narayanan <[email-masked]>
Date: Mon, 15 Sep 2008 16:36:07 +0200

> Add movie making feature to Viper.

I've attached a small (but cryptic) patch to change the mencoder mpeg4
encode settings used to create these movies.

With these new settings, the colour aliasing that shows up as the mesh
spins is much less pronounced. (At least to my eyes.)

http://home.simula.no/~harish/files/tmp/simulation-original.avi
http://home.simula.no/~harish/files/tmp/simulation-enhanced.avi

Harish
diff -r b69a1b059279 src/viper/viper.py
--- a/src/viper/viper.py	Mon Sep 15 16:02:33 2008 +0200
+++ b/src/viper/viper.py	Mon Sep 15 16:18:44 2008 +0200
@@ -372,7 +372,7 @@
 
             def run(self):
                 files = ",".join(self.files)
-                command = 'mencoder mf://%s -mf fps=%d -o %s.avi -ovc lavc  -lavcopts vcodec=mpeg4' % (files, self.fps, self.output)
+                command = 'mencoder mf://%s -mf fps=%d -o %s.avi -ovc lavc  -lavcopts vcodec=mpeg4:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:predia=2:dia=2:vmax_b_frames=2:vb_strategy=1:precmp=2:cmp=2:subcmp=2:preme=2:qns=2' % (files, self.fps, self.output)
                 failure = subprocess.call(command, shell=True)
                 if failure:
                     print "Could not make video, please check your mencoder installation!"

---

From: Ola Skavhaug <[email-masked]>
Date: Mon, 15 Sep 2008 17:26:23 +0200

> http://home.simula.no/~harish/files/tmp/simulation-enhanced.avi

Thanks,

I get the following error when trying to generate videos using your patch:

videocodec: libavcodec (600x400 fourcc=34504d46 [FMP4])
[VE_LAVC] High quality encoding selected (non-realtime)!
Writing header...2f (20%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
ODML: Aspect information not (yet?) available or unspecified, not writing vprp
header.
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp
header.
Segmentation faultf (30%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]

Any idea what goes wrong?

Ola

---

From: Harish Narayanan <[email-masked]>
Date: Mon, 15 Sep 2008 17:55:35 +0200

> Any idea what goes wrong?

What is your mencoder version? I have an old version from 2007 (MEncoder
dev-CVS-060307-04:23-4.0.1 (C) 2000-2006 MPlayer Team) for which these
flags work.

I will look at them one by one.

---

From: Ola Skavhaug <[email-masked]>
Date: Wed, 17 Sep 2008 09:09:00 +0200

> dev-CVS-060307-04:23-4.0.1 (C) 2000-2006 MPlayer Team) for which these

I have the standard one in 64bit Hardy:
Version: 2:1.0~rc2-0ubuntu13

Ola

---

From: Harish Narayanan <[email-masked]>
Date: Wed, 17 Sep 2008 09:10:09 +0200

> Version: 2:1.0~rc2-0ubuntu13

I don't have access to a 64 bit machine to try it out. I'll try googling
around. Does anyone else see the same problem with 32/64 bit mencoder?

(I see all the same ODML warnings even on my machine where it works, so
that doesn't help to discern what's causing your segfault.)

---

From: "Johannes Ring" <[email-masked]>
Date: Wed, 17 Sep 2008 09:13:32 +0200 (CEST)

> around. Does anyone else see the same problem with 32/64 bit mencoder?

Yes, I have the same problem on 32 bit Ubuntu Hardy. It's the one from
medibuntu:
MEncoder 2:1.0~rc2-0ubuntu13+medibuntu1

Johannes

---

From: Harish Narayanan <[email-masked]>
Date: Wed, 17 Sep 2008 09:20:53 +0200

> MEncoder 2:1.0~rc2-0ubuntu13+medibuntu1

All right. I'll fetch a recent mencoder on Hardy and figure out
appropriate non-crashy settings to reduce the colour aliasing.

---

From: Ola Skavhaug <[email-masked]>
Date: Wed, 17 Sep 2008 09:28:44 +0200

> appropriate non-crashy settings to reduce the colour aliasing.

Excellent!

Ola