Out of sync when I render whole the frames but it's OK when I render sub of it
Blender has an integrated feature for this very problem. Under your timeline, you have a sync too. If you set this to 'Frame Dropping', it will skip some frames during playback if your fps rate is too slow. This way it keeps the video in sync with real time.