Announcement

Collapse
No announcement yet.

Join multiple .mkv files into one using avconv or ffmpeg

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Join multiple .mkv files into one using avconv or ffmpeg

    Hi all,

    I'm looking to join lots of small video segments into one big one. The segments are all .mkv files.

    Looking through the manual for avconv, it seems as though I need to use the concat protocol, but I can't get it working.

    Please help!

    Feathers
    samhobbs.co.uk

    #2
    I use mkvmerge GUI. Its found in the repositories and its called mkvtoolnix-gui.

    Here is some information in it.

    http://www.bunkus.org/videotools/mkv...merge-gui.html

    I used this to put together a lot of short home movie clips. VLC will play .mvk files. I have VLC installed on all computers (Windows PCs included) at home so the entire family can enjoy the videos when they want to.

    It was easy to install. Here is the abbreviated output from my terminal. I'm running Kubuntu 12.04.
    Code:
    $ sudo apt-get install mkvtoolnix-gui
    
    The following NEW packages will be installed:
      libboost-filesystem1.46.1 libboost-system1.46.1 libwxbase2.8-0 libwxgtk2.8-0 mkvtoolnix mkvtoolnix-gui
    I found mkvmerge GUI to be very useful. I hope you have the same experience.
    sigpic

    Comment


      #3
      I tried -f concat and it works fine with ffmpeg, but not with avconv. Maybe there are some binary packages that allow to install ffmpeg alongside with avconv on kubuntu? I compiled ffmpeg from the source, went quite quick actually.

      Comment


        #4
        Join multiple .mkv files into one using avconv or ffmpeg
        Hi all,

        I'm looking to join lots of small video segments into one big one. The segments are all .mkv files.

        Looking through the manual for avconv, it seems as though I need to use the concat protocol, but I can't get it working.

        FFMPEG - How to concatenate (join, merge) media files: https://trac.ffmpeg.org/wiki/How%20t...0media%20files

        What is the output/error ?


        Maybe there are some binary packages that allow to install ffmpeg alongside with avconv on kubuntu?
        The FFMPEG can be compiled so that it is in the /opt...
        ffmpeg version 2.0 Copyright (c) 2000-2013 the FFmpeg developers
        built on Jul 15 2013 07:09:57 with gcc 4.7 (Ubuntu/Linaro 4.7.3-1ubuntu1)
        configuration: --prefix=/opt/ffmpeg --libdir=/opt/ffmpeg/lib/
        Earlier: http://www.kubuntuforums.net/showthr...l=1#post332936
        A good place to start: Topic: Top 20 Kubuntu FAQs & Answers
        Searching FAQ's: Google Search 'FAQ from Kubuntuforums'

        Comment


          #5
          Thanks for both suggestions, interesting that concat works for you with ffmpeg and not avconv, I'll see what happens on my machine and report back!

          Will try both ways when I get home tonight.

          Feathers
          samhobbs.co.uk

          Comment


            #6
            Firstly, ffmpeg:

            I tried this option and got an error.

            Code:
            feathers-mcgraw@62-West-Wallaby-Street:/data/Videos/Lake_District_2013/MKV$ ffmpeg -f concat -i mylist.txt -c copy joined.mkv
            ffmpeg version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2000-2013 the Libav developers
              built on Mar 30 2013 22:20:06 with gcc 4.7.2
            *** THIS PROGRAM IS DEPRECATED ***
            This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
            Unknown input format: 'concat'
            The mylist.txt file contains the following:

            Code:
            file '/data/Videos/Lake_District_2013/MKV/Filter_part_1_overview.mkv'
            file '/data/Videos/Lake_District_2013/MKV/Filter_part_2_collecting_water.mkv'
            file '/data/Videos/Lake_District_2013/MKV/Filter_part_3_inline_valve_demonstration.mkv'
            file '/data/Videos/Lake_District_2013/MKV/Filter_part_4_tablets.mkv'
            file '/data/Videos/Lake_District_2013/MKV/Filter_part_5_demonstration.mkv'
            file '/data/Videos/Lake_District_2013/MKV/Filter_part_6_timing_abridged.mkv'
            file '/data/Videos/Lake_District_2013/MKV/Filter_part_7_no_taste.mkv'
            Secondly, mkvmerge
            I tried mkvmerge, and the output file was just the first file with a different name. Not sure if I made a mistake...

            "mkvmerge output:"
            Code:
            mkvmerge v6.1.0 ('Old Devil') built on Mar  4 2013 20:24:55
            '/data/Videos/Lake_District_2013/MKV/Filter_part_1_overview.mkv': Using the demultiplexer for the format 'Matroska'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_2_collecting_water.mkv': Using the demultiplexer for the format 'Matroska'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_3_inline_valve_demonstration.mkv': Using the demultiplexer for the format 'Matroska'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_4_tablets.mkv': Using the demultiplexer for the format 'Matroska'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_5_demonstration.mkv': Using the demultiplexer for the format 'Matroska'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_6_timimg_abridged.mkv': Using the demultiplexer for the format 'Matroska'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_7_no_taste.mkv': Using the demultiplexer for the format 'Matroska'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_1_overview.mkv' track 0: Using the output module for the format 'MPEG-4'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_1_overview.mkv' track 1: Using the output module for the format 'Vorbis'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_2_collecting_water.mkv' track 0: Using the output module for the format 'MPEG-4'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_2_collecting_water.mkv' track 1: Using the output module for the format 'Vorbis'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_3_inline_valve_demonstration.mkv' track 0: Using the output module for the format 'MPEG-4'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_3_inline_valve_demonstration.mkv' track 1: Using the output module for the format 'Vorbis'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_4_tablets.mkv' track 0: Using the output module for the format 'MPEG-4'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_4_tablets.mkv' track 1: Using the output module for the format 'Vorbis'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_5_demonstration.mkv' track 0: Using the output module for the format 'MPEG-4'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_5_demonstration.mkv' track 1: Using the output module for the format 'Vorbis'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_6_timimg_abridged.mkv' track 0: Using the output module for the format 'MPEG-4'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_6_timimg_abridged.mkv' track 1: Using the output module for the format 'Vorbis'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_7_no_taste.mkv' track 0: Using the output module for the format 'MPEG-4'.
            '/data/Videos/Lake_District_2013/MKV/Filter_part_7_no_taste.mkv' track 1: Using the output module for the format 'Vorbis'.
            The file '/data/Videos/Lake_District_2013/MKV/joined.mkv' has been opened for writing.
            The cue entries (the index) are being written...
            Muxing took 3 seconds.
            "Warnings":
            Code:
            Warning: matroska_reader: Could not keep the track UID 1 because it is already allocated for the new file.
            Warning: matroska_reader: Could not keep the track UID 2 because it is already allocated for the new file.
            Warning: matroska_reader: Could not keep the track UID 1 because it is already allocated for the new file.
            Warning: matroska_reader: Could not keep the track UID 2 because it is already allocated for the new file.
            Warning: matroska_reader: Could not keep the track UID 1 because it is already allocated for the new file.
            Warning: matroska_reader: Could not keep the track UID 2 because it is already allocated for the new file.
            Warning: matroska_reader: Could not keep the track UID 1 because it is already allocated for the new file.
            Warning: matroska_reader: Could not keep the track UID 2 because it is already allocated for the new file.
            Warning: matroska_reader: Could not keep the track UID 1 because it is already allocated for the new file.
            Warning: matroska_reader: Could not keep the track UID 2 because it is already allocated for the new file.
            Warning: matroska_reader: Could not keep the track UID 1 because it is already allocated for the new file.
            Warning: matroska_reader: Could not keep the track UID 2 because it is already allocated for the new file.
            Any ideas?

            Feathers
            samhobbs.co.uk

            Comment


              #7
              You get the:
              Unknown input format: 'concat'
              error because:

              https://trac.ffmpeg.org/wiki/How%20t...0media%20files
              The concat demuxer was added to ffmpeg 1.1...
              The standard Ubuntu ffmpeg is telling:
              ffmpeg version 0.8.6-6:0.8.6-1ubuntu2
              *** THIS PROGRAM IS DEPRECATED ***
              This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
              => It is too old.

              Tried the concat with the ffmpeg 2.0 (1) - it is working: http://pastebin.com/2tfGnp0D


              The avconv docs - 3.12 How can I join video files?: http://www.libav.org/faq.html#How-ca...deo-files_003f


              (1)
              The ffmpeg, at here, is from: https://launchpad.net/~samrog131/+archive/ppa
              Installed with ffmpeg-set-alternatives (2) : http://pastebin.com/Gg11M2rz
              And then switching to the the ffmpeg 2.0 with the alternatives/kalternatives: http://www.kubuntuforums.net/showthr...l=1#post332936




              (2)
              :~$ apt-cache show ffmpeg-set-alternatives
              Package: ffmpeg-set-alternatives
              Priority: extra
              ...
              Recommends: kalternatives
              Depends: ffmpeg-real, ffmpeg
              ...
              Description: a package to create the Debian alternatives for the ffmpeg.
              A helper package to create and remove the alternatives for the ffmpeg.
              .
              The Debian alternatives system (man update-alternatives):
              .
              It is possible for several programs fulfilling the same or similar functions
              to be installed on a single system at the same time. For example,
              many systems have several text editors installed at once. This gives choice to the
              users of a system, allowing each to use a different editor, if desired,
              but makes it difficult for a program to make a good choice for an editor
              to invoke if the user has not specified a particular preference.
              Debian's alternatives system aims to solve this problem.
              .
              This package creates alternatives for the ffmpeg, ffplay, ffprobe and the ffserver.
              .
              The alternatives are removed when this package is removed.
              .
              Configuring of the alternatives can be made by the command line (man update-alternatives)
              or with the kalternatives.
              Last edited by Rog132; Sep 08, 2013, 02:18 PM.
              A good place to start: Topic: Top 20 Kubuntu FAQs & Answers
              Searching FAQ's: Google Search 'FAQ from Kubuntuforums'

              Comment


                #8
                Brilliant thanks... I need to learn to check that kind of thing, have had problems with old versions of programs from the repos quite a few times.

                Will install a newer version and try again.
                samhobbs.co.uk

                Comment


                  #9
                  My work flow to join multiple mkv files into one file is simple.
                  I use mkvmerge GUI v5.1.0.
                  I create a chapter.txt file ahead of time to set the chapter markers for my compilation.

                  The chapter.txt file looks like this.
                  Code:
                  CHAPTER01=00:00:00.000
                  CHAPTER01NAME=Chapter 1
                  CHAPTER02=00:05:02.000
                  CHAPTER02NAME=Chapter 2
                  CHAPTER03=00:11:07.000
                  CHAPTER03NAME=Chapter 3
                  CHAPTER04=00:17:07.000
                  CHAPTER04NAME=Chapter 4
                  CHAPTER05=00:24:36.000
                  CHAPTER05NAME=Don't Say Hi
                  You can leave the chapter names generic like Chapter 1, Chapter 2...etc. or you can name them like I did in Chapter 5, "Don't Say Hi"
                  CHAPTER01=00:00:00.000 <-- This is the start time for chapter one.
                  CHAPTER02=00:05:02.000 <-- This is the start time for chapter two and so on...

                  Launch mkvmerge GUI
                  1. On the input tab click the add button to add your file.
                  2. Click the append button to add the next movie clip to the end of the first one.


                  3. Click to open the Global tab.
                  4. In the Chapters section click the Browse button to browse for your chapter.txt file.
                  5. At the bottom click Browse to choose the output destination for your file. You can name your compilation here.
                  6. Click the Start muxing button. This was a fairly short video. Muxing took only 11 seconds.
                  sigpic

                  Comment


                    #10
                    @Rog132

                    I've just installed the new version of ffmpeg and all went according to plan

                    Thanks for your detailed instructions.

                    Kalternatives is really interesting too!



                    @life0riley

                    Thanks for your graphical solution. I'll try that out next time.



                    Feathers
                    samhobbs.co.uk

                    Comment

                    Working...
                    X