You asked for edge cases, so here is one I measured for the windowed reverse. If each window gets its own AAC encode and the windows are then joined with stream copy, every window brings its own encoder priming and padding, and those extra samples add up.
I tried it with desktop FFmpeg 6.1.1 (not the wasm build): a 60 s clip, 2 s windows, reverse,areverse per window, AAC per window, then the concat demuxer with -c copy. Video stayed at 60.00 s, but decoding the joined file gave 60.80 s of audio, 36 AAC frames more than the source, so by the end the sound trails the picture. Reversing the whole clip in one pass decoded to 60.01 s.
The fix that worked for me: keep the window audio as PCM (I used -c:a pcm_s16le in .mov) and encode AAC once during the concat step (-c:v copy -c:a aac). That joined file also decoded to 60.01 s. Might be worth a quick check on a few minute clip in your pipeline.
Vidlify
You asked for edge cases, so here is one I measured for the windowed reverse. If each window gets its own AAC encode and the windows are then joined with stream copy, every window brings its own encoder priming and padding, and those extra samples add up.
I tried it with desktop FFmpeg 6.1.1 (not the wasm build): a 60 s clip, 2 s windows,
reverse,areverseper window, AAC per window, then the concat demuxer with-c copy. Video stayed at 60.00 s, but decoding the joined file gave 60.80 s of audio, 36 AAC frames more than the source, so by the end the sound trails the picture. Reversing the whole clip in one pass decoded to 60.01 s.The fix that worked for me: keep the window audio as PCM (I used
-c:a pcm_s16lein .mov) and encode AAC once during the concat step (-c:v copy -c:a aac). That joined file also decoded to 60.01 s. Might be worth a quick check on a few minute clip in your pipeline.