I'm concatenating .ts chunks intended for an HLS player into a single .mp4 video. Unlike in other questions these chunks possess same stream properties, However, some chunks have audio stream shorter than video stream and in that case the resulting clip has audio artifacts when playing in Media Player Classic (MPC-HC).
Workaround: demux video and audio streams into separate .m4a and .m4v files, concatenate them and then mux again.
Goal: create single clips from .ts chunks without intermediate files
Please help me find proper ffmpeg flags.
I have created sample chunks (this repo) out of a freeware cartoon to demonstrate the problem. The chunk
516-x.ts has audio stream 50ms shorter than video and in
517-x.ts it's longer.
ffmpeg -y -i playlist-x.ffconcat -c copy result.mp4
result.mp4 is played fine in
ffplay or Windows Media Player, but there's a short silence in MPC-HC in the second half of the clip.
ffmpeg -y -i 516-x.ts -an -c:v copy 516-x.m4v ffmpeg -y -i 516-x.ts -vn -c:a copy 516-x.m4a ffmpeg -y -i 517-x.ts -an -c:v copy 517-x.m4v ffmpeg -y -i 517-x.ts -vn -c:a copy 517-x.m4a ffmpeg -y -i playlist-x-a.ffconcat -c copy result.m4a ffmpeg -y -i playlist-x-v.ffconcat -c copy result.m4v ffmpeg -y -i result.m4v -i result.m4a -c copy result-good.mp4