[MPlayer-dev-eng] [PATCH - don't apply] extended MPEG/DVD muxer
Nico Sabbi
nsabbi at tiscali.it
Tue Oct 12 01:10:36 CEST 2004
Hi,
I modified the current mpeg muxer (almost entirely rewritten) and the
muxer layer so as to make
the muxer configurable for a variety of video formats: dvd, mpeg1,
mpeg2, some of vcd/svcd.
Premise: I'm still developing the code, so it's not at all complete;
some crucial aspects must still
be solved: a/v delay in primis.
What has changed: possible outputs formats mpeg1, mpeg2, and the
corresponding variants (dvd/xvcd/xsvcd)
Ac3 muxing is now possible, both in mpeg2 and in mpeg1 (although it was
never standardized there's
only one possible implementation).
Variable packet_size configurable up to 65535.
How it works: since mpeg requires a kind of soft PLL (system clock known
as SCR), and since
the only reliable clock source is video frame duration => SCR is
emulated in terms of video timer
(for every gop it's increased in percentages of the total video+audio
bytes to write).
This method is usually quite accurate, but it may lead to audio_pts >
0.7 secs + SCR,
that is forbidden by the standard; I added some code to try to
compensate this situation,
but I still have to find a perfect solution.
Video is first reordered in decoding order (the current muxer doesn't do
it) and
then written in Gops; I also added some preliminary code to handle
correctly variable fps
movies, but currently it doesn't work well (yet).
Finally I added some utility function to patch the video sequence header
parameters
(bitrate, resolution, fps, aspect ratio), that often are wrong.
Some changes were necessary in the muxer layer itself, that currently is
too rigid and
optimistic (doesn't admit failure).
Performance will surely improve once I optimize the memory management.
Successfully tested with my standalone dvd player, mplayer and vlc (the
closest
software approximation of a standalone player that I know of).
How to use:
./mencoder -of mpeg -mpegopts format=dvd ...
possible parameters:
- format: dvd/xvcd/xsvcd/mpeg1/mpeg2
- size: pack size (default is 2048)
- init_apts: initial audio pts [0..500] default is 300 (don't touch it)
- init_vpts same for video ...
- muxrate multiplexing rate in kbit/s , default is 10080 for dvd compliance
parameters to patch video:
- vaspect: 1/1, 4/3, 16/9, 2.21/1
- vframerate 23.976/24/25/29.97/30/50/59.94/60
- vwidth and vheight: 0..4095
- vbitrate in kbit/s
I'd like if people experimented with this new muxer and reported
success/failer/suggestions.
Have fun.
P.S. please, don't complain because I changed the indentation style; I
will eventually reindent the final file
(although I deeply dislike the current one).
Nico
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpeg.diff
Type: text/x-patch
Size: 58953 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20041012/778bbff9/attachment.bin>
More information about the MPlayer-dev-eng
mailing list