Video, when played, does not follow the timing you set in timelines. They have their own playback properties. Here’s how to control video. You could optionally set a ‘play’ action at the start of a timeline, and a ‘stop’ action at the end of a timeline, but this would need to be done with JavaScript using techniques described in that post.
Animated GIFs also exist in their own timelines. The Gif format says ‘play this frame, then this frame, then (optionally) loop’ – and you can’t control them with JavaScript, unfortunately, so you can’t tell a GIF to stop Giffing.