how to Concatenate mp4 or mkv files using avconv
Asked Answered
I

1

6

I have multiple mkv files in a ubuntu directory.I have installed 'avconv' tool and its working fine. My aim is to simple concatenate all those files and produce a single mkv file. I referenced so many articles and found that this command should serve the purpose:

avconv -i "concat:1-1.mkv|1-2.mkv|1-3.mkv" -c copy 1.mkv

However, when I run it, I get error:

concat:1-1.mkv|1-2.mkv|1-3.mkv: No such file or directory

I even tried it with mp4 files but still the same error.

Can anyone point out what wrong I am doing ? Or there is any other approach ?

Intern answered 6/6, 2016 at 14:26 Comment(0)
R
7

ffmpeg may turn out to be a better alternative. There is an entire wiki-page about concatenation of media files with ffmpeg.

Alternatively, try the mkvmerge utility:

mkvmerge -o 1.mkv 1-1.mkv + 1-2.mkv + 1-3.mkv

Richie answered 6/6, 2016 at 16:54 Comment(2)
Thanks, mkvmerge does the job perfectly !Intern
In case you have a directory of files you want to merge, something like mkvmerge -o ../merged.mkv $(ls -1 | paste -sd" " | sed 's/ / + /g') may come in handy (assuming the filenames do not contain spaces).Adrianneadriano

© 2022 - 2024 — McMap. All rights reserved.