For more than two files, the following may work better: Create a text file named vidlist.txt (or filelist.txt or whatever filename you prefer) in the following format:
Note that these can be either relative or absolute paths.
Then issue the command:
ffmpeg -f concat -safe 0 -i vidlist.txt -c copy output.ext
There are probably ways to get a better output, but this worked just fine for my purposes.
ffmpeg -i input.mpg -c:v libx264 -preset slow -crf 19 -c:a copy output.mkv
This worked, allowing me to keep the original audio. FFMPEG gave me a warning about a library mismatch, so my version of FFMPEG probably isn't using libx264. But it still wrote an AVC format into the MKV container, so all was well. I may try it without a library specified at some point just to see what happens. The output was all right, but I think I would have preferred a higher bitrate. So I may specify a lower crf next time.
Here, the options mean the following:
-ss specifies the start time, e.g. 00:01:23.000 or 83 (in seconds)
-t specifies the duration of the clip (same format).
Recent ffmpeg also has a flag to supply the end time with -to.
-c copy copies the first video, audio, and subtitle bitstream from the input to the output file without re-encoding them. This won't harm the quality and make the command run within seconds.
Better method if the version used supports it:
ffmpeg -i b.mkv -c copy -ss 00:00:20 -to 00:50:04 b2.mkv
If starting from the beginning of the file, -ss can be omitted: ffmpeg -i 1.mkv -c copy -to 01:26:53 b2.mkv
ffmpeg -i Movie.mkv -map 0:s:0 subs.srt
And named the SRT file to the same name as the MKV file, and the subtitles displayed just fine.
A video file and an audio file have been renamed to a.ext for convenience:
ffmpeg -i a.mp4 -i a.aac -c copy output.mkv
Subtitle codec 94213 is not supported
and the second was
Could not write header for output file #0 (incorrect codec parameters ?): Function not implemented
Turned out, after some experimenting, that ffmpeg just didn't like that subtitle file at all. So, I looked up on the internet how to remove it:
ffmpeg -i video.mkv -vcodec copy -acodec copy -sn video-no-subs.mkv
And I was able to remux just fine.
Then, I used this line:
ffmpeg -i file.vob -vf "fieldmatch,yadif,decimate" -preset slow -crf 21 -c:a copy 1.mkv
The crf level would vary depending on the episode or movie. This one was an hour and a half, and 21 got it down to 1.29 gigs, which wasn't too bad. The yadif settings were for inverse telecine (video pattern of two frames interlaced, three not). For top frame first interlacing, I'm using a simple yadif setting that causes it to detect the interlacing and deal with it:
ffmpeg -i file.vob -vf yadif -preset slow -crf 19 -c:a copy 1.mkv
Adding -r 30000/1001 after the input file may prevent problems with audio sync in some circumstances, such as the Past duration...too large warning.