mpeg1 bframe encoding patch by (Raphaël LEGRAND) with some modifications by me