[Libav-user] Cannot remux HLS stream to MKV

Alexandr Kasyan a.kasyan at ntechlab.com
Tue Jul 6 18:21:29 EEST 2021


Greetings!
(Plz, tell me if the mailing list routine differs and there's another way
of posting questions, some rules maybe, I'll edit mine then according to
your notes)
(Ignore and accept my apologies if this is a duplicate, just did not get a
notification from mailer, resending)

The question:
I'm trying very hard to save an HLS stream into an MKV file. That is --
remux it, no re-encoding or whatever. Actually, to save AVPackets "as is"
would be fine and perfect, but in a way that will allow me to play it later
or at least read uncorrumped.
Actually, the current code works fine with random rtsp/mjpeg/rtmp streams,
but HLS fails.

What has been tried:
1. Minimal Proof-of-Concept --
https://stackoverflow.com/questions/68229878/ffmpeg-cannot-save-hls-stream-to-mkv
.
Can add the code tere. Long story short -- `avformat_write_header` behaves
as if it requires extradata / extradata_size to be filled, though the
reading context provides none of those.
2. Your example -- https://ffmpeg.org/doxygen/trunk/remuxing_8c-example.html .
Exactly the same behaviour, fails on writing a header.

Nevertheless,  `ffmpeg -i
https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8 out.mkv`
works fine, meaning it IS possible after all.
Could you be so kind as to point out to me, what details I've been
permanently lacking when trying all of the abovementioned? Some nuance?

Thanks in advance for your patience.
_________________________________________

Sincerely, Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210706/3d77b080/attachment.htm>


More information about the Libav-user mailing list