How do I change the length of the timeline of the composition to only be as long as my video footage?
There's no built - in function that does it, but there's a script for that. I wrote one called first-n-last, it's available (free, open source) here https://blob.pureandapplied.com.au/

Alternatively, park your playhead at the beginning of the first layer (select that layer and hit i), then set the start of the work area to that frame by hitting b then select the last layer and hit go to the last frame (hit o) and set the end of the work area to that frame by hitting n. Now right click the work area and choose trim comp to work area from the contextual menu. This doesn't work for layers that extend beyond the beginning or end of the comp, but my srcipt does.