[Libav-user] Cannot remux HLS stream to MKV
Alexandr Kasyan
a.kasyan at ntechlab.com
Mon Jul 12 15:07:59 EEST 2021
Nicolas George (2021-07-07)> Some codecs have two modes: one with global
extradata used in formats
> optimized for storage, one without used in formats optimized for
> streaming. You are probably getting the latter and trying to use where
> the former is needed.
>
> You probably need to insert one of the mp4toannexb bitstream filters.
That was an awesome idea, 'coz it both sounds reasonable and correlates
with what I've dug up in the ffmpeg sources so far.
Nevertheless, same error --
https://gist.github.com/MasterAler/d8639ed7bce6c9b4f3bc9be6dfc7e98d
The most important part is the following:
```cpp
if (codec_id == AV_CODEC_ID_H264 || codec_id == AV_CODEC_ID_HEVC) {
const char *filtername = codec_id == AV_CODEC_ID_H264 ?
"h264_mp4toannexb" : "hevc_mp4toannexb";
const auto *bsf = av_bsf_get_by_name(filtername);
if (!bsf) {
std::cerr << "failed to find bit stream filter" << std::endl;
return;
}
AVBSFContext *bsf_ctx_raw = nullptr;
err = av_bsf_alloc(bsf, &bsf_ctx_raw);
if (err < 0) {
std::cerr << "failed to allocate bit stream filter context" <<
std::endl;
return;
}
bsf_ctx = std::unique_ptr<AVBSFContext, void (*)(AVBSFContext
*)>{bsf_ctx_raw, [](AVBSFContext *p) { av_bsf_free(&p); }};
}
```
Then I try something as straightforward as av_bsf_send_packet +
av_bsf_receive_packet, from my experience that's a working approach.
Still "Invalid data found when processing input" =(( Any ideas, please? ((
________
Regards, Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210712/051475f1/attachment.htm>
More information about the Libav-user
mailing list