Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue when concatenating mkvs using ffmpeg: How to set timestamps properly?

I've attempted to concatenate 2 mkv videos with ffmpeg, using the following commands:

ffmpeg -i file-01.mkv -f mpegts -c copy -bsf:v h264_mp4toannexb file-01.mpeg.ts
ffmpeg -i file-02.mkv -f mpegts -c copy -bsf:v h264_mp4toannexb file-02.mpeg.ts
ffmpeg -isync -i "concat:file-01.mpeg.ts|file-02.mpeg.ts" -f matroska
-c copy output.mkv

However, I receive the following error:

[matroska @ 0x7fc72a000600] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly [matroska @ 0x7fc72a000600] Can't write packet with unknown timestamp av_interleaved_write_frame(): Invalid argument

How do I go about setting the timestamps?

like image 854
a-goonie Avatar asked Oct 29 '22 13:10

a-goonie


1 Answers

Not necessarily a solution, per se, but mkvmerge worked for me in the end. Was much simpler, too:

mkvmerge -o "merged.mkv" "file1.mkv" +"file2.mkv"
like image 194
a-goonie Avatar answered Nov 17 '22 07:11

a-goonie