Hi,

> Thanks very much for this response.  ffmpeg looks very useful to me, I
> am checking it out right now.  It is unclear to me what the overlap is
> with mplayer/mencoder.  It seems that ffmpeg is somewhat leaner and
> more portable, so I am thinking of using it as the encoder for your
> first suggestion (create a sequence of jpegs

Rather use a non-destructive compression like tiff or tga, the artifacts 
of jpg might become too visible after encoding especially if they vary 
from frame to frame. Disk is cheap these days.

>                                              with the tachyon
> raytracer, then convert to mp4).  ffmpeg seems quite fast to me
> compared to using imagemagick with GIFs.

It should be slower than animated GIFs, but I agree that it is quite
efficient. And quite portable, I even managed to compile it on Solaris
after some tweaking. There are two things to be careful about, and for
which it is quite better than mencoder in my experience:

- Colorspace encoding : for some reason mencoder wants YCbCr, and
  standard packages provide RGB ... Besides, ffmpeg doesn't like 16 bits
  per channel, and figuring that one out was tricky (the error message
  is a bit cryptic and sounds like "syntax error");

- Quality settings for the h264 codec. That is actually the big one. The
  main parameter is _not_ the bitrate ! Well, increasing the bitrate
  helps, but by default the "hi quality" mode is off and you need some
  tweaking. At the time I was experimenting to put bits of Dimensions
  online, and it turned out that the following parameters gave a good
  result:

  -vcodec libx264 -b $(VBR) -level 30 -mbd 2 -cmp 2 -subcmp 2 -g 300
  -qmin 1 -qmax 31 -flags +loop -chroma 1 -partitions partp8x8+partb8x8
  -flags2 +mixed_refs -me_method 8 -subq 7 -trellis 2 -refs 1 -coder 1
  -me umh -me_range 16 -bf 0 -sc_threshold 40 -keyint_min 25

  (Yes, that's all a long string of command-line arguments.) For 384x288
  resolution, a VBR of 200 kbps is enough. And I believe you will not
  find it so fast :-)

One last thing: Apple's implementation of h264 is not quite as complete
as the one of x264 (which I find quite ironic), so if you are not
careful the file you produce will not be readable on a mac ...

I am attaching a Makefile that I used to encode video, in case you find
it useful. Be sure to check out mp4creator after ffmpeg.

Have fun,


  /vincent

-- 
Vincent Beffara
UMPA - ENS-Lyon
46 allée d'Italie
69364 Lyon Cedex 07
Tél : 04 72 72 85 25

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

VBR = 700k
ABR = 64k

EXTRA_OPTS = 

# This one is _low_ quality:
#VIDEO_OPTS = -vcodec libx264 -b 700k -partitions parti4x4+partp8x8+partb8x8 
-me_method 7 -me umh -subq 5 -me_range 16 -coder 1 -trellis 1 -keyint_min 250 
-sc_threshold 40 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.60 -qmin 10 -qmax 51

# This one takes a _long_ time (6 fps) but looks right:
VIDEO_OPTS = -vcodec libx264 -b $(VBR) -level 30 -mbd 2 -cmp 2 -subcmp 2 -g 300 
-qmin 1 -qmax 31 -flags +loop -chroma 1 -partitions partp8x8+partb8x8 -flags2 
+mixed_refs -me_method 8 -subq 7 -trellis 2 -refs 1 -coder 1 -me umh -me_range 
16 -bf 0 -sc_threshold 40 -keyint_min 25

# No need for bettr audio than that though:
AUDIO_OPTS = -acodec libfaac -ac 1 -ar 44100 -ab $(ABR)

all: video.mp4 video.jpg

%.mp4: %.avi
        rm -f $@
        ffmpeg -pass 1 -i $< $(VIDEO_OPTS) -an $(EXTRA_OPTS) $@
        rm -f $@
        ffmpeg -pass 2 -i $< $(VIDEO_OPTS) $(AUDIO_OPTS) $(EXTRA_OPTS) $@
        rm -f ffmpeg2pass-0.log  x264_2pass.log
        mp4creator -hint=1 $@
        mp4creator -hint=2 $@
        mp4creator -optimize $@

%.flv: %.avi
        ffmpeg -i $< -f flv -b 300k -acodec libmp3lame -ar 22050 -ab 112k -y $@

%.jpg: %.avi
        rm -rf jpegs $@
        mplayer -nosound -vo jpeg:outdir=jpegs -vf framestep=750 -benchmark $<
        ln -s jpegs/00000001.jpg $@

Reply via email to