Search code examples
videoffmpeglibvpx

FFMPEG: How to fix WebM file which was created by stitching multiple WebM files?


I have a file that has multiple WebM(vp9/opus) streams stitched together sequentially.

When trying to play it through regular media players it stops at the end of 1st stream in the sequence.

When used with FFMPEG for transcoding it to MP4, the trancoding stops at the end of first stream.

Using FFMPEG is it possible to make a regular WebM(vp9/opus) file from a file that contains multiple WebM(vp9/opus) stitched together sequentially?


Solution

  • You cannot achieve this with ffmpeg command line, but if you are writing your own transcoder based on ffmpeg libraries (avformat and avcodec), you can use a custom AVIOContext; when the first stream is finished, your context handler will know the file offset; now, you can skip forward until you come across the next 1a 45 df a3 marker, and open the next 'input file' at this position.