GNOME Bugzilla – Bug 575738
mpeg2enc's aspect parameter does not work properly
Last modified: 2009-03-30 19:34:13 UTC
I did a reencode of video with aspect=2 but when I examine the sequence header the aspect_ratio_information field is 12, not 2. According to table 6-3 of ISO 13818-2 12 is a reserved value. Also, it is not what I specified. In addition, the documentation gst-inspect shows for aspect= might be slightly misleading. When aspect_ratio_information==1 it means that the pixels are square, not that the width:height ratio is 1:1. An 800x400 video with aspect_ratio_information==1 will be very rectangular and not in the least bit square.
The documentation that gst-inspect shows for aspect-ratio might be slightly misleading, but only for the case == 1, and unfortunately mainly due to the necessarily concise nature of the cases' descriptions. Slightly more elaborate versions that should normally provide more clarity can be found in the man-page for mpeg2enc, whose options are closely paralleled in the plugin. Unfortunately, it is quite misleading (and possibly even wrong) for this option in there also ... On the more technical matter; are you sure that an MPEG2 format/profile was selected (?). As the man-page says (and a further look in mpeg2enc code shows), the specified aspect ratio is used directly for MPEG2, but it may be translated/transformed for MPEG1, in which case 12 is one of the possible outcomes.
Using mjpegtools 1.9, the following pipeline: ---- gst-launch -v videotestsrc num-buffers=1 ! mpeg2enc format=3 aspect=2 ! filesink location=temp.m2v ---- produces output that starts as follows: ---- 00000000 00 00 01 b3 14 00 f0 25 02 bf 63 80 00 00 01 b5 |.......%..c.....| ---- which should mean: 00 00 01 b3: start code 14 0: width 320 0 f0: height 240 2: aspect ratio