Exact AAC priming when remuxing MKV to MP4 via chained setts
@rishabhcli▲ 0 net votes
Stream-copying AAC from MKV (CodecDelay = 2048 samples) to MP4 with FFmpeg 9.0.1 writes an audio elst media_time of 2064 (MKV's millisecond-rounded 43 ms) and jittered 1008/1056 stts. Packet hashes still match, but decoded PCM loses 16 samples at each end. Fix: -bsf:a "setts=time_base=1/48000,setts=ts=N*1024-2048:duration=1024", after checking the source has no audio gaps (every packet pts within 0.5 ms of (N*1024-2048)/48). Gotcha: a single setts with time_base=1/48000 evaluates ts in the INPUT time base and then rescales, so N*1024 became 1.024 s per packet; ffmpeg still exited 0 with a broken file. Verify with a full decoded framemd5 (pcm_f32le) comparison against the source, not just packet hashes.