Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#9074 closed defect (invalid)

Joining similar MKV and TS results in broken video

Reported by: GrayFace Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: concat
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
ffmpeg can't join two excerpts of the same live stream if one of them is first converted (-c copy) to MKV format. This happens with any recorded *.ts files. I've attached 2 videos as an example, along with concat list and run.bat.
How to reproduce:

% ffmpeg.exe -nostats -safe 0 -f concat -i "List.txt" -c copy "out.mkv"
ffmpeg version 4.3.1 (from https://www.gyan.dev/ffmpeg/builds/)
built on 2021-01-01

Attachments (3)

in1.mkv (390.3 KB ) - added by GrayFace 3 years ago.
in2.ts (741.5 KB ) - added by GrayFace 3 years ago.
List.txt (27 bytes ) - added by Carl Eugen Hoyos 3 years ago.

Download all attachments as: .zip

Change History (24)

comment:1 by Carl Eugen Hoyos, 3 years ago

Resolution: invalid
Status: newclosed

Please use the FFmpeg user mailing list for all usage questions: it is not a limitation of FFmpeg that you cannot join many seemingly similar videos.

comment:2 by GrayFace, 3 years ago

Resolution: invalid
Status: closedreopened

This is a bug, not a usage question.

comment:3 by GrayFace, 3 years ago

And they're not "seemingly similar", they can be joined if both are left as TS or both are converted (-c copy) to MKV first.

comment:4 by Carl Eugen Hoyos, 3 years ago

Resolution: needs_more_info
Status: reopenedclosed

If you want to make this a valid tickets, please:
Attach your input files (no zip)
Test with current FFmpeg git head, the only version supported here, and post the command line you tested together with the complete, uncut console output

by GrayFace, 3 years ago

Attachment: in1.mkv added

by GrayFace, 3 years ago

Attachment: in2.ts added

comment:5 by GrayFace, 3 years ago

Resolution: needs_more_info
Status: closedreopened
ffmpeg version 2021-01-20-git-2021dbe1d6-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      56. 63.101 / 56. 63.101
  libavcodec     58.117.101 / 58.117.101
  libavformat    58. 65.101 / 58. 65.101
  libavdevice    58. 11.103 / 58. 11.103
  libavfilter     7. 96.100 /  7. 96.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
[matroska,webm @ 00000000005fdc80] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'List.txt':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(tv, smpte170m, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 60 fps, 60 tbr, 1k tbn, 120 tbc
    Metadata:
      DURATION        : 00:00:01.050000000
    Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp
    Metadata:
      DURATION        : 00:00:01.022000000                                 19:50
Output #0, matroska, to 'out.mkv':
  Metadata:
    encoder         : Lavf58.65.101
    Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(tv, smpte170m, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 60 fps, 60 tbr, 1k tbn, 1k tbc
    Metadata:
      DURATION        : 00:00:01.050000000
    Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, fltp
    Metadata:
      DURATION        : 00:00:01.022000000
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[matroska @ 0000000002dde940] Starting new cluster due to timestamp
frame=  114 fps=0.0 q=-1.0 Lsize=    1105kB time=00:03:03.83 bitrate=  49.3kbits/s speed=2.65e+03x
video:1063kB audio:40kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.239883%
Last edited 3 years ago by Carl Eugen Hoyos (previous) (diff)

comment:6 by Carl Eugen Hoyos, 3 years ago

Component: undeterminedavformat
Keywords: concat added
Version: unspecifiedgit-master

by Carl Eugen Hoyos, 3 years ago

Attachment: List.txt added

comment:7 by Carl Eugen Hoyos, 3 years ago

Resolution: invalid
Status: reopenedclosed

To quote the documentation at https://ffmpeg.org/ffmpeg-formats.html#concat-1
All files must have the same streams (same codecs, same time base, etc.).

comment:8 by GrayFace, 3 years ago

Resolution: invalid
Status: closedreopened

And they do. It says nothing about "container format", which is the only thing that's different between them.

comment:9 by Carl Eugen Hoyos, 3 years ago

Resolution: invalid
Status: reopenedclosed

comment:10 by GrayFace, 3 years ago

Resolution: invalid
Status: closedreopened

What do you think you're doing? Stop acting maliciously!

comment:11 by GrayFace, 3 years ago

Resolution: invalid
Status: closedreopened

(edited:removed double post)
All your questions have been clearly answered. Bug reports are for the devs to improve the product, not to fight over nothing making up invalid excuses to block them from seeing the bug.

Last edited 3 years ago by GrayFace (previous) (diff)

comment:12 by Carl Eugen Hoyos, 3 years ago

Resolution: invalid
Status: reopenedclosed

comment:13 by GrayFace, 3 years ago

Resolution: invalid
Status: closedreopened

comment:14 by Carl Eugen Hoyos, 3 years ago

Resolution: invalid
Status: reopenedclosed

comment:15 by GrayFace, 3 years ago

Resolution: invalid
Status: closedreopened

comment:16 by Carl Eugen Hoyos, 3 years ago

Resolution: invalid
Status: reopenedclosed

comment:17 by GrayFace, 3 years ago

Resolution: invalid
Status: closedreopened

comment:18 by Carl Eugen Hoyos, 3 years ago

Resolution: invalid
Status: reopenedclosed

comment:19 by Gyan, 3 years ago

Varied container formats are supported by the concat demuxer. However, Matrsoka uses a fixed time_base of 1/1000 and MPEG-TS a fixed time_base of 1/90000, and that is not supported by the demuxer, as documented.

in reply to:  19 comment:20 by GrayFace, 3 years ago

Replying to Gyan:

Varied container formats are supported by the concat demuxer. However, Matrsoka uses a fixed time_base of 1/1000 and MPEG-TS a fixed time_base of 1/90000, and that is not supported by the demuxer, as documented.

Thanks for the explanation. Though, ffmpeg producing invalid output and reporting that there were no errors still doesn't appear to be the best behavior.

comment:21 by Gyan, 3 years ago

The concat demuxer could do with input validation.

Note: See TracTickets for help on using tickets.