<div dir="ltr">Zachary,<div>I'm attempting to do the *exact* same thing. I'm working on a KLV enc/dec pair for ffmpeg but I will not be able to release it :(. </div><div><br></div><div>However, if you grep ffmpeg's source (I'm working with 1.2.5), I see plenty of references (~10) to KVL in the MXF files. While this doesn't give a hint on how to create a new stream like you want, you can see it can be done - and I think the mxf KLV stuff is why that codec tag exists in ffmpeg at all.</div>
<div><br></div><div>I hope someone else can shed some more light on this. Very soon I will be putting my KLV enc/dec functions into a working ffmpeg "plugin" - thus creating a av_stream with my custom codec (and eventually into an MPEG2 muxer).<br>
</div><div><br></div><div>I wish you luck and I will report back here with my findings / code / progress. Sadly, you shouldn't count on me for this - but I will do my best to rely the information back. </div><div><br>
</div><div>-anthony</div><div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 13, 2014 at 1:43 PM, Sears, Zachary <span dir="ltr"><<a href="mailto:zachary.sears@lmco.com" target="_blank">zachary.sears@lmco.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks for the quick reply, I started down that path and do have code that generates valid TS packets with KLV data, from what you're saying it sounds like that was the right path to take. I guess the problem that I keep getting hung up on after that is how to create the additional stream to have a type of AVMEDIA_TYPE_VIDEO and at least an id of AV_CODEC_ID_SMPTE_KLV, from the output of ffprobe it certainly seems like this is recognized by ffmpeg but I can't figure out how to do it. For the video stream at least I do avformat_new_stream(avFormatContext, avCodec), but since there is no codec for the KLV data (NULL is returned from avcodec_find_encoder), I guess I am a little confused on how to get to that point. The end that I need to find eventually is getting down to av_interleaved_write_frame where the AVFormatContext has a valid data stream.<br>
<br>
<br>
-----Original Message-----<br>
From: <a href="mailto:libav-user-bounces@ffmpeg.org">libav-user-bounces@ffmpeg.org</a> [mailto:<a href="mailto:libav-user-bounces@ffmpeg.org">libav-user-bounces@ffmpeg.org</a>] On Behalf Of wm4<br>
Sent: Wednesday, August 13, 2014 10:08 AM<br>
To: <a href="mailto:libav-user@ffmpeg.org">libav-user@ffmpeg.org</a><br>
Subject: EXTERNAL: Re: [Libav-user] AV_CODEC_ID_SMPTE_KLV not recognized<br>
<br>
On Wed, 13 Aug 2014 15:53:33 +0000<br>
"Sears, Zachary" <<a href="mailto:zachary.sears@lmco.com">zachary.sears@lmco.com</a>> wrote:<br>
<br>
> Hello,<br>
><br>
> I am trying to create an application that can add a KLV data stream into an MPEG-TS stream. I started with the muxing.C example and have everything working as far as creating a valid MPEG-TS video, but when I try and include the KLV stream the encoder can't be found. In particular it is failing when I try AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_SMPTE_KLV), it returns with a failure to open the encoder. When I add the video stream the codec id is AV_CODEC_ID_MPEG2VIDEO which it finds perfectly fine and everything works just fine. I am using ffmpeg 2.1.4.<br>
><br>
> I also have a known good sample video that has KLV metadata in it and when I try to use ffprobe on that video it finds both streams but returns with "Unsupported codec with id 1263294017 for input stream 1" where input stream 1 is the KLV stream. Could it just be that I missed a flag at compile time, or simply need a newer version of FFMPEG?<br>
><br>
> Thanks for any help<br>
<br>
I have no idea what KLV is, but looking at the source, it seems KLV is supported for demuxing and muxing (in libavformat), but there are no encoders or decoders. I assume this means you have to interpret/generate KLV data yourself.<br>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
</blockquote></div><div><br></div>
</div></div>