fixed a bug encoding video doesn't work as expected