The following commands generate two H.264 video clips, 10 seconds each, with different preset parameters (veryslow
vs veryfast
), and join them into one single MP4 container.
$ ffmpeg -loglevel quiet -f rawvideo -pix_fmt rgba -s 1920x1080 -r 30 -i /dev/zero -pix_fmt yuv420p -c:v libx264 -preset:v veryslow -t 10 part1.mp4
$ ffmpeg -loglevel quiet -f rawvideo -pix_fmt rgba -s 1920x1080 -r 30 -i /dev/zero -pix_fmt yuv420p -c:v libx264 -preset:v veryfast -t 10 part2.mp4
$ cat list
file part1.mp4
file part2.mp4
$ ffmpeg -f concat -i list -c copy join.mp4
So far so good. But if I try to play that file with ffplay
, I get a lot of errors like "decode_slice_header error", "illegal reordering_of_pic_nums_idc".
If two clips are both encoded with the same preset there is no problem.
Does that mean I cannot join two H.264 streams if they have different encoding parameters, even if their sizes, frame rates and pixel formats are all the same?