Merge multiple webm files using avconv

7,646

Download

The first step is to download ffmpeg. It's a standalone binary so you don't need to install it. Just execute it directly.

Your (expired) Ubuntu version offers avconv which is missing many features including several concatenation functions.

Concatenate

Use the concat demuxer if you want to attempt to join them with no re-encoding. All videos must have the same parameters.

Use the concat filter if the videos vary in width, height, frame rate, etc. The filter will require re-encoding.

Note: You never did provide the info I requested a year and a half ago in my comments to your question, so I can't suggest which one you specifically need to use. Also, I can't provide examples specific to your inputs without this info, so the following examples are generic and may not work without additional options.

concat demuxer

Make a text file listing your inputs:

file 'input0.webm'
file 'input1.webm'
file 'input2.webm'

Now run ffmpeg:

ffmpeg -f concat -i input.txt -c copy output.webm

concat filter

In this example input1.webm has a bigger width x height than the others. This example command will scale input1.webm so it matches the other videos:

ffmpeg -i input0.webm -i input1.webm -i input2.webm -filter_complex \
"[1:v]scale=640:-1[v1]; \
 [0:v][0:a][v1][1:a][2:v][2:a]concat=n=3:v=1:a=1[v][a]" \
-map "[v]" -map "[a]" output.webm

Also see

Share:
7,646

Related videos on Youtube

Mandar Pandit
Author by

Mandar Pandit

Recognized Problem Solver with over 12 years of Experience delivering technology solutions for clients in a variety of business domains. Highly Skilled in Technical Analysis and Design, Problem Study and convert Solutions into working Application Prototypes. Specialized expertise in conceptualizing, modeling with Domain-Driven-Design concepts, and constructing JEE web-based solutions using open-source Frameworks, SOA, Web-Services SOAP and REST, and Microservices. Java, Spring Boot and Spring Cloud Ecosystem, NodeJS Ecosystem. Hobbyist Photographer, Innovative, #SOreadytohelp

Updated on September 18, 2022

Comments

  • Mandar Pandit
    Mandar Pandit over 1 year

    I have multiple .webm files in one location, say as inside video folder. I'm using Ubuntu 13.10 32bit system. I want to merge all my webm files in one output.webm file.

    I have read about ffmpeg, but when I tried ffmpeg with concat function I got:

    Unknown input format: 'concat'; And ffmpeg is deprecated and use avconv instead.

    Please suggest how to use avconv for merging multiple webm files to one.

    • llogan
      llogan over 9 years
      The fake ffmpeg from Libav is what was deprecated for avconv; not ffmpeg from FFmpeg. Unfortunately the maintainer refused to clarify that in the message resulting in confused users (and some think it was the intended effect).
    • llogan
      llogan over 9 years
      Please download a recent ffmpeg build and then show some info about your inputs. It will help me provide an answer, and avconv doesn't have the functionality of what I'm going to suggest. Include the full output of: ffmpeg -i input0.webm -i input1.webm -i input2.webm, etc.
    • andrew.46
      andrew.46 almost 8 years
      2 questions: 1. Which version of Ubuntu are you using? 2. What are the file names of your webm files?
    • Mandar Pandit
      Mandar Pandit almost 8 years
      Ubuntu is 13.10 32bit. No specific file names yet, you can just take file names as one.webm, two.webm, three.webm etc. and merge them into merged.webm.
    • llogan
      llogan almost 8 years
      @MandarPandit Support for Ubuntu 13.10 ended on 17 July 2014. You should upgrade to a supported version.
    • user.dz
      user.dz almost 8 years
      If you are not strict about tools, see with mencoder -oac copy -ovc copy -of lavf -o merged.webm one.webm, two.webm, three.webm . The only thing I noticed is the time shrink may be a bug or I'm missing something.
    • user.dz
      user.dz almost 8 years
      @LordNeckbeard, You are right in 16.04 it is just a link to ffmpeg . In 14.04, even -i concat:..|..|.." didn't work for me, and the only solution I could get it to work is mencoder as mentioned in the above comment. May be compiling ffmpeg from source is an option.
    • llogan
      llogan almost 8 years
      @Sneetsher I'm guessing the concat demuxer as you suggested will work with Ubuntu 15.04 and above because that's when ffmpeg returned to the repositories.
  • user.dz
    user.dz almost 8 years
    Nice to know about the static build availability , :) that's really helpful.
  • llogan
    llogan almost 8 years
    @Sneetsher If only someone will provide a variety of ARM builds for all of those Android users on Stack Overflow...we would see far fewer outdated 2.4.2 builds (not sure where they're all getting it from).
  • andrew.46
    andrew.46 almost 8 years
    @LordNeckbeard: Your neck beard is indeed long :)