[FFmpeg-user] Concatenate two mp4 videos - result is not playable
Carl Eugen Hoyos
ceffmpeg at gmail.com
Fri Jan 20 13:23:43 EET 2017
2017-01-19 15:04 GMT+01:00 Maxime Daymard <mdaymard at gmail.com>:
> I'm trying to concat two videos (see link to dropbox) with the command below (concat
> demuxer), but the result is not playable, and I don't know why.
The reason is that h264 in mov/mp4 (contrary to h264 in mpegts) has a
needs to be valid for the whole file which is not possible for your
input videos as they
have very different properties.
> Basically, when I play the result concatenated video (A+B=C), the playback stops at B.
> I would like to avoid using the concat filter which is slower. If I could only re-encode
> "video2.mp4" so that the concat works, this would be perfect.
Not sure if it is possible:
The first video has profile "baseline" while x264 only allows
"constrained baseline" (which
is more correct, baseline has many features neither supported by
encoders nor decoders).
I did not (quickly) find a setting for x264 that makes the output
video compatible with video1.
(There may be one though.)
The following "works", I guess it doesn't really help you:
$ ffmpeg -i video1.mp4 -vcodec copy -acodec copy out1.ts
$ ffmpeg -i video2.mp4 -vcodec copy -acodec copy out2.ts
$ cat out1.ts out2.ts >out.ts
More information about the ffmpeg-user