I'm want to concatenate different video-files of random format. First I convert them to flv, adapt the framerate of each video to lowest of the involved videos. Next step is to decode them and remove the header (but not the header of the first video in the sequence, then I concatenate them with cat and finally I encode the resultsequence.
But the video- and audio-track are going more and more out of sync from sequence-part to sequence-part.
Would be glad for any idea.
Your problem then is staying in sync while going through concat process. Rule of thumb, the less steps the better. This should solve your problem. First, use mpg instead of flv for intermediate format. Second, add -copyts to each command (copies timestamps to retain sync). Also, there's no need to go to the lowest framerate. You can retain the quality of the highest video through this process. Try this:
Now you should have two (large) intermediate files of compatible video quality (variable:
-qscale:v 1
). You're ready to glue them together.If you're on Windows, you'll be fine as is. On UNIX flavors, you'll need a backslash before the pipe. (On my version I get a flood of
buffer underflow / packet too large, ignoring buffer limits to mux it
errors. They seem to be harmless.) Now you can convert to whatever more useful format you want with more realistic quality.I've had success keeping the concatenated videos in sync but the quality does not seem as good as it should be. Maybe tweak the intermediate file parameters.