I found a good way to do it. On my system, long output lines are sprinkled with " ^M" (blank space followed by carriage return). The "^M" can be nicely replaced with the null character "^@", which does not display at all when you cat the file.
I capture timing too, so in order to replay the file perfectly, I cannot simply remove " ^M" completely using the commands below (because scriptreplay counts bytes):
tr '\r' '\0' | sed 's/ \x0//g'
I run my script command like this:
script -t -f session.log 2>timing
So, what I do afterwards is:
cat session.log | tr '\r' '\0' > typescript
scriptreplay -t timing | sed 's/ \x0//g'
The first edit (before replay) retains the number of bytes in the file.
The second edit (after the replay) gets rid of white space in random places.
(Note that by default scriptreplay looks for input file named "typescript", which is why I did not provide it after "timing".)