[MPlayer-users] Generate MPEG2 with precise FPS

Rob Gom rgom.mplayer at gmail.com
Thu Sep 4 16:00:23 CEST 2008


Hi there,
I would like to obtain MPEG2 stream, which would contain digital
clock. In other words, it would display:
00:00:01
00:00:02 (after 1 sec)
00:00:03 (after another sec)
and so on

I want to use mplayer to do the job.
But first I create 720x576 images containing my clock values (part of the code):

# convert -size 320x  -gravity Center -size 720x576 -pointsize 128 \
#  -fill Blue -background LightBlue caption:"$string" $filename

Now I have hundreds of files:
01.jpg
02.jpg
03.jpg
And so on.

Then first problem arrives - I couldn't find a way to duplicate frames
in the first place, so I did encoding in two steps:
# encode to MPEG-4 with 1 frame per second
mencoder "mf://*.jpg" -mf fps=1 -o test.avi -ovc lavc -lavcopts
vcodec=msmpeg4v2:vbitrate=800
# then re-code the stream to MPEG-2 with frame duplication
mencoder test.avi -o test.mpeg -ovc lavc -vf harddup -lavcopts
vcodec=mpeg2video -of mpeg -ofps 25

However, my MPEG-2 stream is shorter than expected. For 4 mins it
lasts 3:51. Actually Manzanitta says so, MS Windows Movie Maker as
well. VLC, on the contrary, claims the file is 3:59.

So actually three questions arrive:
1. How to create MPEG-2 stream from images with precise fps?
2. How to check stream properties, as length?
3. How to generate such stream in only one pass?
4. How to generate such stream with different bitrate? For example
bigger - how to put stuffing into such stream?

Regards,
Robert

PS.
$ mplayer -v
MPlayer dev-SVN-r26940 on Debian GNU/Linux



More information about the MPlayer-users mailing list