2021-02-26

FFmpeg: Concatenate .webm files some are video only some audio only some with both

In my case I have 3 .webm files the first one is audio only, the second one is video only, the third one is audio and video.

I want to concatenate them into a single file which shows black screen for audio only parts, video for video only parts, and plays both for the parts that have audio and video.

The video codec is VP8, the audio codec is Opus.

concat.txt contains the entries for the three files

I am using the following command to concatenate them.

ffmpeg -f concat -safe 0 -i ./concat.txt -c copy -y output.webm

This command creates the output file, when I play it it only plays the first audio only part and crashes when it reaches the video only part.

I also tried to add a dummy picture to the audio only files but the command fails when I try to concatenate.

Any and all help/critique is welcome.

Thank you!

More Infor On the Input files

Input #0, matroska,webm, from 'original1.webm':
  Metadata:
    title           : -
    ENCODER         : Lavf58.45.100
  Duration: 00:00:09.99, start: 0.000000, bitrate: 34 kb/s
    Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp (default)
    Metadata:
      DURATION        : 00:00:09.990000000
Input #1, matroska,webm, from 'original2.webm':
  Metadata:
    title           : -
    ENCODER         : Lavf58.45.100
  Duration: 00:00:09.75, start: 0.000000, bitrate: 954 kb/s
    Stream #1:0: Video: vp8, yuv420p(tv, bt470bg/unknown/unknown, progressive), 1680x1050, SAR 1:1 DAR 8:5, 1k tbr, 1k tbn, 1k tbc (default)
    Metadata:
      DURATION        : 00:00:09.754000000
Input #2, matroska,webm, from 'original3.webm':
  Metadata:
    title           : -
    ENCODER         : Lavf58.45.100
  Duration: 00:00:10.02, start: 0.000000, bitrate: 912 kb/s
    Stream #2:0: Audio: opus, 48000 Hz, stereo, fltp (default)
    Metadata:
      DURATION        : 00:00:10.023000000
    Stream #2:1: Video: vp8, yuv420p(tv, bt470bg/unknown/unknown, progressive), 1680x1050, SAR 1:1 DAR 8:5, 1k tbr, 1k tbn, 1k tbc (default)
    Metadata:
      DURATION        : 00:00:09.965000000


from Recent Questions - Stack Overflow https://ift.tt/37MYz1N
https://ift.tt/eA8V8J

No comments:

Post a Comment