[Ffmpeg-devel] DVD compliance, limited vertical range of motion vectors

Sven Over svenover
Wed Jul 27 12:32:53 CEST 2005

Hello, ffmpeg developers.

The last few days I was fighting a problem that DVDs I created with ffmpeg and 
dvdauthor did not properly play on a DVD player which is known to be very 
picky about the standards. While they worked on all other DVD players I 
tried, the videos stumbled and stuttered when played on a Pioneer DV-656A. 
'Mean' wrote me off-list that also had problems with another Pioneer player 
and that the Pioneer players were known to be very strict with the standards. 
He couldn't actually solve this problem, but his last guess were the scopes 
of motion vectors. And as far as I can see now, this is exactly the point.

DVD players have to be able to decode MP at ML (main profile at main level) MPEG2 
streams. The MPEG2 standard defines the vertical vector range for main level 
streams to be within -128 and 127.5 for frame pictures and -64 and 63.5 for 
field pictures. [ISO/IEC 13818-2, clause 8 "Profiles and Levels", table 8]. 
It says "this restriction applies to the final reconstructed motion vector. 
In case of dual prime motion vectors it applies before scaling is performed, 
after scaling is performed and after the small differential motion vector has 
been added." Whatever that means!

As Mean was saying, those Pioneer players are well suited to act as debugging 
machines, because they follow the standards that strict. My problem was, that 
every ffmpeg generated video did not properly play on that player (while it 
worked on any other player). Video streams from other sources (DVD, DVB) 
worked fine. Finally, I was able to get ffmpeg generated video running on 
that Pioneer player, by adding the "-me_range" option to the command line. So 
I guess, that it really is the part of the standard I just referred to, with 
which the ffmpeg generated video conflicts (if no "-me_range" is given).

I don't know what value I have to set "-me_range" to in order to be fully 
standards compliant. How do the numbers from the standard translate to the 
me_range option? Also, as it looks to me when browsing the ffmpeg sources, 
me_range does not only constrain the vertical range of motion vectors but 
both vertical and horizontal. So maybe a new option could be introduced to 
limit only the vertical range.

I tried out "-me_range 16" and "-me_range 256", both worked fine. I'm not sure 
if 256 is already too high, reflecting the numbers I quoted from the 
standard. My 4 minute test video played okay, that's all I can say. I'm not 
an expert on video compression, and I don't even now all the terms. I guess, 
that the numbers for "frame pictures" apply here. Anyway, for the moment I 
use "-me_range 63", just to be safe. "-me_range" doesn't seem to worsen the 
video quality very much -- indeed, I didn't notice a change at all.

So, maybe the MPEG experts here can have a quick look on this issue. I 
suggest, that the "-target dvd" switch (or maybe a "-strict" setting) should 
activate a limitation of the vertical vector ranges that is fully conformant 
to the standard, such that the video plays on *all* compliant DVD players.

So, thanks to all developers for all your work on ffmpeg. It's brillant... I 
hope I can contribute a little bit with this...


Sven Over
Stephanienstr. 9
76133 Karlsruhe

Telefon: 0721-9204199


More information about the ffmpeg-devel mailing list