[FFmpeg-trac] #8578(avformat:new): FFmpeg 4.2 breaks Matroska streaming

FFmpeg trac at avcodec.org
Sun Mar 22 17:33:07 EET 2020


#8578: FFmpeg 4.2 breaks Matroska streaming
----------------------------------+----------------------------------
             Reporter:  Sesse     |                     Type:  defect
               Status:  new       |                 Priority:  normal
            Component:  avformat  |                  Version:  4.2
             Keywords:  matroska  |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
----------------------------------+----------------------------------
 Hi,

 I'm having an application that creates Matroska streams on-the-fly by
 reusing chunks between HTTP clients:

 1. Set up a callback in avio->pb.
 2. Call avformat_write_header(), store what is returned in variable.
 3. Whenever a client connects, immediately send the contents of said
 variable.
 4. For each packet to mux, call avformat_interleaved_write() as usual, and
 send the results to every connected client.

 In other words, there might be intermediate packets from the start of the
 stream that a client won't be seeing, but this is fairly common (I believe
 e.g. VLC does the same thing). It has worked fine in FFmpeg for a few
 years, but after 4.2, clients now cannot decode anything:

 [mkv] Invalid EBML length at position 716
 [ffmpeg] Cannot seek backward in linear streams!
 [mkv] Unexpected end of file (no clusters found)

 I've bisected, and although the results are a bit fuzzy, I believe this is
 the commit that broke it:

 {{{
 commit add68dcca958f0f6b42cabea6f546ceae5c7f16d
 Author: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
 Date:   Sat Apr 20 01:41:06 2019 +0200

     avformat/matroskaenc: Write CRC-32 in non-seekable mode

     Given that in both the seekable as well as the non-seekable mode
 dynamic
     buffers are used to write level 1 elements and that now no seeks are
     used in the seekable case any more, the two modes can be combined; as
 a
     consequence, the non-seekable mode automatically inherits the ability
 to
     write CRC-32 elements.

     There are no differences in case the output is seekable; when it is
 not
     and writing CRC-32 elements is disabled, there can still be minor
     differences because before this commit, the EBML ID and length field
     were counted towards the cluster size limit; now they no longer are.

     Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
     Signed-off-by: James Almer <jamrial at gmail.com>
 }}}

 I can't find any way to fix it with flags. I've tried setting "live" to 1,
 and I've tried setting "write_crc32" to 0 (both of them with
 av_dict_set()), but it doesn't seem to change anything.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/8578>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list