Concatenating in sync MP4 (H264+PCM instead of AAC) from a Sony 2018 Camera I downloaded these files (at max resolution 4K, that is important), in this order:

https://vimeo.com/195782736
https://vimeo.com/196725716
https://vimeo.com/195776765
https://vimeo.com/196651176
https://vimeo.com/195781480

please notice that these files are not "a video posted online" but the original output of a RX100m5!!

each video offers:
0:0 video
0:1 audio
0:2 "unknown to ffmpeg"

therefore I changed the titles into
a.mp4, b.mp4.......e.mp4
to avoid the error. Amen.

Question:

I want to simply concatenate them, i.e. no recode!

Problem:

Sony's output is "MP4 = H264av1 + PCM". Curiously PCM is NOT supported by MP4 container (see official specs on wikipedia).
Therefore ffmpeg is unable to do what I want. [It seems that Sony users never used ffmpeg].

I tried:
ffmpeg -f concat -i lista.txt -c copy concatenated.mp4

I got:

[mp4 @ 094630c0] Could not find tag for codec pcm_s16be in stream #1, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument


as stated above Sony puts PCM into MP4 and this is not allowed.
threfore I say let's to concatenate the files without recode/transcode and just change container:

ffmpeg -f concat -safe 0 -i "lista.txt" -map 0:0 -map 0:1 -c copy concatenated.mkv

ffmpeg -f concat -safe 0 -i "lista.txt" -c copy concatenated.mkv

I got: no error message but...out of sync. that is unacceptable.
[with MTS 1080p I simply concatenate them via the very very old Ts_splitter&amp;joiner.exe and all is fine and in sync!]

Addendum:

Only if I notice (like in the past!) that a simple "concatenate" let the Mb/s to drop down drastically, then I could add something like
-map "[v]" -map "[a]" -b:v 95000k
(that worked fine).

thanks for a working string for the 5 videos :)
...I warmly hoping that the output will be in sync.

best,
In this case, I can think of two possible causes. First is differing timebases for the video stream, which is definitely the case here. And second is unequal lengths of video and audio within each file. Unknown but unlikely since these are files produced by a camera.

The reciprocal timebase for the video stream is reported as its tbn value.

For the five files, they are 25k, 24k, 24k, 24k and 24k respectively. The first one should be changed to 24k, else the videos streams of subsequent videos will be speeded up 4%, causing a desync.

Normally, I would just rewrap the MP4, only changing the timescale. However, since PCM isn't supported in MP4 - the workaround here is to rewrap to MKV individually and then concat. Matroska files have a fixed timescale of 1000, so a simple command will do.

ffmpeg -i file.mp4 -c copy -dn file.mkv