0

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&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,

0

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
  • Answer: please see bottom (since there are too many characters to be posted here). – anuswara May 12 at 14:54
0

Wow Gyan, your are great!!!!

I have to admit that I was not aware about the "small" difference in frequency 25 vs 24 = 1 tbn, and -concat can work only if all the files have exactly the same properties.

I did what you suggested for each file individually

ffmpeg -i a.mp4 -c copy -dn aaaaa.mkv ffmpeg -i b.mp4 -c copy -dn bbbbb.mkv .... ....

then

ffmpeg -hide_banner -f concat -safe 0 -i listaaaaa.txt -c copy concatenated.mkv

Here the readout with some messages at the end: https://drive.google.com/open?id=1sdRHslop1r9Jb1yfx9DPhrCthRDz1kJl

I can state that the final output (MKV) seems to me simply perfect!!!

ffprobe says:

start_time=0.000000<<

MPC-HC/Audio says:

Delay relative to video: -40 ms<<

Super! You helped me very fine, my congratulations. I warmly thank you. Best,

PS: I dont receive notification emails for replies hmmmmm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.