Factor out the code into a separate muxing-specific function. Stop accessing the deprecated AVStream-embedded codec context, use the average framerate (if specified) instead.
Checks that seek to start indeed seeks to start.